bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 7/8] Hurd signals: fix uninitialized value.


From: Jeremie Koenig
Subject: [PATCH 7/8] Hurd signals: fix uninitialized value.
Date: Wed, 25 May 2011 17:59:33 +0200

* hurd/hurdsig.c (post_signal): Don't call resume() with ACT uninitialized,
as it might result in the target thread being left suspended.
---
 hurd/hurdsig.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index b6fbb14..75d60b0 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -531,62 +531,65 @@ post_signal (struct hurd_sigstate *ss,
       /* Fetch ports to all our threads and resume them.  */
       err = __task_threads (__mach_task_self (), &threads, &nthreads);
       assert_perror (err);
       for (i = 0; i < nthreads; ++i)
        {
          if (threads[i] != _hurd_msgport_thread &&
              (act != handle || threads[i] != ss->thread))
            {
              err = __thread_resume (threads[i]);
              assert_perror (err);
            }
          err = __mach_port_deallocate (__mach_task_self (),
                                        threads[i]);
          assert_perror (err);
        }
       __vm_deallocate (__mach_task_self (),
                       (vm_address_t) threads,
                       nthreads * sizeof *threads);
       _hurd_stopped = 0;
       if (act == handle)
        /* The thread that will run the handler is already suspended.  */
        ss_suspended = 1;
     }
 
   error_t err;
   sighandler_t handler;
 
   if (signo == 0)
     {
       if (untraced)
-       /* This is PTRACE_CONTINUE.  */
-       resume ();
+       {
+         /* This is PTRACE_CONTINUE.  */
+         act = ignore;
+         resume ();
+       }
 
       /* This call is just to check for pending signals.  */
       __spin_lock (&ss->lock);
       return 1;
     }
 
   thread_state.set = 0;                /* We know nothing.  */
 
   __spin_lock (&ss->lock);
 
   /* Check for a preempted signal.  Preempted signals can arrive during
      critical sections.  */
   {
     inline sighandler_t try_preemptor (struct hurd_signal_preemptor *pe)
       {                                /* PE cannot be null.  */
        do
          {
            if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code))
              {
                if (pe->preemptor)
                  {
                    sighandler_t handler = (*pe->preemptor) (pe, ss,
                                                             &signo, detail);
                    if (handler != SIG_ERR)
                      return handler;
                  }
                else
                  return pe->handler;
              }
            pe = pe->next;
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]