|
From: Jeremy F. <je...@go...> - 2004-01-16 02:19:26
|
CVS commit by fitzhardinge:
Fix bug 72484. Set the process signal mask to match the client's before
running exec.
A none/tests/exec-sigmask.stderr.exp 1.1
M +2 -2 coregrind/vg_include.h 1.169
M +23 -0 coregrind/vg_syscalls.c 1.78
M +4 -1 none/tests/Makefile.am 1.21
--- valgrind/none/tests/Makefile.am #1.20:1.21
@@ -16,4 +16,6 @@
discard.stderr.exp discard.stdout.exp \
discard.vgtest \
+ exec-sigmask.vgtest
+ exec-sigmask.stdout.exp exec-sigmask.stderr.exp \
floored.stderr.exp floored.stdout.exp \
floored.vgtest \
@@ -45,5 +47,5 @@
check_PROGRAMS = \
args bitfield1 bt_everything bt_literal coolo_strlen \
- cpuid dastest discard floored fork fpu_lazy_eflags \
+ cpuid dastest discard exec-sigmask floored fork fpu_lazy_eflags \
fucomip munmap_exe map_unmap mremap rcl_assert \
rcrl readline1 resolv seg_override sha1_test shortpush shorts smc1 \
@@ -64,4 +66,5 @@
dastest_SOURCES = dastest_c.c dastest_s.s
discard_SOURCES = discard.c
+exec_sigmask_SOURCES = exec-sigmask.c
fork_SOURCES = fork.c
floored_SOURCES = floored.c
--- valgrind/coregrind/vg_syscalls.c #1.77:1.78
@@ -1878,4 +1878,27 @@ PRE(execve)
}
+ /* Set our real sigmask to match the client's sigmask so that the
+ exec'd child will get the right mask. First we need to clear
+ out any pending signals so they they don't get delivered, which
+ would confuse things.
+
+ XXX This is a bug - the signals should remain pending, and be
+ delivered to the new process after exec. There's also a
+ race-condition, since if someone delivers us a signal between
+ the sigprocmask and the execve, we'll still get the signal. Oh
+ well.
+ */
+ {
+ vki_ksigset_t allsigs;
+ vki_ksiginfo_t info;
+ static const struct vki_timespec zero = { 0, 0 };
+
+ VG_(ksigfillset)(&allsigs);
+ while(VG_(ksigtimedwait)(&allsigs, &info, &zero) > 0)
+ ;
+
+ VG_(ksigprocmask)(VKI_SIG_SETMASK, &tst->sig_mask, NULL);
+ }
+
res = VG_(do_syscall)(__NR_execve, arg1, arg2, arg3);
--- valgrind/coregrind/vg_include.h #1.168:1.169
@@ -765,6 +765,6 @@ typedef
vki_ksigset_t sig_mask;
- /* Effective signal mask. This is the mask which is currently
- applying; it may be different from sig_mask while a signal
+ /* Effective signal mask. This is the mask which currently
+ applies; it may be different from sig_mask while a signal
handler is running.
*/
|