NetBSD-Bugs archive

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

Re: kern/45330: ptrace: signals can alter syscall return values



The following reply was made to PR kern/45330; it has been noted by GNATS.

From: "Jared McNeill" <jmcneill%invisible.ca@localhost>
To: <gnats-bugs%NetBSD.org@localhost>
Cc: 
Subject: Re: kern/45330: ptrace: signals can alter syscall return values
Date: Mon, 5 Sep 2011 13:41:48 -0400

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0004_01CC6BD1.8F30AAD0
 Content-Type: text/plain;
        format=flowed;
        charset="iso-8859-1";
        reply-type=original
 Content-Transfer-Encoding: 7bit
 
 Here's a patch that fixes the problem, but I'm not familiar enough with the 
 code to know if it's correct. 
 
 ------=_NextPart_000_0004_01CC6BD1.8F30AAD0
 Content-Type: application/octet-stream;
        name="pr45330.patch"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment;
        filename="pr45330.patch"
 
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
 RCS file: /cvsroot/src/sys/kern/sys_process.c,v=0A=
 retrieving revision 1.161=0A=
 diff -u -p -r1.161 sys_process.c=0A=
 --- sys_process.c      2 Sep 2011 20:07:41 -0000       1.161=0A=
 +++ sys_process.c      5 Sep 2011 17:37:12 -0000=0A=
 @@ -1102,7 +1102,6 @@ process_stoptrace(void)=0A=
  {=0A=
        struct lwp *l =3D curlwp;=0A=
        struct proc *p =3D l-&gt;l_proc, *pp;=0A=
 -      int sig;=0A=
  =0A=
        mutex_enter(proc_lock);=0A=
        mutex_enter(p-&gt;p_lock);=0A=
 @@ -1118,15 +1117,11 @@ process_stoptrace(void)=0A=
        proc_stop(p, 1, SIGSTOP);=0A=
        mutex_exit(proc_lock);=0A=
  =0A=
 -      /*=0A=
 -       * Call issignal() once only, to have it take care of the=0A=
 -       * pending stop.  Signal processing will take place as usual=0A=
 -       * from userret().=0A=
 -       */=0A=
 -      KERNEL_UNLOCK_ALL(l, &amp;l-&gt;l_biglocks);=0A=
 -      if ((sig =3D issignal(l)) !=3D 0)=0A=
 -              postsig(sig);=0A=
 +      if (sigispending(l, 0)) {=0A=
 +              lwp_lock(l);=0A=
 +              l-&gt;l_flag |=3D LW_PENDSIG;=0A=
 +              lwp_unlock(l);=0A=
 +      }=0A=
        mutex_exit(p-&gt;p_lock);=0A=
 -      KERNEL_LOCK(l-&gt;l_biglocks, l);=0A=
  }=0A=
  #endif        /* KTRACE || PTRACE */=0A=
 
 ------=_NextPart_000_0004_01CC6BD1.8F30AAD0--
 


Home | Main Index | Thread Index | Old Index