glibc/sysdeps
Adhemerval Zanella d2dc5467c6 Filter out NPTL internal signals (BZ #22391)
This patch filters out the internal NPTL signals (SIGCANCEL/SIGTIMER and
SIGSETXID) from signal functions.  GLIBC on Linux requires both signals to
proper implement pthread cancellation, posix timers, and set*id posix
thread synchronization.

And not filtering out the internal signal is troublesome:

  - A conformant program on a architecture that does not filter out the
    signals might inadvertently disable pthread asynchronous cancellation,
    set*id synchronization or posix timers.

  - It might also to security issues if SIGSETXID is masked and set*id
    functions are called (some threads might have effective user or group
    id different from the rest).

The changes are basically:

  - Change __is_internal_signal to bool and used on all signal function
    that has a signal number as input.  Also for signal function which accepts
    signals sets (sigset_t) it assumes that canonical function were used to
    add/remove signals which lead to some input simplification.

  - Fix tst-sigset.c to avoid check for SIGCANCEL/SIGTIMER and SIGSETXID.
    It is rewritten to check each signal indidually and to check realtime
    signals using canonical macros.

  - Add generic __clear_internal_signals and __is_internal_signal
    version since both symbols are used on generic implementations.

  - Remove superflous sysdeps/nptl/sigfillset.c.

  - Remove superflous SIGTIMER handling on Linux __is_internal_signal
    since it is the same of SIGCANCEL.

  - Remove dangling define and obvious comment on nptl/sigaction.c.

Checked on x86_64-linux-gnu.

	[BZ #22391]
	* nptl/sigaction.c (__sigaction): Use __is_internal_signal to
	check for internal nptl signals.
	* nptl/sigaction.c (__sigaction): Likewise.
	* signal/sigaddset.c (sigaddset): Likewise.
	* signal/sigdelset.c (sigdelset): Likewise.
	* sysdeps/posix/signal.c (__bsd_signal): Likewise.
	* sysdeps/posix/sigset.c (sigset): Call and check sigaddset return
	value.
	* signal/sigfillset.c (sigfillset): User __clear_internal_signals
	to filter out internal nptl signals.
	* signal/tst-sigset.c (do_test): Check ech signal indidually and
	also check realtime signals using standard macros.
	* sysdeps/generic/internal-signals.h (__clear_internal_signals,
	__is_internal_signal, __libc_signal_block_all,
	__libc_signal_block_app, __libc_signal_restore_set): New functions.
	* sysdeps/nptl/sigfillset.c: Remove file.
	* sysdeps/unix/sysv/linux/internal-signals.h (__is_internal_signal):
	Change return to bool.
	(__clear_internal_signals): Remove SIGTIMER clean since it is
	equal to SIGCANEL on Linux.
	* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Assume
	signal set was constructed using standard functions.

Reported-by: Yury Norov <ynorov@caviumnetworks.com>
2018-04-03 13:30:49 -03:00
..
aarch64 [PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs 2018-04-03 16:52:16 +01:00
alpha Use x86_64 backtrace as generic version. 2018-03-21 17:25:30 +00:00
arm Remove unused frame.h header, sigcontextinfo.h macros. 2018-03-22 16:40:51 +00:00
generic Filter out NPTL internal signals (BZ #22391) 2018-04-03 13:30:49 -03:00
gnu Fix errno values 2018-03-20 03:10:57 +01:00
hppa Remove unused frame.h header, sigcontextinfo.h macros. 2018-03-22 16:40:51 +00:00
htl hurd: Avoid local PLTs in libpthread. 2018-04-02 18:08:37 +00:00
hurd hurd: Avoid more libc.so PLTs 2018-04-02 23:40:26 +00:00
i386 hurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+ 2018-04-02 16:37:36 +02:00
ia64 Use x86_64 backtrace as generic version. 2018-03-21 17:25:30 +00:00
ieee754 [PATCH 7/7] sin/cos slow paths: refactor sincos implementation 2018-04-03 16:52:18 +01:00
init_array sysdeps/init_array: Add PREINIT_FUNCTION to crti.S 2018-01-29 10:22:26 -08:00
m68k Revert m68k __ieee754_sqrt change 2018-03-16 14:25:41 +00:00
mach hurd: Fix buffer overrun in __if_nametoindex 2018-04-03 18:06:15 +02:00
microblaze hurd: add gscope support 2018-03-11 13:06:33 +01:00
mips Use x86_64 backtrace as generic version. 2018-03-21 17:25:30 +00:00
nios2 Use x86_64 backtrace as generic version. 2018-03-21 17:25:30 +00:00
nptl Filter out NPTL internal signals (BZ #22391) 2018-04-03 13:30:49 -03:00
posix Filter out NPTL internal signals (BZ #22391) 2018-04-03 13:30:49 -03:00
powerpc Remove powerpc, sparc fdim inlines (bug 22987). 2018-03-20 18:35:50 +00:00
pthread hurd: Avoid some PLTs in libc and librt 2018-04-02 19:07:52 +00:00
riscv Use x86_64 backtrace as generic version. 2018-03-21 17:25:30 +00:00
s390 s390x: Fix hidden aliases 2018-04-03 13:52:29 +02:00
sh Use x86_64 backtrace as generic version. 2018-03-21 17:25:30 +00:00
sparc Remove powerpc, sparc fdim inlines (bug 22987). 2018-03-20 18:35:50 +00:00
tile Use x86_64 backtrace as generic version. 2018-03-21 17:25:30 +00:00
unix Filter out NPTL internal signals (BZ #22391) 2018-04-03 13:30:49 -03:00
wordsize-32 Use libc_hidden_* for strtoumax (bug 15105). 2018-02-28 14:16:21 +00:00
wordsize-64 Use libc_hidden_* for strtoumax (bug 15105). 2018-02-28 14:16:21 +00:00
x86 Remove sysdeps/x86/fpu/bits/mathinline.h __finite inline. 2018-03-16 18:36:53 +00:00
x86_64 [PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs 2018-04-03 16:52:16 +01:00