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: <878rvsyrd5.fsf@email.froward.int.ebiederm.org>
Date:   Fri, 07 Jan 2022 00:47:18 -0600
From:   "Eric W. Biederman" <ebiederm@...ssion.com>
To:     Hongchen Zhang <zhanghongchen@...ngson.cn>
Cc:     Marco Elver <elver@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Al Viro <viro@...iv.linux.org.uk>,
        Ye Guojin <ye.guojin@....com.cn>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] signal: strict valid signal check

Hongchen Zhang <zhanghongchen@...ngson.cn> writes:

> The max usable signal number is limited by both _NSIG and task's
> exit_code, and the max valid signal number encoded in task's
> exit_code is 127. On the other hand _NSIG is normally power of 2,
> so limit the rule in valid_signal to check a valid signal number.

A quick look reveals this only affects mips.

If you have copied that silliness from mips for your new architecture
I would advise against it.  That just seems to make sigset_t twice
as big as it needs to be for no good reason.

What seems reasonable is to fix mips to only support 127 signals (with
the same sigset_t size) and to add "BUILD_BUG_ON(_NSIG <= 127);" along
with your comment somewhere in kernel/signal.c

Eric


> Signed-off-by: Hongchen Zhang <zhanghongchen@...ngson.cn>
> ---
>  include/linux/signal.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/signal.h b/include/linux/signal.h
> index a6db6f2..9f1972e 100644
> --- a/include/linux/signal.h
> +++ b/include/linux/signal.h
> @@ -270,7 +270,11 @@ static inline void init_sigpending(struct sigpending *sig)
>  /* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */
>  static inline int valid_signal(unsigned long sig)
>  {
> -	return sig <= _NSIG ? 1 : 0;
> +	/* max usable signal number is limited by both _NSIG and task's
> +	 * exit_code, and the max available signal number encoded in
> +	 * task's exit_code is 127.
> +	 */
> +	return sig <= min(_NSIG, 127) ? 1 : 0;
>  }
>  
>  struct timespec;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ