[PATCH 57-64] context-siginfo changes

2009-10-02 Thread Oleg Nesterov
misc + context-siginfo changes Oleg.

[PATCH 58] do_ptrace_notify_stop: fix the race with SIGKILL

2009-10-02 Thread Oleg Nesterov
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

[PATCH 59] don't use task_struct-ptrace_message

2009-10-02 Thread Oleg Nesterov
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

[PATCH 61] move resume signal logic into the tracee's context

2009-10-02 Thread Oleg Nesterov
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 =

[PATCH 63] convert ptrace_getsiginfo() to use ptrace_rw_siginfo()

2009-10-02 Thread Oleg Nesterov
- 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

[PATCH 64] convert ptrace_setsiginfo() to use ptrace_rw_siginfo()

2009-10-02 Thread Oleg Nesterov
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

[PATCH 60] UTRACE_SIGNAL_HANDLER should never see -siginfo != NULL

2009-10-02 Thread Oleg Nesterov
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

[PATCH 62] introduce ptrace_rw_siginfo() helper

2009-10-02 Thread Oleg Nesterov
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