Skip to content

fs/vfs: validate chmod and chown callers in inode_chstat()#18914

Open
Abhishekmishra2808 wants to merge 1 commit into
apache:masterfrom
Abhishekmishra2808:fs/inode-chstat-validation
Open

fs/vfs: validate chmod and chown callers in inode_chstat()#18914
Abhishekmishra2808 wants to merge 1 commit into
apache:masterfrom
Abhishekmishra2808:fs/inode-chstat-validation

Conversation

@Abhishekmishra2808
Copy link
Copy Markdown
Contributor

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.

image ostest and checkpatch tests all passed

@github-actions github-actions Bot added Area: File System File System issues Size: S The size of the change in this PR is small labels May 20, 2026
Comment thread fs/vfs/fs_chstat.c Outdated
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: File System File System issues Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants