Skip to content

libct/configs/validate: reject seccomp errnoRet for unsupported actions - #5564

Open
kolyshkin wants to merge 1 commit into
opencontainers:mainfrom
kolyshkin:seccomp-errnoret
Open

kolyshkin wants to merge 1 commit into
opencontainers:mainfrom
kolyshkin:seccomp-errnoret

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

The runtime spec says about both defaultErrnoRet and errnoRet:

When the action doesn't support an errno, the runtime MUST print and error and fail.

Yet runc silently ignores errnoRet set for any action other than SCMP_ACT_ERRNO and SCMP_ACT_TRACE.

Add a check to the config validator, so the error is reported early (before the container init is started) and clearly (including the syscall name in case of errnoRet), e.g.:

runc run failed: seccomp: syscall "mkdir": errnoRet is only supported for SCMP_ACT_ERRNO and SCMP_ACT_TRACE actions

Since the validator checks all syscall rules, this also covers ones which are later skipped as redundant (i.e. having the same action as the default).

Note this is a (spec-mandated) behavior change: configs which were silently accepted before will now be rejected. A CHANGELOG entry is added.

Add unit and integration tests (the latter fails without the fix).

Fixes #5550. This is an alternative to #5559.

@kolyshkin kolyshkin changed the title libct/seccomp: reject errnoRet for unsupported actions libct/configs/validate: reject seccomp errnoRet for unsupported actions Oct 19, 2026
Comment on lines +532 to +534
supportsErrno := func(a configs.Action) bool {
return a == configs.Errno || a == configs.Trace
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Feels like it doesn't need to be a nested function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is mostly for readability. Go compiler inlines it anyway.

@cyphar

cyphar commented Oct 20, 2026

Copy link
Copy Markdown
Member

And yeah I much prefer this to #5559.

kolyshkin

This comment was marked as outdated.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

This needs a second LGTM @AkihiroSuda @thaJeztah

The runtime spec says about both defaultErrnoRet and errnoRet:

> When the action doesn't support an errno, the runtime MUST print and
> error and fail.

Yet runc silently ignores errnoRet set for any action other than
SCMP_ACT_ERRNO and SCMP_ACT_TRACE.

Add a check to the config validator, so the error is reported early
(before the container init is started) and clearly (including the
syscall name in case of errnoRet).

Since the validator checks all syscall rules, this also covers ones
which are later skipped as redundant (i.e. having the same action as
the default).

Add unit and integration tests, and a CHANGELOG entry.

Reported in issue 5550.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
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.

runc accepts errno values for SCMP_ACT_ALLOW

2 participants