Otherwise O_BENEATH allowed to temporary escape the capability sandbox and worked as oracle for checks of existence of directories outside it. This was found by the capsicum-test test checking O_BENEATH behavior in capability mode.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
I would change the commit message to use something like strengthen instead of downgrade since RBENEATH is a stricter version of BENEATH.
sys/kern/vfs_lookup.c | ||
---|---|---|
333 | Does this need to be cleared? Shouldn't RBENEATH have priority if both are set? |
sys/kern/vfs_lookup.c | ||
---|---|---|
333 | Internally they work differently. For BENEATH, there is a concept of 'latch' when path descends below the topping directory. The latch is cleared when we leave the hierarchy. It must not be tracked or checked for RBENEATH, so flags are used in different code paths. As such it is too problematic to keep them both. |
sys/kern/vfs_lookup.c | ||
---|---|---|
312–315 | 'else' is not strictly needed but would be a good change for clarity. |
sys/kern/vfs_lookup.c | ||
---|---|---|
440 | I do not think that this change would add anything. IMO the current structure is even cleaner than going to if else. |
And maybe mention something like "this was found by the capsicum-test test checking O_BENEATH behaviour in capability mode" in the commit message.
sys/sys/namei.h | ||
---|---|---|
213 | Isn't here a typo? |