mnt: descriptor-confine mount destination resolution#287
Conversation
|
Nice work — descriptor-confining destination resolution and pinning post-attach identity to the attached mount fd is the right way to close these TOCTOU windows, and the test matrix (both backends, A few things before this is easy to land:
Overall the invariants ( |
|
Thanks for the careful review. A few clarifications:
I also reran the current destination-confinement and attach-identity matrices locally again today while checking your notes; the current branch behavior is consistent with the intended invariants. |
|
Small follow-up after another local pass over the edge cases discussed here. I checked a few things that were not covered as explicitly in my previous comment:
I also rebuilt the normal release binary after the hook-enabled tests and checked that the test hook compiles back down to a no-op outside I still have not done a physical old-kernel/old-libc boot test, so I do not want to overclaim that part. The branch is also still one functional commit; I can split it if a maintainer would prefer that for review. |
Summary
This change keeps mount destination resolution and post-attach verification bound to descriptors across both mount backends.
It:
mount_setattr()returnsENOSYSWhy
Mount destination handling currently relies on attacker-influenced filesystem state in ways that make the confinement boundary and post-attach verification harder to reason about. This patch removes those ambient-path reopen points and makes the destination/mount identity invariants explicit in code and tests.
Validation
make -j4 nsjailmake test_mount_destination_confinementmake test_mount_attach_identitymake test_mount_precapture_identitymake test_legacy_mount_setattr_enosysgit diff --check