[PATCH v2 0/2] seccomp: Fix a race with WAIT_KILLABLE_RECV if the tracer replies too fast

Johannes Nixdorf posted 2 patches 2 months, 1 week ago
kernel/seccomp.c                              |  13 ++-
tools/testing/selftests/seccomp/seccomp_bpf.c | 130 ++++++++++++++++++++++++++
2 files changed, 136 insertions(+), 7 deletions(-)
[PATCH v2 0/2] seccomp: Fix a race with WAIT_KILLABLE_RECV if the tracer replies too fast
Posted by Johannes Nixdorf 2 months, 1 week ago
If WAIT_KILLABLE_RECV was specified, and an event is received, the
tracee's syscall is not supposed to be interruptible. This was not properly
ensured if the reply was sent too fast, and an interrupting signal was
received before the reply was processed on the tracee side.

This series fixes the bug and adds a test case for it to the selftests.

Signed-off-by: Johannes Nixdorf <johannes@nixdorf.dev>
---
Changes in v2:
- Added a selftest for the bug.
- Link to v1: https://lore.kernel.org/r/20250723-seccomp-races-v1-1-bef5667ce30a@nixdorf.dev

---
Johannes Nixdorf (2):
      seccomp: Fix a race with WAIT_KILLABLE_RECV if the tracer replies too fast
      selftests/seccomp: Add a test for the WAIT_KILLABLE_RECV fast reply race

 kernel/seccomp.c                              |  13 ++-
 tools/testing/selftests/seccomp/seccomp_bpf.c | 130 ++++++++++++++++++++++++++
 2 files changed, 136 insertions(+), 7 deletions(-)
---
base-commit: 89be9a83ccf1f88522317ce02f854f30d6115c41
change-id: 20250721-seccomp-races-e97897d6d94b

Best regards,
-- 
Johannes Nixdorf <johannes@nixdorf.dev>
Re: [PATCH v2 0/2] seccomp: Fix a race with WAIT_KILLABLE_RECV if the tracer replies too fast
Posted by Kees Cook 2 months, 1 week ago
On Fri, 25 Jul 2025 18:31:17 +0200, Johannes Nixdorf wrote:
> If WAIT_KILLABLE_RECV was specified, and an event is received, the
> tracee's syscall is not supposed to be interruptible. This was not properly
> ensured if the reply was sent too fast, and an interrupting signal was
> received before the reply was processed on the tracee side.
> 
> This series fixes the bug and adds a test case for it to the selftests.
> 
> [...]

With minor edits, applied to for-next/seccomp, thanks!

[1/2] seccomp: Fix a race with WAIT_KILLABLE_RECV if the tracer replies too fast
      https://git.kernel.org/kees/c/cce436aafc2a
[2/2] selftests/seccomp: Add a test for the WAIT_KILLABLE_RECV fast reply race
      https://git.kernel.org/kees/c/b0c9bfbab925

Take care,

-- 
Kees Cook