Description of problem:
There is a race between PTRACE_ATTACH and the real parent calling
wait. For a moment, the task is put in PT_PTRACED but with its parent
still pointing to its real_parent. In this circumstance, if the real
parent calls wait without the WUNTRACED flag, he can see a stopped
child status, which wait should never return without WUNTRACED when
the caller is not using ptrace. Here it is not the caller that is
using ptrace, but some third party.
Version-Release number of selected component (if applicable):
Requires SMP or preemption, hits pretty quickly on my 2-CPU test box.
Steps to Reproduce:
1. See attached test program.
2. compile it
3. run it
Eventually prints "wait => PID status 137f ..." and then gets
confused. This happens when wait returns for the stopped child, which
should not be possible.
That should not happen.
Fix on the way
Created attachment 104297 [details]
test program to reproduce the bug
Just compile and run it.
Created attachment 104298 [details]
upstream 2.6 patch to avoid this race
I've submitted this patch upstream, waiting for feedback.
This patch has gone in upstream, should be in 2.6.10.
2.6.10 has this fixed.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.