Repository navigation
pipes, vfs: per-uid shares of the pipe table and the VFS descriptor table - #191
Merged
Merged
Conversation
…able Both tables are system-wide and had no per-uid share. One user holding all 8 pipe slots made every other user's PIPE_OP_CREATE fail with -EMFILE. A ramfs directory open takes no ramfs fd, so it met no per-uid cap at all, and one user's processes could fill the VFS primary pool and starve every other user's opens. Both were listed as open in SECURITY_AUDIT_2026-10 §3. - sys_pipe CREATE: a non-root uid holding PIPE_USER_MAX (4), or reaching into the last PIPE_ROOT_RESERVED (2) free slots, gets -EAGAIN. The FAT32 #181 pattern. owner_uid survives orphaning, so a pipe a child still holds keeps counting. The count, slot choice and claim now run in one critical section; previously the free-slot search and the claim were split by the buffer allocation. - vfs_alloc_fd: a non-privileged uid holding VFS_USER_MAX_FDS (24) gets VFS_EAGAIN (-11). That is above one process's 16-slot table, so a process with a full table can still exec and spawn. vfs_free_fd's memset clears owner_uid. - Both refusals are kdbg traces, not console lines. verify-uid-caps.sh drives the new /capprobe.elf as a non-root user, twice (the second time at loglevel debug, to require the refusal traces): unfixed tree: FAIL (pipes 8 then -24; dirs parent 16 + child 16, -24) fixed tree: PASS (pipes 4 then -11; dirs parent 16 + child 8, -11; both slots come back; no console lines) Regressions: verify-pipe-fixes, verify-pipe-uaf, verify-ramfs-vfs-fixes, verify-fat32-fd-cap all PASS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes the two per-uid gaps that
doc/SECURITY_AUDIT_2026-10.md§3 listed as open.What was wrong
pipe_table[8]had no per-uid share. One user holding all 8 made every other user'sPIPE_OP_CREATEfail with-EMFILE.Fix
sys_pipeCREATE: a non-root uid holding 4 pipes (PIPE_USER_MAX), or reaching into the last 2 free slots (PIPE_ROOT_RESERVED), gets-EAGAIN. This is the FAT32 fat32: per-uid cap on the open-file table; error paths off the console #181 pattern.owner_uidsurvives orphaning, so a pipe a child still holds keeps counting.vfs_alloc_fd: a non-privileged uid holding 24 descriptors (VFS_USER_MAX_FDS) gets-EAGAIN.kdbgtraces, not console lines.Witness
verify/verify-uid-caps.shdrives the new/capprobe.elfas a non-root user, twice. The second run is at loglevel debug and requires the refusal traces.On the fixed tree the slots come back after release, and nothing prints at the normal loglevel.
Regressions, all PASS:
verify-pipe-fixes,verify-pipe-uaf,verify-ramfs-vfs-fixes,verify-fat32-fd-cap.Not witnessed: the pipe root reserve. It needs two uids holding slots at once, and it shares the counting loop with the per-uid share.
🤖 Generated with Claude Code