Skip to content

fs/fat: Report execute permission for files and directories. - #20754

Merged
acassis merged 2 commits into
apache:masterfrom
casaroli:fs-fat-xbits
Oct 18, 2026
Merged

acassis merged 2 commits into
apache:masterfrom
casaroli:fs-fat-xbits

Conversation

@casaroli

@casaroli casaroli commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

FAT has no execute permission. fat_stat() and fat_fstat() reported r--r--r-- or rw-rw-rw- for every file and directory, also for the root directory. So a program on a FAT volume had no execute bit, and no directory had the search bit.

This PR reports the execute bit for all files and directories, in the same way as the read bit. Other systems mount FAT with these bits by default.

The second commit updates the ls -l examples of FAT volumes in Documentation/applications/nsh/commands.rst.

Impact

Only the mode that stat() reports changes. With CONFIG_SCHED_USER_IDENTITY, exec() checks the execute bit, so with this PR a program on a FAT volume can run instead of failing with EACCES.

Testing

A test on qemu-armv8a:nsh (QEMU 11 with HVF on an Apple M4) with FAT, mkfatfs, mkrd and CONFIG_PSEUDOFS_FILE: a FAT RAM disk with a file and a directory, a pseudo file, then ls -l of /fat, /, /proc and the pseudo file, on master and with this PR.

Path master this PR
file on FAT -rw-rw-rw- -rwxrwxrwx
directory on FAT, FAT root drw-rw-rw- drwxrwxrwx

tools/checkpatch.sh -c -u -m -g passes.

FAT has no execute permission.  fat_stat() and fat_fstat() reported
r--r--r-- or rw-rw-rw- for every file and directory, also for the root
directory.  So a program on a FAT volume had no execute bit, and no
directory had the search bit.

Report the execute bit for all files and directories, in the same way
as the read bit.  Other systems mount FAT with these bits by default.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
@casaroli
casaroli requested a review from acassis as a code owner October 17, 2026 22:03
@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 Oct 17, 2026
FAT now reports execute permission for files and directories, so the
"ls -l" examples of FAT volumes in the NSH command page show rwx.

Update the examples.  Devices do not change.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation and removed Area: File System File System issues labels Oct 17, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@acassis
acassis merged commit b780600 into apache:master Oct 18, 2026
54 checks passed
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: 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