linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] seccomp: remove unnecessary unlikely()
@ 2018-09-05 20:34 Igor Stoppa
  2018-09-05 22:23 ` Kees Cook
  2018-09-06 20:31 ` James Morris
  0 siblings, 2 replies; 7+ messages in thread
From: Igor Stoppa @ 2018-09-05 20:34 UTC (permalink / raw)
  To: Kees Cook; +Cc: igor.stoppa, Igor Stoppa, linux-security-module, linux-kernel

WARN_ON() already contains an unlikely(), so it's not necessary to wrap it
into another.

Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: linux-security-module@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 kernel/seccomp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index fd023ac24e10..5a2a9af4663e 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -195,7 +195,7 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd,
 			READ_ONCE(current->seccomp.filter);
 
 	/* Ensure unexpected behavior doesn't result in failing open. */
-	if (unlikely(WARN_ON(f == NULL)))
+	if (WARN_ON(f == NULL))
 		return SECCOMP_RET_KILL_PROCESS;
 
 	if (!sd) {
@@ -297,7 +297,7 @@ static inline pid_t seccomp_can_sync_threads(void)
 		/* Return the first thread that cannot be synchronized. */
 		failed = task_pid_vnr(thread);
 		/* If the pid cannot be resolved, then return -ESRCH */
-		if (unlikely(WARN_ON(failed == 0)))
+		if (WARN_ON(failed == 0))
 			failed = -ESRCH;
 		return failed;
 	}
-- 
2.17.1


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

* Re: [PATCH] seccomp: remove unnecessary unlikely()
  2018-09-05 20:34 [PATCH] seccomp: remove unnecessary unlikely() Igor Stoppa
@ 2018-09-05 22:23 ` Kees Cook
  2018-09-05 22:49   ` Igor Stoppa
  2018-09-06 20:31 ` James Morris
  1 sibling, 1 reply; 7+ messages in thread
From: Kees Cook @ 2018-09-05 22:23 UTC (permalink / raw)
  To: Igor Stoppa; +Cc: Igor Stoppa, linux-security-module, LKML

On Wed, Sep 5, 2018 at 1:34 PM, Igor Stoppa <igor.stoppa@gmail.com> wrote:
> WARN_ON() already contains an unlikely(), so it's not necessary to wrap it
> into another.
>
> Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
> Acked-by: Kees Cook <keescook@chromium.org>

Should I take this, or is it part of your series going somewhere else?

-Kees

> Cc: linux-security-module@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  kernel/seccomp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index fd023ac24e10..5a2a9af4663e 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -195,7 +195,7 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd,
>                         READ_ONCE(current->seccomp.filter);
>
>         /* Ensure unexpected behavior doesn't result in failing open. */
> -       if (unlikely(WARN_ON(f == NULL)))
> +       if (WARN_ON(f == NULL))
>                 return SECCOMP_RET_KILL_PROCESS;
>
>         if (!sd) {
> @@ -297,7 +297,7 @@ static inline pid_t seccomp_can_sync_threads(void)
>                 /* Return the first thread that cannot be synchronized. */
>                 failed = task_pid_vnr(thread);
>                 /* If the pid cannot be resolved, then return -ESRCH */
> -               if (unlikely(WARN_ON(failed == 0)))
> +               if (WARN_ON(failed == 0))
>                         failed = -ESRCH;
>                 return failed;
>         }
> --
> 2.17.1
>



-- 
Kees Cook
Pixel Security

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

* Re: [PATCH] seccomp: remove unnecessary unlikely()
  2018-09-05 22:23 ` Kees Cook
@ 2018-09-05 22:49   ` Igor Stoppa
  2018-09-05 23:31     ` Kees Cook
  0 siblings, 1 reply; 7+ messages in thread
From: Igor Stoppa @ 2018-09-05 22:49 UTC (permalink / raw)
  To: Kees Cook; +Cc: Igor Stoppa, linux-security-module, LKML



On 06/09/18 01:23, Kees Cook wrote:

> Should I take this, or is it part of your series going somewhere else?

It turned out it doesn't really work to have a generic series against 20 
trees :-/

I'm submitting them individually to each subsystem.
So this one is just for security.

--
thanks, igor

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

* Re: [PATCH] seccomp: remove unnecessary unlikely()
  2018-09-05 22:49   ` Igor Stoppa
@ 2018-09-05 23:31     ` Kees Cook
  2018-09-06  0:08       ` James Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Kees Cook @ 2018-09-05 23:31 UTC (permalink / raw)
  To: Igor Stoppa; +Cc: Igor Stoppa, linux-security-module, LKML

On Wed, Sep 5, 2018 at 3:49 PM, Igor Stoppa <igor.stoppa@gmail.com> wrote:
>
>
> On 06/09/18 01:23, Kees Cook wrote:
>
>> Should I take this, or is it part of your series going somewhere else?
>
>
> It turned out it doesn't really work to have a generic series against 20
> trees :-/

I know that pain very well!

> I'm submitting them individually to each subsystem.
> So this one is just for security.

Sounds good.

James, can you take this directly, or would you prefer a pull request from me?

-Kees

-- 
Kees Cook
Pixel Security

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

* Re: [PATCH] seccomp: remove unnecessary unlikely()
  2018-09-05 23:31     ` Kees Cook
@ 2018-09-06  0:08       ` James Morris
  2018-09-06  0:13         ` Kees Cook
  0 siblings, 1 reply; 7+ messages in thread
From: James Morris @ 2018-09-06  0:08 UTC (permalink / raw)
  To: Kees Cook; +Cc: Igor Stoppa, Igor Stoppa, linux-security-module, LKML

On Wed, 5 Sep 2018, Kees Cook wrote:

> On Wed, Sep 5, 2018 at 3:49 PM, Igor Stoppa <igor.stoppa@gmail.com> wrote:
> >
> >
> > On 06/09/18 01:23, Kees Cook wrote:
> >
> >> Should I take this, or is it part of your series going somewhere else?
> >
> >
> > It turned out it doesn't really work to have a generic series against 20
> > trees :-/
> 
> I know that pain very well!
> 
> > I'm submitting them individually to each subsystem.
> > So this one is just for security.
> 
> Sounds good.
> 
> James, can you take this directly, or would you prefer a pull request from me?

I'll take it with your ack.

-- 
James Morris
<jmorris@namei.org>


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

* Re: [PATCH] seccomp: remove unnecessary unlikely()
  2018-09-06  0:08       ` James Morris
@ 2018-09-06  0:13         ` Kees Cook
  0 siblings, 0 replies; 7+ messages in thread
From: Kees Cook @ 2018-09-06  0:13 UTC (permalink / raw)
  To: James Morris; +Cc: Igor Stoppa, Igor Stoppa, linux-security-module, LKML

On Wed, Sep 5, 2018 at 5:08 PM, James Morris <jmorris@namei.org> wrote:
> On Wed, 5 Sep 2018, Kees Cook wrote:
>
>> On Wed, Sep 5, 2018 at 3:49 PM, Igor Stoppa <igor.stoppa@gmail.com> wrote:
>> >
>> >
>> > On 06/09/18 01:23, Kees Cook wrote:
>> >
>> >> Should I take this, or is it part of your series going somewhere else?
>> >
>> >
>> > It turned out it doesn't really work to have a generic series against 20
>> > trees :-/
>>
>> I know that pain very well!
>>
>> > I'm submitting them individually to each subsystem.
>> > So this one is just for security.
>>
>> Sounds good.
>>
>> James, can you take this directly, or would you prefer a pull request from me?
>
> I'll take it with your ack.

Already included! :) (This was a v2, split from a separate series, so
Igor already included my Ack from the other thread.)

But, for completeness:

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

-- 
Kees Cook
Pixel Security

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

* Re: [PATCH] seccomp: remove unnecessary unlikely()
  2018-09-05 20:34 [PATCH] seccomp: remove unnecessary unlikely() Igor Stoppa
  2018-09-05 22:23 ` Kees Cook
@ 2018-09-06 20:31 ` James Morris
  1 sibling, 0 replies; 7+ messages in thread
From: James Morris @ 2018-09-06 20:31 UTC (permalink / raw)
  To: Igor Stoppa; +Cc: Kees Cook, Igor Stoppa, linux-security-module, linux-kernel

On Wed, 5 Sep 2018, Igor Stoppa wrote:

> WARN_ON() already contains an unlikely(), so it's not necessary to wrap it
> into another.
> 
> Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
> Acked-by: Kees Cook <keescook@chromium.org>
> Cc: linux-security-module@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general

and next-testing.


Thanks!

-- 
James Morris
<jmorris@namei.org>


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

end of thread, other threads:[~2018-09-06 20:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05 20:34 [PATCH] seccomp: remove unnecessary unlikely() Igor Stoppa
2018-09-05 22:23 ` Kees Cook
2018-09-05 22:49   ` Igor Stoppa
2018-09-05 23:31     ` Kees Cook
2018-09-06  0:08       ` James Morris
2018-09-06  0:13         ` Kees Cook
2018-09-06 20:31 ` James Morris

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).