]> sourceware.org Git - glibc.git/commitdiff
posix: Correctly block/unblock all signals on Linux posix_spawn
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 14 Sep 2016 17:41:21 +0000 (14:41 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 20 Sep 2016 20:18:15 +0000 (17:18 -0300)
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.

ChangeLog
sysdeps/unix/sysv/linux/spawni.c

index 76d508ffaeb46d7d168547d633fb671c85fbe19a..88c766f86f7009b413883d37508d491ae59ea59f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2016-09-20  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+       * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Correctly block and unblock
+       all signals when executing the clone vfork child.
+       (SIGALL_SET): Remove macro.
+
        * nptl/Makefile (tests): Add tst-exec5.
        * nptl/tst-exec5.c: New file.
        * sysdeps/unix/sysv/linux/spawni.c (__spawni): Correctly enable and disable
index 5c5fcad5f4d3ed458ae8c78bf6dad58db3576224..67e1c42426cffeab27861ccbd9f175e43f5578a1 100644 (file)
    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);
 
This page took 0.180695 seconds and 5 git commands to generate.