Repository navigation
config-linux: add linux.ioUring #1328
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
Open
gvozdetsky
wants to merge
3
commits into
opencontainers:main
Choose a base branch
from
gvozdetsky:io-uring-restrictions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "ociVersion": "1.0.0", | ||
| "root": { | ||
| "path": "rootfs" | ||
| }, | ||
| "linux": { | ||
| "ioUring": { | ||
| "ops": [ | ||
| "IORING_OP_SOCKET" | ||
| ], | ||
| "socketFamilies": [] | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "ociVersion": "1.0.0", | ||
| "root": { | ||
| "path": "rootfs" | ||
| }, | ||
| "linux": { | ||
| "ioUring": { | ||
| "ops": [ | ||
| "read" | ||
| ] | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "ociVersion": "1.0.0", | ||
| "root": { | ||
| "path": "rootfs" | ||
| }, | ||
| "linux": { | ||
| "ioUring": { | ||
| "socketFamilies": [ | ||
| "AF_INET" | ||
| ] | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "ociVersion": "1.0.0", | ||
| "root": { | ||
| "path": "rootfs" | ||
| }, | ||
| "linux": { | ||
| "ioUring": { | ||
| "ops": [ | ||
| "IORING_OP_READ", | ||
| "IORING_OP_WRITE", | ||
| "IORING_OP_SOCKET" | ||
| ], | ||
| "socketFamilies": [ | ||
| "AF_UNIX", | ||
| "AF_INET6" | ||
| ] | ||
| } | ||
| } | ||
| } |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the kernel bug mentioned in the description (restrictions lost on exec on 7.0/7.1 without bc0e8faf90e7, fixed in v7.2-rc6, Cc stable 7.1+): per the commit, if a task has used io_uring, the exec cancellation path frees its per-task restrictions, so a ring created after exec is unrestricted. The container init itself probably never creates a ring before exec, but any process inside the container that uses io_uring and then execs gets an unrestricted image, i.e. a trivial bypass of the policy.
On such a kernel, registering the filters succeeds, so with the current wording the runtime "applies" the restrictions and doesn't error out, yet the requirement that they apply "to the container process and all of its descendants" is silently violated. Leaving the detection to runtimes means in practice nobody does it (neither the crun nor the youki implementation checks for it, as far as I can see).
Maybe the spec should say explicitly that if the runtime cannot ensure the restrictions are preserved across exec, it MUST (or at least SHOULD) generate an error, so runtimes have to do a functional check (or a kernel version check) instead of only probing for
IORING_REGISTER_BPF_FILTER.This comment was written by an AI (Claude Code).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, added: "If the runtime cannot ensure that a process keeps the restrictions when it calls execve(2) after using io_uring, it MUST generate an error", with 7.0/7.1 without bc0e8faf90e7 as the example. crun and youki now check it on a child that restricts itself, creates a ring and re-executes the runtime. They refuse the policy on mainline 7.0, and accept it on 7.2.9 and on Ubuntu's 7.0.0-42, which has the backport.