lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090817163126.GA14581@redhat.com>
Date:	Mon, 17 Aug 2009 18:31:26 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Roland McGrath <roland@...hat.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] inline __fatal_signal_pending

On 08/14, Roland McGrath wrote:
>
> __fatal_signal_pending inlines to one instruction on x86, probably two
> instructions on other machines.  It takes two longer x86 instructions
> just to call it and test its return value, not to mention the function
> itself.
>
> On my random x86_64 config, this saved 70 bytes of text (59 of those
> being __fatal_signal_pending itself).

Agreed.


In fact, I think we do not need 2 helpers. I mean, fatal_signal_pending()
does not need the signal_pending() check, we can just rename
__fatal_signal_pending() to fatal_signal_pending(). Should be another
change of course.

Oleg.

> Signed-off-by: Roland McGrath <roland@...hat.com>
> ---
>  include/linux/sched.h |    5 ++++-
>  kernel/signal.c       |    6 ------
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 3ab08e4..fabe715 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -2250,7 +2250,10 @@ static inline int signal_pending(struct task_struct *p)
>  	return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
>  }
>  
> -extern int __fatal_signal_pending(struct task_struct *p);
> +static inline int __fatal_signal_pending(struct task_struct *p)
> +{
> +	return unlikely(sigismember(&p->pending.signal, SIGKILL));
> +}
>  
>  static inline int fatal_signal_pending(struct task_struct *p)
>  {
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 64c5dee..d441e3d 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1036,12 +1036,6 @@ void zap_other_threads(struct task_struct *p)
>  	}
>  }
>  
> -int __fatal_signal_pending(struct task_struct *tsk)
> -{
> -	return sigismember(&tsk->pending.signal, SIGKILL);
> -}
> -EXPORT_SYMBOL(__fatal_signal_pending);
> -
>  struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)
>  {
>  	struct sighand_struct *sighand;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ