linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] seccomp: Fix setting number of loaded filters
@ 2021-08-10 12:51 Wiktor Garbacz
  2021-08-11 18:46 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Wiktor Garbacz @ 2021-08-10 12:51 UTC (permalink / raw)
  To: Kees Cook, Andy Lutomirski, Will Drewry; +Cc: linux-kernel, Wiktor Garbacz

The value is only reported through procfs so this
is purely cosmetic.

Signed-off-by: Wiktor Garbacz <wiktorg@google.com>
---
 kernel/seccomp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index 057e17f3215d..6469eca8078c 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
-- 
2.32.0.605.g8dce9f2422-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] seccomp: Fix setting number of loaded filters
  2021-08-10 12:51 [PATCH] seccomp: Fix setting number of loaded filters Wiktor Garbacz
@ 2021-08-11 18:46 ` Kees Cook
  2021-08-11 18:48   ` Hsuan-Chi Kuo
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2021-08-11 18:46 UTC (permalink / raw)
  To: Wiktor Garbacz; +Cc: Andy Lutomirski, Will Drewry, linux-kernel, Hsuan-Chi Kuo

On Tue, Aug 10, 2021 at 02:51:58PM +0200, Wiktor Garbacz wrote:
> The value is only reported through procfs so this
> is purely cosmetic.

Hi,

Thanks for the patch! I thought this had already been fixed, but I see I
dropped the ball. :( Sorry!

I'll get the original fix landed[1], and add you as a reporter.

Out of curiosity, how did you (or Hsuan-Chi Kuo) find this? Broken
behavior, code reading, static analysis?

Thanks!

-Kees

[1] https://lore.kernel.org/lkml/20210304233708.420597-1-hsuanchikuo@gmail.com/

> 
> Signed-off-by: Wiktor Garbacz <wiktorg@google.com>
> ---
>  kernel/seccomp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 057e17f3215d..6469eca8078c 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
> -- 
> 2.32.0.605.g8dce9f2422-goog
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] seccomp: Fix setting number of loaded filters
  2021-08-11 18:46 ` Kees Cook
@ 2021-08-11 18:48   ` Hsuan-Chi Kuo
  0 siblings, 0 replies; 3+ messages in thread
From: Hsuan-Chi Kuo @ 2021-08-11 18:48 UTC (permalink / raw)
  To: Kees Cook, Wiktor Garbacz; +Cc: Andy Lutomirski, Will Drewry, linux-kernel

Thanks.

I was just trying to understand how seccomp works by code reading and 
spotted this bug.


On 8/11/21 1:46 PM, Kees Cook wrote:
> On Tue, Aug 10, 2021 at 02:51:58PM +0200, Wiktor Garbacz wrote:
>> The value is only reported through procfs so this
>> is purely cosmetic.
> Hi,
>
> Thanks for the patch! I thought this had already been fixed, but I see I
> dropped the ball. :( Sorry!
>
> I'll get the original fix landed[1], and add you as a reporter.
>
> Out of curiosity, how did you (or Hsuan-Chi Kuo) find this? Broken
> behavior, code reading, static analysis?
>
> Thanks!
>
> -Kees
>
> [1] https://lore.kernel.org/lkml/20210304233708.420597-1-hsuanchikuo@gmail.com/
>
>> Signed-off-by: Wiktor Garbacz <wiktorg@google.com>
>> ---
>>   kernel/seccomp.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
>> index 057e17f3215d..6469eca8078c 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
>> -- 
>> 2.32.0.605.g8dce9f2422-goog
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-11 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 12:51 [PATCH] seccomp: Fix setting number of loaded filters Wiktor Garbacz
2021-08-11 18:46 ` Kees Cook
2021-08-11 18:48   ` Hsuan-Chi Kuo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).