Commit b4d8a58f authored by Hsuan-Chi Kuo's avatar Hsuan-Chi Kuo Committed by Kees Cook

seccomp: Fix setting loaded filter count during TSYNC

The desired behavior is to set the caller's filter count to thread's.
This value is reported via /proc, so this fixes the inaccurate count
exposed to userspace; it is not used for reference counting, etc.
Signed-off-by: default avatarHsuan-Chi Kuo <hsuanchikuo@gmail.com>
Link: https://lore.kernel.org/r/20210304233708.420597-1-hsuanchikuo@gmail.comCo-developed-by: default avatarWiktor Garbacz <wiktorg@google.com>
Signed-off-by: default avatarWiktor Garbacz <wiktorg@google.com>
Link: https://lore.kernel.org/lkml/20210810125158.329849-1-wiktorg@google.comSigned-off-by: default avatarKees Cook <keescook@chromium.org>
Cc: stable@vger.kernel.org
Fixes: c818c03b ("seccomp: Report number of loaded filters in /proc/$pid/status")
parent 19d67694
...@@ -602,7 +602,7 @@ static inline void seccomp_sync_threads(unsigned long flags) ...@@ -602,7 +602,7 @@ static inline void seccomp_sync_threads(unsigned long flags)
smp_store_release(&thread->seccomp.filter, smp_store_release(&thread->seccomp.filter,
caller->seccomp.filter); caller->seccomp.filter);
atomic_set(&thread->seccomp.filter_count, atomic_set(&thread->seccomp.filter_count,
atomic_read(&thread->seccomp.filter_count)); atomic_read(&caller->seccomp.filter_count));
/* /*
* Don't let an unprivileged task work around * Don't let an unprivileged task work around
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment