You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "casaroli (via GitHub)" <gi...@apache.org> on 2026/10/13 12:30:42 UTC

[PR] fs: Set the mode that chmod() gives, on v9fs and in the VFS. [nuttx]

casaroli opened a new pull request, #20631:
URL: https://github.com/apache/nuttx/pull/20631

   ## Summary
   
   Two defects in `chmod()`:
   
   - `v9fs_client_chstat()` converts `st_mode` with `v9fs_map_open_flags()`, which maps the `O_*` flags of `open()`. `chmod()` on a v9fs file sets a wrong mode: 755 gives 701, 644 gives 600 and 777 gives 700. The first commit sends the permission bits of `st_mode`.
   - `chmod()`, `lchmod()` and `fchmod()` mask the mode with 0777, so a program cannot set `S_ISUID`, `S_ISGID` or `S_ISVTX`, although `exec()` of a binary with `S_ISUID` sets the effective user ID. The second commit masks the mode with 07777.
   
   ## Impact
   
   `chmod()`, `lchmod()` and `fchmod()` on all file systems: the set-user-ID, set-group-ID and sticky bits are now kept. On v9fs, the mode that `chmod()` sets is now the mode that the caller gives. No API change.
   
   ## Testing
   
   `qemu-armv8a:knsh` with a virtio 9P share, with these commits on a larger local branch. For each mode: create a file on the share, `chmod` it, and read the mode back with `stat -c %a`.
   
   Before: `chmod 755` gave 701 and `chmod 777` gave 700, and the set-user-ID, set-group-ID and sticky bits were lost.
   
   After: for 755, 644, 4755, 2755, 1777 and 6711, the mode read back is the mode given.
   
   Build: `qemu-armv8a:nsh` and `qemu-armv8a:knsh`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fs: Set the mode that chmod() gives, on v9fs and in the VFS. [nuttx]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20631:
URL: https://github.com/apache/nuttx/pull/20631#issuecomment-6156458187

   <!-- membrowse-pr-comment -->
   ## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report
   
   *No memory changes detected for:*
   - [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   - [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   - [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   - [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   - [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   - [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   - [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   - [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   - [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=af070e7499fc9a08554178b3a3d311e23bee4540&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fs: Set the mode that chmod() gives, on v9fs and in the VFS. [nuttx]

Posted by "linguini1 (via GitHub)" <gi...@apache.org>.
linguini1 merged PR #20631:
URL: https://github.com/apache/nuttx/pull/20631


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org