[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: valgrind/coregrind
From: Jeremy Fitzhardinge <jeremy () goop ! org>
Date: 2005-03-18 7:39:28
Message-ID: 20050318073928.4669616DE8 () office ! kde ! org
[Download RAW message or body]
CVS commit by fitzhardinge:
sigsuspend was not sanitizing the temporary signal mask, which allowed
SIGVGKILL to be blocked. This could cause process-exit to hang
indefinitely while threads ignore their requests to exit.
This patch sanitizes a copy of the temp sig mask, and points the syscall
to the sanitized version.
M +21 -3 vg_syscalls.c 1.261
--- valgrind/coregrind/vg_syscalls.c #1.260:1.261
@@ -5501,5 +5501,6 @@ PRE(sys_pause, MayBlock)
PRE(sys_sigsuspend, MayBlock)
{
- /* The C library interface to sigsuspend just takes a pointer to
+ /*
+ The C library interface to sigsuspend just takes a pointer to
a signal mask but this system call has three arguments - the first
two don't appear to be used by the kernel and are always passed as
@@ -5509,4 +5510,10 @@ PRE(sys_sigsuspend, MayBlock)
In fact glibc normally uses rt_sigsuspend if it is available as
that takes a pointer to the signal mask so supports more signals.
+
+ NOTE: (non-RT) sigsuspend can't block RT signals like
+ VKI_SIGVGKILL, so we don't need to worry about sanitizing its
+ mask, like we do with rt_sigsuspend. We still need
+ tst->tmp_sig_mask to be set, since this is the effective signal
+ mask for any signal handlers which run during this syscall.
*/
PRINT("sys_sigsuspend ( %d, %d, %d )", arg1,arg2,arg3 );
@@ -5520,5 +5527,6 @@ PRE(sys_sigsuspend, MayBlock)
PRE(sys_rt_sigsuspend, MayBlock)
{
- /* The C library interface to sigsuspend just takes a pointer to
+ /*
+ The C library interface to sigsuspend just takes a pointer to
a signal mask but this system call has two arguments - a pointer
to the mask and the number of bytes used by it. The kernel insists
@@ -5527,8 +5535,18 @@ PRE(sys_rt_sigsuspend, MayBlock)
*/
PRINT("sys_rt_sigsuspend ( %p, %d )", arg1,arg2 );
- PRE_REG_READ2(int, "rt_sigsuspend", vki_sigset_t *, mask, vki_size_t, size);
+ PRE_REG_READ2(int, "rt_sigsuspend",
+ vki_sigset_t *, mask, vki_size_t, size);
if (arg1 != (Addr)NULL) {
SYS_PRE_MEM_READ( "rt_sigsuspend(mask)", arg1, sizeof(vki_sigset_t) );
+
+ /* We need to make sure that the rt_sigsuspend doesn't mask more
+ signals than it is allowed, so we make a copy of the
+ temporary mask, sanitize that, and point the syscall to use
+ the copy. (We need this copy anyway, because its the
+ effective signal mask during any signal handlers which are
+ called during this syscall.) */
tst->tmp_sig_mask = *(vki_sigset_t *)arg1;
+ VG_(sanitize_client_sigmask)(tid, &tst->tmp_sig_mask);
+ arg1 = (Addr)&tst->tmp_sig_mask;
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic