Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux: simplify setns with pidfd #1265

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Aug 8, 2023

This caused an issue when the PID 1 didn't execve yet the container process, and joining the user namespace first would cause the user to look access to the container PID 1 namespaces.

When running with enough permissions, setns() will allow to join all the namespaces in one shoot, so let's use it.

On any error, attempt the fallback mechanism to join each namespace separately.

Closes: #1264

@giuseppe
Copy link
Member Author

giuseppe commented Aug 8, 2023

test failure is related

This caused an issue when the PID 1 didn't execve yet the container
process, and joining the user namespace first would cause the user to
look access to the container PID 1 namespaces.

When running with enough permissions, setns() will allow to join all
the namespaces in one shoot, so let's use it.

On any error, attempt the fallback mechanism to join each namespace
separately.

Closes: containers#1264

Signed-off-by: Giuseppe Scrivano <[email protected]>
@rhatdan
Copy link
Member

rhatdan commented Aug 8, 2023

LGTM

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@flouthoc flouthoc merged commit 203c5e1 into containers:main Aug 8, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

exec: crun: setns(pid=87793, CLONE_SOMETHING): Operation not permitted: OCI permission denied
3 participants