diff options
author | Jann Horn <jannh@google.com> | 2020-10-05 03:44:01 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2020-10-08 13:17:47 -0700 |
commit | dfe719fef03d752f1682fa8aeddf30ba501c8555 (patch) | |
tree | 7695a6683c814dbfd5174b10d55f51e071825bad /arch/riscv | |
parent | 282a181b1a0d66de1f0894d82f395fcd478f51d1 (diff) |
seccomp: Make duplicate listener detection non-racy
Currently, init_listener() tries to prevent adding a filter with
SECCOMP_FILTER_FLAG_NEW_LISTENER if one of the existing filters already
has a listener. However, this check happens without holding any lock that
would prevent another thread from concurrently installing a new filter
(potentially with a listener) on top of the ones we already have.
Theoretically, this is also a data race: The plain load from
current->seccomp.filter can race with concurrent writes to the same
location.
Fix it by moving the check into the region that holds the siglock to guard
against concurrent TSYNC.
(The "Fixes" tag points to the commit that introduced the theoretical
data race; concurrent installation of another filter with TSYNC only
became possible later, in commit 51891498f2da ("seccomp: allow TSYNC and
USER_NOTIF together").)
Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
Reviewed-by: Tycho Andersen <tycho@tycho.pizza>
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201005014401.490175-1-jannh@google.com
Diffstat (limited to 'arch/riscv')
0 files changed, 0 insertions, 0 deletions