On 08/02, Oleg Nesterov wrote:
utrace patches for 3.1 kernel. Untested, will try to do some tests
tomorrow.
I tried to test it a bit, seems to work. But see the new
[PATCH 31/31] utrace_resume: check irqs_disabled() to shut up lockdep.
The whole series is available in
Add the killed tracehook_consider_fatal_signal() back. It has multiple
callers and it is not easy add the necessary checks inline.
Signed-off-by: Oleg Nesterov o...@redhat.com
---
arch/s390/kernel/traps.c |4 ++--
include/linux/tracehook.h | 22 ++
kernel/signal.c
Restore the necessary hooks in release_task() and exit_notify(),
add the corresponding helpers into utrace.h.
Note: the @signal argument passed to -report_death() does not
match the previous behaviour. I think this shouldn't affect the
current users, and I bet nobody can really understand what
- change utrace_get_signal() to check JOBCTL_STOP_PENDING instead of
signal-group_stop_count. With the recent changes group_stop_count
doesn't necessarily mean this task should participate in group stop.
- remove the participate in group stop code from utrace_wakeup() and
utrace_stop(),
Add the necessary and somewhat special hooks into sig_ignored() and
recalc_sigpending(). Basically this restores _force_sigpending() and
_consider_ignored_signal() tracehook logic.
Signed-off-by: Oleg Nesterov o...@redhat.com
---
include/linux/utrace.h |2 ++
kernel/signal.c|7
No functional changes. Add the new helper, wake_up_quiescent(task, state),
which simply returns wake_up_state(task, state). Change all callers which
do wake_up_state(STOPPED/TRACED) to use the new helper. ptrace_stop() is
a bit special, it does __set_current_state(RUNNING) in the very unlikely
utrace_finish_stop() is needed to avoid the races with SIGKILL which
wakes up UTRACED task, and thus it should be called every time after
the STOPPED/TRACED/UTRACED returns from schedule(), remember that
TASK_UTRACED can be added while the task is STOPPED/UTRACED.
- change do_signal_state() to
Change utrace.c to use TASK_UTRACED instead of TASK_TRACED.
- utrace_stop/utrace_wakeup: simply use the new state
- utrace_do_stop: do not clear STOPPED/TRACED, but add the new
__TASK_UTRACED bit to state the fact that both ptrace and utrace
want this task to be stopped
- naturally, do not
Add the new helper, ptrace_signal_wake_up(), change ptrace.c/signal.c
to use it instead of signal_wake_up() to wake up a STOPPED/TRACED task.
The new helper does almost the same, except:
- it doesn't use the TASK_WAKEKILL bit to wake up the TRACED
or STOPPED task, it uses
If ptrace_stop() sets TASK_TRACED and then detects we should not stop,
it can race with utrace_do_stop() which can see TASK_TRACED and add
TASK_UTRACED. In this case we should stop for utrace needs.
Signed-off-by: Oleg Nesterov o...@redhat.com
---
kernel/signal.c |8
1 files
Introduce TASK_UTRACED state, will be used by utrace instead of TASK_TRACED.
Note: this state is reported as t (tracing stop) to the user-space to
avoid the confusion. IOW, it looks like TASK_TRACED in /proc/pid/status.
Signed-off-by: Oleg Nesterov o...@redhat.com
---
fs/proc/array.c |
- Reintroduce tracehook_get_signal() as utrace_hook_signal().
- Change get_signal_to_deliver() to call utrace_hook_signal() first,
before dequeue_signal()
- Always call ptrace_signal() if signal != SIGKILL, no matter whether
this signal comes from utrace or not.
Since this can change
utrace_get_signal() checks JOBCTL_STOP_PENDING to detect the
case when we should not try to dequeue the signal but should
try to participate in the group-stop.
With the recent changes this is not enough, everything which
contrbutes to recalc_sigpending_tsk() should be respected.
Check
Both utrace and ptrace can want the same thread to be quiescent, in this
case its state is TASK_TRACED | TASK_UTRACED. And this also means that
this task must not run unless both utrace and ptrace resume it.
Change wake_up_quiescent(p, state) to do p-state = ~state and return
false unless there
Currently tracehooks assume that if the ptraced task has
TIF_SYSCALL_TRACE set, the tracee should report the syscall.
This is not true, this thread flag can be set by utrace.
Add the new internal ptrace flag, PT_SYSCALL_TRACE. Change
ptrace_set_syscall_trace() to set/clear this bit along with
No functional changes. Add the new helper, ptrace_set_syscall_trace(),
which should be used to set/clear TIF_SYSCALL_TRACE in ptrace code.
Currently it does nothing more.
Signed-off-by: Oleg Nesterov o...@redhat.com
---
kernel/ptrace.c | 15 ++-
1 files changed, 10 insertions(+), 5
TIF_SYSCALL_TRACE should be cleared only if both ptrace and utrace do
not want it, change utrace_reset() to check PT_SYSCALL_TRACE before
clear_tsk_thread_flag(TIF_SYSCALL_TRACE).
Signed-off-by: Oleg Nesterov o...@redhat.com
---
kernel/utrace.c |1 +
1 files changed, 1 insertions(+), 0
Add the necessary copy_process()-utrace_init_task() and
free_task()-utrace_free_task() calls.
Originally this was the part of utrace core patch, but since
tracehooks are dying it doesn't make sense to reintroduce them.
Instead, just call the utrace_ helpers directly. This is fine
even without
- Add task_utrace_lock(task). It simply takes task-utrace-lock if
this task was ever utraced. Otherwise it takes task_lock(), this
serializes with utrace_attach_task()-utrace_task_alloc(). In both
case the caller can be sure it can't race with anything which needs
utrace-lock.
- Add
finish_resume_report() should not enable/disable the stepping if
ptrace_wants_step() == T. If ptrace wants block_step while utrace
wants single_step we could promote the stepping, but I do not
think this really makes sense.
Unless the tracee is killed this can't race with ptrace, this is
called
4d16a64 introduce PT_SYSCALL_TRACE flag breaks PTRACE_SYSEMU
which doesn't set PT_SYSCALL_TRACE.
Change ptrace_report_syscall() to check TIF_SYSCALL_EMU as well.
This can't conflict with utrace, this flag can only be set by
ptrace.
Signed-off-by: Oleg Nesterov o...@redhat.com
---
21 matches
Mail list logo