BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jamie Hill-Daniel" <clubby789@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH RESEND 2/2] selftest: seccomp: Adjust test for using both `STRICT` and `FILTER`
Date: Tue, 26 May 2026 16:44:48 +0000	[thread overview]
Message-ID: <20260526164448.853601F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260526-seccomp-combined-v1-2-304b1cc3ad24@hill-daniel.co.uk>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Medium] The updated selftests crash with SIGKILL due to unhandled strict seccomp constraints.

Pre-existing issues:
- [Critical] The internal kernel mode `SECCOMP_MODE_COMBINED` is leaked to userspace via `prctl` and `/proc/pid/status`, causing ABI breakage.
--

commit fb241f2f33856c48dd4d8cab04014fc026770de7
Author: Jamie Hill-Daniel <clubby789@gmail.com>

selftest: seccomp: Adjust test for using both STRICT and FILTER

This patch updates the seccomp selftests to expect a successful transition
to STRICT mode after FILTER mode is already applied, renaming the test
to mode_filter_combined.

> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
[ ... ]
> -TEST(mode_filter_cannot_move_to_strict)
> +TEST(mode_filter_combined)
>  {
>  	struct sock_filter filter[] = {
>  		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW),
> @@ -534,8 +534,7 @@ TEST(mode_filter_cannot_move_to_strict)
>  	ASSERT_EQ(0, ret);
>  
>  	ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT, NULL, 0, 0);
> -	EXPECT_EQ(-1, ret);
> -	EXPECT_EQ(EINVAL, errno);
> +	ASSERT_EQ(0, ret);

[Severity: Medium]
When this test finishes, the kselftest framework attempts to exit the process
by calling glibc's _exit(), which invokes the exit_group syscall.

Since strict seccomp mode only permits read, write, _exit (__NR_exit),
and sigreturn, won't the forbidden exit_group syscall cause the test process
to be immediately killed with SIGKILL?

It appears the test must manually exit via syscall(__NR_exit, 0) to avoid
falsely reporting a failure, similar to how TEST(mode_strict_support)
handles it.

Additionally, does this patch also need to update
TEST(seccomp_syscall_mode_lock)?

With the new kernel behavior, that test's transition to strict mode will now
succeed, causing it to execute the seccomp() syscall while in strict mode,
which will result in another immediate SIGKILL.

[Severity: Critical]
This is a pre-existing issue, but the underlying kernel patch appears to leak
the internal SECCOMP_MODE_COMBINED (4) state to userspace.

When a process successfully transitions to strict mode after a filter is
installed, its internal state becomes 4.

If this value is directly exposed to userspace via prctl(PR_GET_SECCOMP)
and the /proc/pid/status file's Seccomp: field, could this break ABI
contracts?

The UAPI headers only define SECCOMP_MODE_DISABLED (0), 
SECCOMP_MODE_STRICT (1), and SECCOMP_MODE_FILTER (2). 

Exposing an undocumented internal mode to userspace might cause sandbox
monitoring tools, init systems, or security daemons that expect standard
UAPI values to malfunction or crash.

>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260526-seccomp-combined-v1-0-304b1cc3ad24@hill-daniel.co.uk?part=2

  reply	other threads:[~2026-05-26 16:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 15:32 [PATCH RESEND 0/2] seccomp: Allow using `SECCOMP_MODE_STRICT` with `SECCOMP_MODE_FILTER` Jamie Hill-Daniel
2026-05-26 15:32 ` [PATCH RESEND 1/2] " Jamie Hill-Daniel
2026-05-26 16:23   ` sashiko-bot
2026-06-12 19:25   ` Will Drewry
2026-06-12 21:24     ` Andy Lutomirski
2026-06-12 22:01       ` clubby789
2026-06-12 22:37         ` Andy Lutomirski
2026-06-12 22:58           ` clubby789
2026-06-12 22:37     ` clubby789
2026-06-12 22:50       ` Andy Lutomirski
2026-05-26 15:32 ` [PATCH RESEND 2/2] selftest: seccomp: Adjust test for using both `STRICT` and `FILTER` Jamie Hill-Daniel
2026-05-26 16:44   ` sashiko-bot [this message]
2026-06-13  4:14 ` [PATCH RESEND 0/2] seccomp: Allow using `SECCOMP_MODE_STRICT` with `SECCOMP_MODE_FILTER` Kees Cook
2026-06-15 16:23   ` Jamie Hill-Daniel
2026-06-15 22:38     ` Kees Cook
2026-06-15 23:16       ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260526164448.853601F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clubby789@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox