public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wait_task_stopped: pass correct exit_code to wait_noreap_copyout
@ 2007-11-18  9:13 Scott James Remnant
  2007-11-20  6:43 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Scott James Remnant @ 2007-11-18  9:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Oleg Nesterov, Roland McGrath

[-- Attachment #1: Type: text/plain, Size: 885 bytes --]

In wait_task_stopped() exit_code already contains the right value for
the si_status member of siginfo, and this is simply set in the non
WNOWAIT case.
    
Pass it unchanged to wait_noreap_copyout();  we would only need to
shift it and add 0x7f if we were returning it in the user status field
and that isn't used for any function that permits WNOWAIT.
    
Signed-off-by: Scott James Remnant <scott@ubuntu.com>
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Roland McGrath <roland@redhat.com>

--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1389,7 +1389,7 @@ static int wait_task_stopped(struct task_struct
*p, int delayed_group_leader,
 		if (unlikely(!exit_code) || unlikely(p->exit_state))
 			goto bail_ref;
 		return wait_noreap_copyout(p, pid, uid,
-					   why, (exit_code << 8) | 0x7f,
+					   why, exit_code,
 					   infop, ru);
 	}
 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wait_task_stopped: pass correct exit_code to wait_noreap_copyout
  2007-11-18  9:13 [PATCH] wait_task_stopped: pass correct exit_code to wait_noreap_copyout Scott James Remnant
@ 2007-11-20  6:43 ` Andrew Morton
  2007-11-20  7:55   ` Scott James Remnant
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2007-11-20  6:43 UTC (permalink / raw)
  To: Scott James Remnant; +Cc: linux-kernel, Oleg Nesterov, Roland McGrath

On Sun, 18 Nov 2007 09:13:24 +0000 Scott James Remnant <scott@ubuntu.com> wrote:

> In wait_task_stopped() exit_code already contains the right value for
> the si_status member of siginfo, and this is simply set in the non
> WNOWAIT case.
>     
> Pass it unchanged to wait_noreap_copyout();  we would only need to
> shift it and add 0x7f if we were returning it in the user status field
> and that isn't used for any function that permits WNOWAIT.
>     
> Signed-off-by: Scott James Remnant <scott@ubuntu.com>
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> Signed-off-by: Roland McGrath <roland@redhat.com>
> 
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -1389,7 +1389,7 @@ static int wait_task_stopped(struct task_struct
> *p, int delayed_group_leader,
>  		if (unlikely(!exit_code) || unlikely(p->exit_state))
>  			goto bail_ref;
>  		return wait_noreap_copyout(p, pid, uid,
> -					   why, (exit_code << 8) | 0x7f,
> +					   why, exit_code,
>  					   infop, ru);
>  	}

Is this bug visible to userspace?  If so, I'm surprised that none of the
various testsuites (which like to exercise this sort of interface) has
detected it.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wait_task_stopped: pass correct exit_code to wait_noreap_copyout
  2007-11-20  6:43 ` Andrew Morton
@ 2007-11-20  7:55   ` Scott James Remnant
  2007-11-20  8:16     ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Scott James Remnant @ 2007-11-20  7:55 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Oleg Nesterov, Roland McGrath

[-- Attachment #1: Type: text/plain, Size: 983 bytes --]

On Mon, 2007-11-19 at 22:43 -0800, Andrew Morton wrote:
> On Sun, 18 Nov 2007 09:13:24 +0000 Scott James Remnant <scott@ubuntu.com> wrote:
> 
> > In wait_task_stopped() exit_code already contains the right value for
> > the si_status member of siginfo, and this is simply set in the non
> > WNOWAIT case.
> >     
> > Pass it unchanged to wait_noreap_copyout();  we would only need to
> > shift it and add 0x7f if we were returning it in the user status field
> > and that isn't used for any function that permits WNOWAIT.
> >     
> Is this bug visible to userspace?  If so, I'm surprised that none of the
> various testsuites (which like to exercise this sort of interface) has
> detected it.
> 
Absolutely;  if you call waitid() with a stopped or traced process,
you'll get the signal in siginfo.si_status as expected -- however if you
call waitid(WNOWAIT) at the same time, you'll get the signal << 8 | 0x7f

Scott
-- 
Scott James Remnant
scott@ubuntu.com

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wait_task_stopped: pass correct exit_code to wait_noreap_copyout
  2007-11-20  7:55   ` Scott James Remnant
@ 2007-11-20  8:16     ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2007-11-20  8:16 UTC (permalink / raw)
  To: Scott James Remnant; +Cc: linux-kernel, Oleg Nesterov, Roland McGrath

On Tue, 20 Nov 2007 07:55:22 +0000 Scott James Remnant <scott@ubuntu.com> wrote:

> On Mon, 2007-11-19 at 22:43 -0800, Andrew Morton wrote:
> > On Sun, 18 Nov 2007 09:13:24 +0000 Scott James Remnant <scott@ubuntu.com> wrote:
> > 
> > > In wait_task_stopped() exit_code already contains the right value for
> > > the si_status member of siginfo, and this is simply set in the non
> > > WNOWAIT case.
> > >     
> > > Pass it unchanged to wait_noreap_copyout();  we would only need to
> > > shift it and add 0x7f if we were returning it in the user status field
> > > and that isn't used for any function that permits WNOWAIT.
> > >     
> > Is this bug visible to userspace?  If so, I'm surprised that none of the
> > various testsuites (which like to exercise this sort of interface) has
> > detected it.
> > 
> Absolutely;  if you call waitid() with a stopped or traced process,
> you'll get the signal in siginfo.si_status as expected -- however if you
> call waitid(WNOWAIT) at the same time, you'll get the signal << 8 | 0x7f
> 

hm, OK.  Well I guess I'll stick a for-2.6.23 tag on this as well as
queueing it for 2.6.24.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-20  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-18  9:13 [PATCH] wait_task_stopped: pass correct exit_code to wait_noreap_copyout Scott James Remnant
2007-11-20  6:43 ` Andrew Morton
2007-11-20  7:55   ` Scott James Remnant
2007-11-20  8:16     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox