misc + context-siginfo changes
Oleg.
do_ptrace_notify_stop()-do_notify_parent_cldstop() is not safe
when called by tracer.
By the time we take tasklist the tracee can be SIGKILL'ed and
released by our sub-thread. In this case it is wrong to notify
its -real_parent.
If -real_parent has exited, then do_notify_parent_cldstop()
can use
task_struct-ptrace_message is no longer needed.
I wonder why compat_ptrace_request() does (compat_ulong_t)ptrace_message,
put_user(x, ptr) uses __typeof__(*ptr).
---
kernel/ptrace.c |7 ---
1 file changed, 4 insertions(+), 3 deletions(-)
--- PU/kernel/ptrace.c~59_NO_PTRACE_MESSAGE
Add ptrace_context-signr. The tracer just sets context-signr = data
and resumes the tracee, the tracee updates context-siginfo if needed.
When the tracee reports the signal it sets context-signr = info-si_signo.
This matches the current behaviour, but perhaps it would be bettter to set
-signr =
- Change ptrace_getsiginfo() to use ptrace_rw_siginfo().
- Fix the semantics. We should return EINVAL only if the tracee
was stopped. If it didn't report the signal, we fill siginfo
like ptrace_notify() did.
Note! Currently do_ptrace_notify_stop() clears context-ev_code for
debugging
Like the previous patch, but if the tracee didn't report a signal we
do nothing but return success.
Currently ptrace_notify() always sets -last_siginfo != NULL which can
be update via PTRACE_SETSIGINFO, but this info will be never used.
We pretend siginfo was updated for compatibility but the
ptrace_report_signal(UTRACE_SIGNAL_HANDLER) should be never called
with a valid context-siginfo, move the corresponding WARN_ON() up.
---
kernel/ptrace.c |6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- PU/kernel/ptrace.c~60_SIGNAL_HANDLER_WARN_ALWAYS2009-10-02
A separate patch to discuss the comments/naming.
Introduce the new helper, ptrace_rw_siginfo(), to access context-siginfo.
It assumes the tracee must have the valid -siginfo != NULL unless we race
with SIGKILL, see the next patches.
---
kernel/ptrace.c | 37