Index: valgrind/coregrind/vg_syscalls.c
===================================================================
--- valgrind.orig/coregrind/vg_syscalls.c	2005-02-26 18:24:28.000000000 -0800
+++ valgrind/coregrind/vg_syscalls.c	2005-02-26 18:25:38.000000000 -0800
@@ -5460,7 +5460,6 @@ PRE(sys_sigsuspend, MayBlock)
    PRE_REG_READ3(int, "sigsuspend",
                  int, history0, int, history1,
                  vki_old_sigset_t, mask);
-   convert_sigset_to_rt((vki_old_sigset_t *)arg3, &tst->eff_sig_mask);
 }
 
 // XXX: x86-specific
@@ -5474,10 +5473,8 @@ 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)
-   if (arg1 != (Addr)NULL) {
+   if (arg1 != (Addr)NULL)
       SYS_PRE_MEM_READ( "rt_sigsuspend(mask)", arg1, sizeof(vki_sigset_t) );
-      tst->eff_sig_mask = *(vki_sigset_t *)arg1;
-   }
 }
 
 PRE(sys_rt_sigtimedwait, MayBlock)
@@ -5991,7 +5988,6 @@ void VG_(post_syscall) (ThreadId tid)
 
    mayBlock        = !!( flags & MayBlock );
 
-
    if (sys->after != NULL &&
        ((flags & PostOnFail) != 0 || !VG_(is_kerror)(SYSRES))) {
       if (0)
Index: valgrind/coregrind/vg_signals.c
===================================================================
--- valgrind.orig/coregrind/vg_signals.c	2005-02-26 18:16:51.000000000 -0800
+++ valgrind/coregrind/vg_signals.c	2005-02-26 18:25:38.000000000 -0800
@@ -1620,6 +1620,12 @@ void vg_async_signalhandler ( Int sigNo,
       VG_(message)(Vg_DebugMsg, "Async handler got signal %d for tid %d info %d",
 		   sigNo, tid, info->si_code);
 
+   /* Update the thread's effective signal mask.  The only syscall
+      this should apply to is sigsuspend, which has a temporary signal
+      mask set for signals delivered while it is blocked.  The signal
+      handler will restore this on signal return. */
+   tst->eff_sig_mask = uc->uc_sigmask;
+
    /* Update thread state properly */
    VGA_(interrupted_syscall)(tid, uc, 
 			     !!(vg_scss.scss_per_sig[sigNo].scss_flags & VKI_SA_RESTART));
@@ -1728,19 +1734,13 @@ void vg_sync_signalhandler ( Int sigNo, 
 	  - while blocked in a syscall
 	    Action: make thread runnable, queue signal, resume scheduler
       */
-      Bool resume_sched = False;
-
       if (VG_(threads)[tid].status == VgTs_WaitSys) {
-	 /* This is like a normal async signal, but we can't simply
-	    call async_signalhandler because the client may actually
-	    have the signal blocked, so we still need to queue it. */
-	 resume_sched = True;
-
-	 VG_(set_running)(tid);
-
-	 /* Update thread state properly */
-	 VGA_(interrupted_syscall)(tid, uc, 
-				   !!(vg_scss.scss_per_sig[sigNo].scss_flags & VKI_SA_RESTART));
+	 /* Since this signal interrupted a syscall, it means the
+	    client's signal mask was applied, so we can't get here
+	    unless the client wants this signal right now.  This means
+	    we can simply use the async_signalhandler. */
+	 vg_async_signalhandler(sigNo, info, uc);
+	 VG_(core_panic)("vg_async_signalhandler returned!?\n");
       }
 
       if (info->_sifields._kill._pid == 0) {
@@ -1768,8 +1768,8 @@ void vg_sync_signalhandler ( Int sigNo, 
       }
 
       if (VG_(clo_trace_signals))
-	 VG_(message)(Vg_DebugMsg, "Routing user-sent sync signal %d via queue; resume_sched=%d",
-		      sigNo, resume_sched);
+	 VG_(message)(Vg_DebugMsg, "Routing user-sent sync signal %d via queue",
+		      sigNo);
 
       /* Since every thread has these signals unblocked, we can't rely
 	 on the kernel to route them properly, so we need to queue
@@ -1779,8 +1779,6 @@ void vg_sync_signalhandler ( Int sigNo, 
       else
 	 queue_signal(0, info);	/* shared pending */
 
-      if (resume_sched)
-	 VG_(resume_scheduler)(tid);
       return;
    } 
 
