signal: move the "sig < SIGRTMIN" check into siginmask(sig)
authorOleg Nesterov <oleg@redhat.com>
Mon, 23 May 2016 23:24:02 +0000 (16:24 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 26 Nov 2017 13:51:01 +0000 (13:51 +0000)
commitb88cd8f4f1dd0b64e12eb0a944270380f88a4755
treea11a448c2afb5378b4b399d01dcf5cde50f95449
parenta7f3619d51e620c157dad6361ce74143adb1903f
signal: move the "sig < SIGRTMIN" check into siginmask(sig)

commit 5c8ccefdf46c5f87d87b694c7fbc04941c2c99a5 upstream.

All the users of siginmask() must ensure that sig < SIGRTMIN.  sig_fatal()
doesn't and this is wrong:

UBSAN: Undefined behaviour in kernel/signal.c:911:6
shift exponent 32 is too large for 32-bit type 'long unsigned int'

the patch doesn't add the neccesary check to sig_fatal(), it moves the
check into siginmask() and updates other callers.

Link: http://lkml.kernel.org/r/20160517195052.GA15187@redhat.com
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
include/linux/signal.h