about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/spawni.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2016-09-14 14:41:21 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2016-09-20 17:18:15 -0300
commit802c1c5a6539024af3c51fd11e6f3cda1f850c62 (patch)
tree52540cecd139663cc2bb043f379105377f294795 /sysdeps/unix/sysv/linux/spawni.c
parent706e6749de9667f3f3763743a294d28f895f4fa9 (diff)
downloadglibc-802c1c5a6539024af3c51fd11e6f3cda1f850c62.tar.gz
glibc-802c1c5a6539024af3c51fd11e6f3cda1f850c62.tar.xz
glibc-802c1c5a6539024af3c51fd11e6f3cda1f850c62.zip
posix: Correctly block/unblock all signals on Linux posix_spawn
This patch correctly block and unblocks all signals when executing
Linux posix_spawn by using the __libc_signal_{un}block_all functions
instead of default sigprocmask.  The latter might remove both
SIGCANCEL and SIGSETXID from the blocked signal list.

Checked on x86_64, i686, powerpc64le, and aarch64.

	* sysdeps/unix/sysv/linux/spawni.c (__spawnix): Correctly block and unblock
	all signals when executing the clone vfork child.
	(SIGALL_SET): Remove macro.
Diffstat (limited to 'sysdeps/unix/sysv/linux/spawni.c')
-rw-r--r--sysdeps/unix/sysv/linux/spawni.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
index 5c5fcad5f4..67e1c42426 100644
--- a/sysdeps/unix/sysv/linux/spawni.c
+++ b/sysdeps/unix/sysv/linux/spawni.c
@@ -58,10 +58,6 @@
    normal program exit with the exit code 127.  */
 #define SPAWN_ERROR	127
 
-/* We need to block both SIGCANCEL and SIGSETXID.  */
-#define SIGALL_SET \
-  ((__sigset_t) { .__val = {[0 ...  _SIGSET_NWORDS-1 ] =  -1 } })
-
 #ifdef __ia64__
 # define CLONE(__fn, __stack, __stacksize, __flags, __args) \
   __clone2 (__fn, __stack, __stacksize, __flags, __args, 0, 0, 0)
@@ -353,7 +349,7 @@ __spawnix (pid_t * pid, const char *file,
   args.envp = envp;
   args.xflags = xflags;
 
-  __sigprocmask (SIG_BLOCK, &SIGALL_SET, &args.oldmask);
+  __libc_signal_block_all (&args.oldmask);
 
   /* The clone flags used will create a new child that will run in the same
      memory space (CLONE_VM) and the execution of calling thread will be
@@ -386,7 +382,7 @@ __spawnix (pid_t * pid, const char *file,
   if ((ec == 0) && (pid != NULL))
     *pid = new_pid;
 
-  __sigprocmask (SIG_SETMASK, &args.oldmask, 0);
+  __libc_signal_restore_set (&args.oldmask);
 
   __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);