Skip to content

fs/littlefs: Enforce open permissions and set create ownership#19166

Open
Abhishekmishra2808 wants to merge 1 commit into
apache:masterfrom
Abhishekmishra2808:vfs/littlefs-permissions
Open

fs/littlefs: Enforce open permissions and set create ownership#19166
Abhishekmishra2808 wants to merge 1 commit into
apache:masterfrom
Abhishekmishra2808:vfs/littlefs-permissions

Conversation

@Abhishekmishra2808

@Abhishekmishra2808 Abhishekmishra2808 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Note: Please adhere to Contributing Guidelines.

Summary

Check open access against file mode and owner via fs_checkmode(), verify parent directory permissions on create, and assign creator uid/gid to newly created files.

Impact

  • Enforce open permission checks on littlefs files via fs_checkmode()
  • Check parent directory permissions on create (W_OK | X_OK)
  • Set uid/gid on new files from the creator's effective identity
  • Gate permission helpers on CONFIG_FS_PERMISSION and CONFIG_FS_LITTLEFS_ATTR_UPDATE

Depends on

  • PR1: fs/inode permission helpers (fs_checkmode, fs_checkopenperm)

Testing

Tested on ESP32C3,
image

@github-actions github-actions Bot added Area: File System File System issues Size: M The size of the change in this PR is medium labels Jun 17, 2026
@Abhishekmishra2808 Abhishekmishra2808 force-pushed the vfs/littlefs-permissions branch from 5ea99b9 to fdc0611 Compare June 18, 2026 06:54
@linguini1

Copy link
Copy Markdown
Contributor

How was this tested?

@Abhishekmishra2808

Copy link
Copy Markdown
Contributor Author

How was this tested?

@linguini1, Please review the updated PR description.

@Abhishekmishra2808

Copy link
Copy Markdown
Contributor Author

@acassis PTAL

@acassis acassis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Abhishekmishra2808 please update the LittleFS documentation as well

Comment thread fs/littlefs/lfs_vfs.c

@linguini1 linguini1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to do more than just add permission checking.

Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c
@Abhishekmishra2808 Abhishekmishra2808 force-pushed the vfs/littlefs-permissions branch from fdc0611 to bde985c Compare June 19, 2026 15:42
@Abhishekmishra2808

Copy link
Copy Markdown
Contributor Author

My bad, I forgot to do a rebase. These edits are totally unintentional and came from not rebasing onto master. Now I have fixed these.
Thanks - @linguini1

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@Abhishekmishra2808 Abhishekmishra2808 force-pushed the vfs/littlefs-permissions branch from bde985c to d0121c2 Compare June 19, 2026 15:52
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation and removed Area: File System File System issues labels Jun 19, 2026
@Abhishekmishra2808 Abhishekmishra2808 force-pushed the vfs/littlefs-permissions branch from d0121c2 to 80cf4cd Compare June 19, 2026 15:58
@Abhishekmishra2808

Copy link
Copy Markdown
Contributor Author

@acassis, I have added the docs as well. Please check.

acassis
acassis previously approved these changes Jun 19, 2026
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/inode/inode.h Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
linguini1
linguini1 previously approved these changes Jun 20, 2026
acassis
acassis previously approved these changes Jun 20, 2026
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Comment thread fs/littlefs/lfs_vfs.c Outdated
Check open access against file mode and owner via fs_checkmode(), verify
parent directory permissions on create, and assign creator uid/gid to
newly created files.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
@Abhishekmishra2808 Abhishekmishra2808 force-pushed the vfs/littlefs-permissions branch from 519a9e2 to 39f29ce Compare June 20, 2026 18:17
@acassis

acassis commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

@jerpelea please backport to V13 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants