ptrace && task->exit_code

From: Oleg Nesterov
Date: Wed May 27 2009 - 19:10:18 EST

I didn't realize this until yesterday, but perhaps it makes sense
to decouple ptrace && task_struct->exit_code?

If not - do not read further.

This is not completely trivial, needs another short series.

And. I spent a lot of time, but I can't see how to solve the problems
with TASK_STOPPED tasks if we do this change.

For the moment, forget that ->exit_code is used by do_exit/etc. Suppose
we just move task->exit_code into ptrace_task->xxx.

Now. The never traced task (->ptrace_task == NULL) stops and sleeps in

The tracer attaches, and then ptrace_check_attach() changes its ->state
to TASK_TRACED. But what should we do to ensure do_wait() will succeed

Currently wait_task_stopped(ptrace => 1) needs ->exit_code != 0. Perhaps
we can change ptrace_check_attach() to set ptrace_task->xxx if it is zero.

But can't we just change wait_task_stopped() to return success when
ptrace == T regardless of ->exit_code == 0 ? I guess, the answer is
"we can break things".

What do you think?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at