fs/vfs: validate chmod and chown callers in inode_chstat()#18914
Open
Abhishekmishra2808 wants to merge 1 commit into
Open
fs/vfs: validate chmod and chown callers in inode_chstat()#18914Abhishekmishra2808 wants to merge 1 commit into
Abhishekmishra2808 wants to merge 1 commit into
Conversation
xiaoxiang781216
previously approved these changes
May 20, 2026
acassis
requested changes
May 20, 2026
Comment on lines
+448
to
+449
| FAR struct tcb_s *rtcb; | ||
| uid_t euid; |
Contributor
There was a problem hiding this comment.
@Abhishekmishra2808 NuttX enforces C89 in the common code and declaring a variable in the middle of a function is a violation. Please declare these variable at the beginning of the function.
Contributor
Author
There was a problem hiding this comment.
Fixed - moved the declarations to the beginning of the function
Add pseudoFS caller validation for chmod and chown operations using the caller's effective uid. Align behavior with POSIX semantics by allowing owner/root chmod and root-only chown. Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
c13f230 to
f50f4ee
Compare
xiaoxiang781216
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Please adhere to Contributing Guidelines.
Summary
Add caller validation for pseudoFS chmod and chown operations in inode_chstat(). This change validates the caller using the task's effective uid and aligns pseudoFS permission behavior with POSIX-style semantics by allowing owner/root chmod operations while restricting chown to root-only.
Impact
Prevents unprivileged tasks from modifying pseudoFS inode ownership or mode bits for arbitrary files. The change affects only pseudoFS inode attribute updates through inode_chstat() and does not modify mountpoint filesystem behavior.
Testing
Validated using a dedicated permission test application on NuttX sim and compared against equivalent Linux behavior . Tested scenarios include root chmod, owner chmod, non-owner chmod denial, root chown, non-root chown denial, ownership propagation, and verification of -EPERM for denied operations.