From: Hsuan-Chi Kuo Date: Thu, 4 Mar 2021 23:37:08 +0000 (-0600) Subject: seccomp: Fix setting loaded filter count during TSYNC X-Git-Tag: accepted/tizen/unified/20230118.172025~6681^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4d8a58f8dcfcc890f296696cadb76e77be44b5f;p=platform%2Fkernel%2Flinux-rpi.git 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: Hsuan-Chi Kuo Link: https://lore.kernel.org/r/20210304233708.420597-1-hsuanchikuo@gmail.com Co-developed-by: Wiktor Garbacz Signed-off-by: Wiktor Garbacz Link: https://lore.kernel.org/lkml/20210810125158.329849-1-wiktorg@google.com Signed-off-by: Kees Cook Cc: stable@vger.kernel.org Fixes: c818c03b661c ("seccomp: Report number of loaded filters in /proc/$pid/status") --- diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 057e17f..6469eca 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -602,7 +602,7 @@ static inline void seccomp_sync_threads(unsigned long flags) smp_store_release(&thread->seccomp.filter, caller->seccomp.filter); 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