about summary refs log tree commit diff
path: root/rt/Makefile
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-12-09 14:33:33 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-02-19 13:46:31 -0300
commit27d83441a2f900059d0421339d0e8c27220ffa36 (patch)
tree22b8a2d04bfc965462d96a99b32da18fc17eb2b5 /rt/Makefile
parent8d42bf859a289944749d9f978c076cd318119867 (diff)
downloadglibc-27d83441a2f900059d0421339d0e8c27220ffa36.tar.gz
glibc-27d83441a2f900059d0421339d0e8c27220ffa36.tar.xz
glibc-27d83441a2f900059d0421339d0e8c27220ffa36.zip
Block all signals on timer_create thread (BZ#10815)
The behavior of the signal mask on threads created by timer_create
for SIGEV_THREAD timers are implementation-defined and glibc explicit
unblocks all signals before calling the user-defined function.

This behavior, although not incorrect standard-wise, opens a race if a
program using a blocked rt-signal plus sigwaitinfo (and without an
installed signal handler for the rt-signal) receives a signal while
executing the used-defined function for SIGEV_THREAD.

A better alternative discussed in bug report is to rather block all
signals (besides the internal ones not available to application
usage).

This patch fixes this issue by only unblocking SIGSETXID (used on
set*uid function) and SIGCANCEL (used for thread cancellation).

Checked on x86_64-linux-gnu and i686-linux-gnu.
Diffstat (limited to 'rt/Makefile')
-rw-r--r--rt/Makefile7
1 files changed, 5 insertions, 2 deletions
diff --git a/rt/Makefile b/rt/Makefile
index 935d968716..dab5d62a57 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -47,6 +47,7 @@ tests := tst-shm tst-timer tst-timer2 \
 	 tst-timer3 tst-timer4 tst-timer5 \
 	 tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
 	 tst-shm-cancel
+tests-internal := tst-timer-sigmask
 
 extra-libs := librt
 extra-libs-others := $(extra-libs)
@@ -63,9 +64,11 @@ LDFLAGS-rt.so = -Wl,--enable-new-dtags,-z,nodelete
 $(objpfx)librt.so: $(shared-thread-library)
 
 ifeq (yes,$(build-shared))
-$(addprefix $(objpfx),$(tests)): $(objpfx)librt.so $(shared-thread-library)
+$(addprefix $(objpfx),$(tests) $(tests-internal)): \
+	$(objpfx)librt.so $(shared-thread-library)
 else
-$(addprefix $(objpfx),$(tests)): $(objpfx)librt.a $(static-thread-library)
+$(addprefix $(objpfx),$(tests)) $(tests-internal): \
+	$(objpfx)librt.a $(static-thread-library)
 endif
 
 tst-mqueue7-ARGS = -- $(host-test-program-cmd)