Skip to content

Use O_PATH when opening parent directories - #807

Open
smcv wants to merge 2 commits into
containers:mainfrom
smcv:issue806
Open

smcv wants to merge 2 commits into
containers:mainfrom
smcv:issue806

Conversation

@smcv

@smcv smcv commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

cc @ao2

Otherwise we need read permission on every path component from the root
to the mount point. This isn't available if we are mounting onto the
`$TMPDIR` created by `pam_tmpdir` or `pam_mktemp`, which create a
root-owned directory with `a+x` but not `a+r` permission, and then a
per-uid directory inside that.

Fixes: c77dd38 "setup: Use O_PATH fds and disalllow symlink targest"
Resolves: containers#806
Resolves: ValveSoftware/steam-runtime#855
Signed-off-by: Simon McVittie <smcv@collabora.com>
In this case it has no functional effect, because we close these fds
with `cleanup_fd` before exec'ing anything (either within this function
or in its only caller), but it's good to get into a habit of making
all fds be close-on-exec except for the few that we specifically want
to allow child processes to inherit.

Signed-off-by: Simon McVittie <smcv@collabora.com>
@ao2

ao2 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

The changes look good to me, I cannot approve formally because I am not a reviewer of this PR.

@smcv

smcv commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

I'll merge this based on my colleague @ao2's review if there's no response from other maintainers for a while.

(I suspect that in practice this mainly affects the Steam Runtime, in which we use a local build of bubblewrap and have cherry-picked these changes.)

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

Labels

None yet

Projects

None yet

2 participants