From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933287AbeE1SaU (ORCPT ); Mon, 28 May 2018 14:30:20 -0400 Received: from mx1.mailbox.org ([80.241.60.212]:46016 "EHLO mx1.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933078AbeE1SaT (ORCPT ); Mon, 28 May 2018 14:30:19 -0400 Date: Mon, 28 May 2018 20:30:12 +0200 From: Christian Brauner To: Al Viro Cc: linux-kernel@vger.kernel.org, ebiederm@xmission.com, gregkh@linuxfoundation.org, mingo@kernel.org, james.morris@microsoft.com, keescook@chromium.org, peterz@infradead.org, sds@tycho.nsa.gov, akpm@linux-foundation.org, oleg@redhat.com Subject: Re: [PATCH 3/8] signal: make may_ptrace_stop() return bool Message-ID: <20180528183012.GA22333@mailbox.org> References: <20180528134916.7568-1-christian@brauner.io> <20180528134916.7568-4-christian@brauner.io> <20180528141219.GZ30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180528141219.GZ30522@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 28, 2018 at 03:12:19PM +0100, Al Viro wrote: > On Mon, May 28, 2018 at 03:49:11PM +0200, Christian Brauner wrote: > > may_ptrace_stop() already behaves like a boolean function. Let's actually > > declare it as such too. > > > > Signed-off-by: Christian Brauner > > --- > > kernel/signal.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/kernel/signal.c b/kernel/signal.c > > index 81be01d193f4..6c2e7b45cba1 100644 > > --- a/kernel/signal.c > > +++ b/kernel/signal.c > > @@ -1889,10 +1889,10 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, > > spin_unlock_irqrestore(&sighand->siglock, flags); > > } > > > > -static inline int may_ptrace_stop(void) > > +static inline bool may_ptrace_stop(void) > > { > > if (!likely(current->ptrace)) > > - return 0; > > + return false; > > /* > > * Are we in the middle of do_coredump? > > * If so and our tracer is also part of the coredump stopping > > @@ -1908,9 +1908,9 @@ static inline int may_ptrace_stop(void) > > */ > > if (unlikely(current->mm->core_state) && > > unlikely(current->mm == current->parent->mm)) > > - return 0; > > + return false; > > > > - return 1; > > + return true; > > return !current->mm->core_state || current->mm != current->parent->mm; > > or, if it gives any measurably better code generation, > > return likely(!current->mm->core_state || > current->mm != current->parent->mm); Makes sense. I put this in v1. Thanks! Christian