Repository navigation
fix(libcontainer): reject seccomp errnoRet for actions without an errno - #3922
Merged
nayuta723 merged 2 commits intoNov 24, 2026
Merged
Conversation
Signed-off-by: mateuscmtropical <mateuscmtropical@gmail.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the seccomp errno validation changes.
No open issues 🎉
What changed in this PR
This PR addresses #3817 by validating seccomp errno fields before container creation, rejecting values on actions other than SCMP_ACT_ERRNO and SCMP_ACT_TRACE.
Changes:
- Validate both default and per-syscall errno fields, including redundant rules that filter initialization later skips.
- Add validation errors that identify the invalid field and affected syscall names.
- Add unit tests for accepted and rejected action combinations and rules without errno values.
| File | Description |
|---|---|
crates/libcontainer/src/validator.rs |
Adds seccomp errno validation to spec checks and unit tests. |
crates/libcontainer/src/error.rs |
Adds errors for invalid default and per-syscall errno fields. |
Review effort: Balanced
nayuta723
reviewed
Nov 24, 2026
nayuta723
left a comment
Contributor
There was a problem hiding this comment.
Thanks for your contribution!
I left a minor comment. Please take a look.
| IO(#[from] std::io::Error), | ||
| #[error("rootless container requires valid user namespace definition")] | ||
| NoUserNamespace, | ||
| #[error( |
Contributor
There was a problem hiding this comment.
Could we combine these into a single error variant since they represent similar errors?
Contributor
Author
There was a problem hiding this comment.
Done in 732ec6e. Both checks now return SeccompErrnoRet, and the message names the field, like defaultErrnoRet or errnoRet of syscall "mkdir".
Signed-off-by: mateuscmtropical <mateuscmtropical@gmail.com>
3 tasks done
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
The runtime spec says
defaultErrnoRetanderrnoRetare only for actions that support an errno, and the runtime must fail otherwise. youki ignored the value for any other action.The spec validator now rejects
defaultErrnoRetanderrnoRetunless the action isSCMP_ACT_ERRNOorSCMP_ACT_TRACE, the same check as runc's opencontainers/runc#5564. It runs before the container is created, and the error names the syscall:Every rule is checked, including one that
initialize_seccomplater skips because it has the default action (the redundant ALLOW rule from the issue).Type of Change
Testing
test_validate_spec_for_seccomp_errno_retcovers ERRNO and TRACE (accepted), ALLOW, KILL, TRAP and LOG (rejected) for both the default action and a rule, plus a rule with the default action.cargo test -p libcontainer --lib validator: all pass excepttest_userns_spec_validation, which fails the same way on main in my container (it runs as root).cargo +nightly fmt --checkandcargo clippy -p libcontainer --all-targets -- -D warningsare clean.Related Issues
Fixes #3817
Additional Context
Configs that set an errno on an action without one were accepted before and are now rejected, as the spec requires.