Re: [PATCH] seccomp: restore knotif->state when SECCOMP_ADDFD_FLAG_SEND is interrupted
From: Kees Cook
Date: Sat Sep 19 2026 - 23:51:03 EST
On Sat, Sep 19, 2026 at 08:35:14PM +0000, Hui Peng wrote:
> In seccomp_notify_addfd(), when SECCOMP_ADDFD_FLAG_SEND is set,
> knotif->state is transitioned from SECCOMP_NOTIFY_SENT to
> SECCOMP_NOTIFY_REPLIED before dropping filter->notify_lock and waiting
> in wait_for_completion_interruptible(&kaddfd.completion).
>
> If wait_for_completion_interruptible() is interrupted by a signal before
> the target task processes the kaddfd entry, seccomp_notify_addfd()
> removes kaddfd.list from knotif->addfd via list_del(&kaddfd.list), but
> leaves knotif->state set to SECCOMP_NOTIFY_REPLIED.
Are you able to construct a regression test for this so we can catch
this race if it ever gets exposed again?
--
Kees Cook