Re: [PATCH 0/31] utrace for 3.1 kernel

2012-02-07 Thread Oleg Nesterov
On 02/06, Josh Stone wrote: On 02/06/2012 06:24 PM, Ying, Victor wrote: I have problem to checkout utrace via git clone git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc.git utrace-3.0, it always reports fatal: the remote end hung up unexpectedly; I tried both utrace-3.0 and

[PATCH 0/1] (Was: utrace for 3.3 kernel)

2012-01-30 Thread Oleg Nesterov
On 01/25, Josh Boyer wrote: I'll get this into rawhide this evening. Thanks Josh. There is another simple change, I forgout about it. It is purely internal, has no effect outside of utrace.c. Oleg.

[PATCH utrace-3.1 32/31] ptrace_report_syscall: check if TIF_SYSCALL_EMU is defined

2011-08-09 Thread Oleg Nesterov
From: Tony Breeds t...@bakeyournoodle.com TIF_SYSCALL_EMU is x86 only, add ifdef into ptrace_report_syscall(). Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/tracehook.h |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/tracehook.h b

[PATCH 0/31] utrace for 3.1 kernel

2011-08-03 Thread Oleg Nesterov
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 git

[PATCH 04/31] tracehooks: reintroduce tracehook_consider_fatal_signal()

2011-08-03 Thread Oleg Nesterov
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

[PATCH 08/31] restore the DEATH/REAP utrace hooks

2011-08-03 Thread Oleg Nesterov
this magic argument should actually mean anyway. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/utrace.h | 22 ++ kernel/exit.c |4 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/include/linux/utrace.h b/include/linux/utrace.h

[PATCH 09/31] utrace: remove jobctl bits

2011-08-03 Thread Oleg Nesterov
(), this is no longer needed and wrong. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c | 16 ++-- 1 files changed, 2 insertions(+), 14 deletions(-) diff --git a/kernel/utrace.c b/kernel/utrace.c index 1e750ad..5d3974e 100644 --- a/kernel/utrace.c +++ b/kernel/utrace.c

[PATCH 05/31] add utrace hooks into sig_ignored() and recalc_sigpending()

2011-08-03 Thread Oleg Nesterov
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

[PATCH 11/31] introduce wake_up_quiescent()

2011-08-03 Thread Oleg Nesterov
case, change it as well. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/signal.h |2 ++ kernel/ptrace.c|2 +- kernel/signal.c| 12 ++-- kernel/utrace.c|2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/linux

[PATCH 16/31] reintroduce tracehook_finish_jctl() as utrace_end_stop()

2011-08-03 Thread Oleg Nesterov
() to call this helper right after schedule(), otherwise this logic is broken by the upstream changes - now that utrace doesn't control TASK_TRACED bit, ptrace_stop() must call this helper too. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/utrace.h | 11 +++ kernel/signal.c

[PATCH 15/31] utrace: use TASK_UTRACED instead of TASK_TRACED

2011-08-03 Thread Oleg Nesterov
not use task_is_traced() to check if this task was stopped by utrace, use the new task_is_utraced() helper which checks __TASK_UTRACED. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c | 26 ++ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git

[PATCH 12/31] introduce ptrace_signal_wake_up()

2011-08-03 Thread Oleg Nesterov
static helper. - it uses wake_up_quiescent() instead of wake_up_state(). Thereafter every change from STOPPED/TRACED to RUNNING is done via wake_up_quiescent(). Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/ptrace.h |1 + kernel/ptrace.c| 20

[PATCH 18/31] ptrace_stop: do not assume the task is running after wake_up_quiescent()

2011-08-03 Thread Oleg Nesterov
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 changed

[PATCH 14/31] introduce TASK_UTRACED state

2011-08-03 Thread Oleg Nesterov
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

[PATCH 19/31] get_signal_to_deliver: restore/restructure utrace/ptrace signal reporting

2011-08-03 Thread Oleg Nesterov
signr again, update struct k_sigaction *ka in this case. IOW, roughly, ptrace acts as if it is the last attached engine, it takes the final decision about the signal. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/utrace.h | 31 +++ kernel/signal.c

[PATCH 20/31] utrace_get_signal: s/JOBCTL_STOP_PENDING/JOBCTL_PENDING_MASK/

2011-08-03 Thread Oleg Nesterov
JOBCTL_PENDING_MASK instead. This matches the JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK code in the caller, get_signal_to_deliver(). Note that this code won't run if utrace_get_signal() returns signr 0. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c |2 +- 1 files changed, 1 insertions

[PATCH 17/31] teach wake_up_quiescent() to do selective wake_up

2011-08-03 Thread Oleg Nesterov
there is no more quiescent bits in task-state. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/signal.c | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index a625309..0d1675a 100644 --- a/kernel/signal.c +++ b/kernel

[PATCH 22/31] introduce PT_SYSCALL_TRACE flag

2011-08-03 Thread Oleg Nesterov
with TIF_SYSCALL_TRACE, change ptrace_report_syscall() to check this flag instead of PT_PTRACED. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/ptrace.h|3 +++ include/linux/tracehook.h |2 +- kernel/ptrace.c |7 +-- 3 files changed, 9 insertions(+), 3

[PATCH 21/31] introduce ptrace_set_syscall_trace()

2011-08-03 Thread Oleg Nesterov
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

[PATCH 23/31] utrace: don't clear TIF_SYSCALL_TRACE if it is needed by ptrace

2011-08-03 Thread Oleg Nesterov
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

[PATCH 02/31] utrace: add utrace_init_task/utrace_free_task calls

2011-08-03 Thread Oleg Nesterov
CONFIG_UTRACE, gcc is smart enough to optimize out the code in free_task(). Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/fork.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index e7ceaca..a9891da 100644 --- a/kernel/fork.c +++ b

[PATCH 24/31] introduce task_utrace_lock/task_utrace_unlock

2011-08-03 Thread Oleg Nesterov
task_utrace_unlock(task), it releases the corresponding lock. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/utrace.h |9 + kernel/utrace.c| 26 ++ 2 files changed, 35 insertions(+), 0 deletions(-) diff --git a/include/linux/utrace.h b

[PATCH 27/31] utrace: finish_resume_report: don't do user_xxx_step() if ptrace_wants_step()

2011-08-03 Thread Oleg Nesterov
by the tracee itself. If it is killed we do not care. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/tracehook.h |8 kernel/utrace.c |9 ++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/linux/tracehook.h b/include/linux

[PATCH 30/31] ptrace_report_syscall: check TIF_SYSCALL_EMU

2011-08-03 Thread Oleg Nesterov
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 --- include/linux

[PATCHSET] utrace for 3.1 kernel

2011-08-02 Thread Oleg Nesterov
Hello. utrace patches for 3.1 kernel. Untested, will try to do some tests tomorrow. I do not want to spam you all and the lists, please look at git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc.git utrace-3.1 Oleg Nesterov (29): utrace: add utrace_init_task/utrace_free_task

[PATCH 0/2] update ptrace_disable() + PTRACE_SYSEMU/TIF_SYSCALL_EMU fix

2011-07-03 Thread Oleg Nesterov
On 07/01, Oleg Nesterov wrote: - Perhaps PTRACE_SYSEMU/TIF_SYSCALL_EMU logic was broken, I need to recheck. Yes, it was. Fixed by 2/2. ptrace: shift user_*_step() from ptrace_resume() to ptrace_stop() forgot to change ptrace_disable(), see 1/2. Oleg.

[PATCH 2/2] ptrace_report_syscall: check TIF_SYSCALL_EMU

2011-07-03 Thread Oleg Nesterov
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 --- include/linux

[PATCH 1/2] utrace: finish_resume_report: don't do user_xxx_step() if ptrace_wants_step()

2011-07-01 Thread Oleg Nesterov
by the tracee itself. If it is killed we do not care. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/tracehook.h |8 kernel/utrace.c |9 ++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/linux/tracehook.h b/include/linux

[PATCH 2/2] ptrace: shift user_*_step() from ptrace_resume() to ptrace_stop()

2011-07-01 Thread Oleg Nesterov
user_disable_single_step() while utrace needs the stepping. Set TIF_NOTIFY_RESUME after user_disable_single_step() to ensure the tracee can't return to the user-space without utrace_resume(). Any correct engine which wants the stepping should reassert it. Signed-off-by: Oleg Nesterov o...@redhat.com

[RFC v2 00/19] utrace for 3.0 kernel

2011-06-30 Thread Oleg Nesterov
Another attempt. This version tries to decouple utrace and ptrace. This way it is much simpler to follow the upstream changes, afaics. TODO: - The single-stepping updates in ptrace_resume() can race with utrace_reset()-user_disable_single_step(). This was fixed by

[PATCH 06/19] wait_task_inactive: treat task-state and match_state as bitmasks

2011-06-30 Thread Oleg Nesterov
-state = TASK_STOPPED | TASK_TRACED, this can be useful. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/sched.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index 3f2e502..ade7997 100644 --- a/kernel/sched.c +++ b/kernel/sched.c

[PATCH 04/19] introduce wake_up_quiescent()

2011-06-30 Thread Oleg Nesterov
case, change it as well. Signed-off-by: Oleg Nesterov o...@redhat.com --- include/linux/signal.h |2 ++ kernel/ptrace.c|2 +- kernel/signal.c| 12 ++-- kernel/utrace.c|2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/linux

[PATCH 09/19] tracehooks: kill tracehook_finish_jctl(), add tracehook_finish_stop()

2011-06-30 Thread Oleg Nesterov
it to tracehook_finish_stop(),jctl no longer matches the reality. - change do_signal_state() to call this helper right after schedule(), otherwise this logic is broken by the upstream changes - now that utrace doesn't control TASK_TRACED bit, ptrace_stop() must call this helper too. Signed-off-by: Oleg

[PATCH 10/19] teach wake_up_quiescent() to do selective wake_up

2011-06-30 Thread Oleg Nesterov
there is no more quiescent bits in task-state. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/signal.c | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index a7979ad..57552e6 100644 --- a/kernel/signal.c +++ b/kernel

[PATCH 11/19] ptrace_stop: do not assume the task is running after wake_up_quiescent()

2011-06-30 Thread Oleg Nesterov
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 changed

[PATCH 17/19] teach ptrace_set_syscall_trace() to play well with utrace

2011-06-30 Thread Oleg Nesterov
and this is not utrace-friendly, it can need this flag. Change ptrace_set_syscall_trace() to take task_utrace_lock(), this is enough to fix the 1st problem. Check task_utrace_flags() before clearing TIF_SYSCALL_TRACE, this fixes 2. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/ptrace.c |6 +- 1

[PATCH 18/19] introduce PT_SINGLE_STEP and PT_SINGLE_BLOCK

2011-06-30 Thread Oleg Nesterov
and utrace. TODO: update the !x86 ptrace code which does user_disable_single_step(). Signed-off-by: Oleg Nesterov o...@redhat.com --- arch/x86/kernel/ptrace.c |1 + include/linux/ptrace.h|5 - include/linux/tracehook.h |7 +-- kernel/ptrace.c |3 +++ 4 files

[PATCH 12/19] get_signal_to_deliver: restructure utrace/ptrace signal reporting

2011-06-30 Thread Oleg Nesterov
-by: Oleg Nesterov o...@redhat.com --- kernel/signal.c | 24 +++- 1 files changed, 11 insertions(+), 13 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index 89e691d..d0e0c67 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2006,9 +2006,6 @@ retry: static int

Re: [PATCH 1/4] ptrace: temporary revert the recent ptrace/jobctl rework

2011-06-30 Thread Oleg Nesterov
On 06/21, Roland McGrath wrote: OK, so here's my (hacky) idea: (1) Forget ptrace-via-utrace. Have utrace be a separate thing. This way the recent ptrace changes won't matter. This is what V2 does. (2) But, what about ptrace co-existing well with utrace? Make them mutually exclusive

[PATCH 0/4] utrace for 3.0 kernel

2011-06-20 Thread Oleg Nesterov
Hello. Utrace patches for 3.0 kernel 0001-ptrace-temporary-revert-the-recent-ptrace-jobctl-re.patch 0002-tracehooks-preparation-for-ptrace-utrace.patch 0003-utrace-core.patch 0004-implement-utrace-ptrace.patch also available in the following git branch

[PATCH 1/4] ptrace: temporary revert the recent ptrace/jobctl rework

2011-06-20 Thread Oleg Nesterov
reported. In the long term we need another solution. Signed-off-by: Oleg Nesterov o...@redhat.com --- fs/exec.c |1 - include/linux/sched.h | 17 +-- include/linux/tracehook.h | 27 kernel/exit.c | 77 ++- kernel/ptrace.c | 116

[PATCH 4/4] implement utrace-ptrace

2011-06-20 Thread Oleg Nesterov
-by: Oleg Nesterov o...@redhat.com --- include/linux/ptrace.h |3 + kernel/Makefile|1 + kernel/ptrace-utrace.c | 1173 kernel/ptrace.c| 638 +- kernel/utrace.c| 16 + 5 files changed, 1513

Re: [PATCH 1/4] ptrace: temporary revert the recent ptrace/jobctl rework

2011-06-20 Thread Oleg Nesterov
On 06/20, Kyle McMartin wrote: On Mon, Jun 20, 2011 at 06:07:44PM +0200, Oleg Nesterov wrote: Temporary revert the following patches to keep utrace/utrace-ptrace working: huge list of patches here This obviously reverts some user-visible fixes, but the fixed problems are very old

[PATCH 0/5] ptrace-utrace: fix exit_ptrace() vs ptrace_report_signal() races

2010-12-10 Thread Oleg Nesterov
In short: exit_ptrace()-ptrace_detach_task() is very wrong when it tries to detach the !stopped tracee, we can not trust get_stop_event() in this case. This means that in the case like ptrace(PTRACE_CONT, ..., SIGXXX); exit(); // --- calls ptrace_detach_task() the tracee can

[PATCH 3/5] ptrace-utrace: don't assume resume != UTRACE_RESUME means stepping

2010-12-10 Thread Oleg Nesterov
the trivial helper, is_step_resume(), which does the check. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/ptrace-utrace.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) --- kstub/kernel/ptrace-utrace.c~3_resume_step_helper 2010-09-20 03:53:31.0 +0200

[PATCH 5/5] ptrace-utrace: fix exit_ptrace() vs ptrace_report_signal() races

2010-12-10 Thread Oleg Nesterov
-resume before reporting a signal. This fixes the 2nd problem. To fix the 1st problem, change !explicit case to check -siginfo != NULL instead of relying on get_stop_event() which can't work with the running tracee. Reported-by: Glen Johnson bugpr...@us.ibm.com Signed-off-by: Oleg Nesterov o

Re: [PATCH] utrace_barrier(detached_engine) must not sping without checking -reporting

2010-10-25 Thread Oleg Nesterov
On 10/22, Oleg Nesterov wrote: On 10/19, Roland McGrath wrote: Yes. But, with this patch, in this case utrace_barrier()-get_utrace_lock(attached = false) returns success and then we check utrace-reporting == engine. I guess that's OK if -reporting == engine is always set when any

Re: [PATCH] utrace: utrace_reset() should clear TIF_SINGLESTEP if no more engines

2010-10-22 Thread Oleg Nesterov
On 10/22, Roland McGrath wrote: Hmm. If task is not stopped then it is current (except utrace_control(DETACH) can play with the dying task). Right, asynchronous detach was the problematic case I was concerned with. but asynchronous detach doesn't do utrace_reset(), unless the tracee is

Re: utrace unwanted traps

2010-10-21 Thread Oleg Nesterov
On 10/19, Roland McGrath wrote: But that's how it used to be, and then we changed it. So it merits digging up our old discussion threads that led to doing that and see what all we had in mind then. I tried to grep my mail archives and google, but failed to find anything related.

Re: utrace unwanted traps

2010-10-19 Thread Oleg Nesterov
On 10/14, Roland McGrath wrote: In short: I no longer understand why utrace-resume can be UTRACE_*STEP when the tracee is stopped, and in fact I think this is not right. I think we didn't have that originally. Yes. The rationale that I remember is the idea that you should be able to

Re: [PATCH] utrace_barrier(detached_engine) must not sping without checking -reporting

2010-10-15 Thread Oleg Nesterov
On 10/12, Roland McGrath wrote: If engine is detached (has utrace_detached_ops), utrace_barrier(engine) spins until engine-ops becomes NULL. This is just wrong. Yes, this happens because get_utrace_lock returns -ERESTARTSYS and utrace_barrier checks for this and loops. I agree these

Re: gdbstub initial code, v7

2010-10-15 Thread Oleg Nesterov
On 10/13, Roland McGrath wrote: On 09/10, Roland McGrath wrote: ugdb sets please stop flag and does utrace_control(INTERRUPT). However, in unlikely case the tracee can stop before -report_signal() reporting I don't think this is the right thing to do. When the intent is

[PATCH] utrace: utrace_resume()-start_callback() must clear -reporting

2010-10-12 Thread Oleg Nesterov
(). If it is zero we can just clear -spurious and return without playing with -reporting and -flags. No need to worry about ENGINE_STOP, finish_callback() has already updated engine-flags and report-action correctly. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c |8 +++- 1

Re: [PATCH?] avoid the unnecessary utrace_resume()-utrace_reset()

2010-10-11 Thread Oleg Nesterov
On 08/18, Oleg Nesterov wrote: utrace_resume(UTRACE_REPORT) always calls utrace_reset() because start_callback() obviously can't clear report-spurious when event == 0. Change start_callback() to correctly clear -spurious in this case. Correctly? I am stupid, and this patch is wrong

Re: gdbstub initial code, v13

2010-10-11 Thread Oleg Nesterov
On 10/08, Oleg Nesterov wrote: - full vCont support. Well, this was easy, except even after 3 hours of debugging I can't understand why this change breaks the stepping over pthread_create :/ Oh, it doesn't break. I did a lot of mistakes when I was trying

Re: BUG: gdb notification packets (Was: gdbstub initial code, v12)

2010-10-06 Thread Oleg Nesterov
On 10/05, Pedro Alves wrote: (reordered) On Tuesday 05 October 2010 18:27:29, Oleg Nesterov wrote: So, I strongly believe gdb is buggy and should be fixed. Fix your stub to implement vCont;s/c(/S/C). First of all, I confirm that when I added the (incomplete right now) support for vCont;s

utrace unwanted traps

2010-09-26 Thread Oleg Nesterov
On 09/23, Roland McGrath wrote: OK, finish_callback_report() and utrace_control(DETACH) can set TIF_NOTIFY_RESUME. Right. Those utrace_resume has the report.action==UTRACE_RESUME bail-out case. So either that would change or detach would also do UTRACE_REPORT. But what if there are no

Re: gdbstub initial code, v11

2010-09-22 Thread Oleg Nesterov
On 09/22, Frank Ch. Eigler wrote: oleg wrote: [...] Honestly, I don't really know how do the right thing here. Anyway, most probably this code will be changed. Like ptrace, ugdb uses -report_syscall_exit() to synthesize a trap. Unlike ptrace, ugdb_report_signal() doesn't send SIGTRAP

Re: [PATCH] utrace: utrace_reset() should clear TIF_SINGLESTEP if no more engines

2010-09-22 Thread Oleg Nesterov
On 09/21, Roland McGrath wrote: OK, so what should we do for now? If we can't come to a straightforward answer for the general case fairly quickly, then we can do the simple change to start with. I think we should start with changing utrace_control(DETACH) anyway, then try to improve. I'll

Re: [PATCH] utrace: utrace_reset() should clear TIF_SINGLESTEP if no more engines

2010-09-22 Thread Oleg Nesterov
On 09/23, Oleg Nesterov wrote: On 09/21, Roland McGrath wrote: It's better to have a spurious report (preferably just spurious TIF_NOTIFY_RESUME with no actual callbacks) following any detach, or whatever it takes to ensure user_disable_single_step() always runs if user_enable_*_step

Re: [PATCH] utrace: utrace_reset() should clear TIF_SINGLESTEP if no more engines

2010-09-21 Thread Oleg Nesterov
On 09/21, Roland McGrath wrote: Change utrace_reset() to do user_disable_single_step(). Alternatively we could change ptrace layer, but I think this is not ptrace specific. Yes, it's right to fix this in the utrace layer. But I'm not sure that's the right place in the code to fix it. The

Re: [PATCH] utrace: utrace_reset() should clear TIF_SINGLESTEP if no more engines

2010-09-21 Thread Oleg Nesterov
On 09/21, Roland McGrath wrote: I was worried about the case when the TIF_SINGLESTEP tracee detaches itself and escapes finish_resume_report()-user_disable_single_step(), say, utrace_report_exec(). But probably we can ignore this. No, I think that is indeed a problem. If no engine is

Re: [PATCH] utrace: utrace_reset() should clear TIF_SINGLESTEP if no more engines

2010-09-21 Thread Oleg Nesterov
On 09/22, Oleg Nesterov wrote: On 09/21, Roland McGrath wrote: I was worried about the case when the TIF_SINGLESTEP tracee detaches itself and escapes finish_resume_report()-user_disable_single_step(), say, utrace_report_exec(). But probably we can ignore this. No, I think

gdbstub initial code, v11

2010-09-21 Thread Oleg Nesterov
Changes: syscall stepping + minor cleanups. Seems to work, more or less, but surely there are some bugs. Honestly, I don't really know how do the right thing here. Anyway, most probably this code will be changed. Like ptrace, ugdb uses -report_syscall_exit() to synthesize a trap. Unlike ptrace,

[PATCH] utrace: utrace_reset() should clear TIF_SINGLESTEP if no more engines

2010-09-20 Thread Oleg Nesterov
. Change utrace_reset() to do user_disable_single_step(). Alternatively we could change ptrace layer, but I think this is not ptrace specific. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c |1 + 1 file changed, 1 insertion(+) --- kstub/kernel/utrace.c

gdbstub initial code, v10

2010-09-19 Thread Oleg Nesterov
Back to ugdb. Changes: implement stepi, this also means breakpoints work too. Notes: - almost untested, probably needs more fixes - syscall-stepping doesn't work correctly (should be simple) - don't look at handle_setregs/handle_set_one_reg, I did this on

Re: exit_ptrace() ptrace_report_signal() problems

2010-09-15 Thread Oleg Nesterov
On 09/14, Oleg Nesterov wrote: Oh, please take a look at this (untested) patch. I tried to test the cleanuped version, seems to work. But I think I should make another attempt, probably spinlock (-siglock ?) would be cleaner. No. I think more locking buys nothing. I'll split this patch

Re: exit_ptrace() ptrace_report_signal() problems

2010-09-14 Thread Oleg Nesterov
On 09/14, Oleg Nesterov wrote: On 09/13, Roland McGrath wrote: Locks just between the tracer and ptrace_report_signal are not bad. OK, but let me think a bit more. I'd really like to avoid adding the new lock to avoid the very unlikely race with the exiting tracer. Oh, please take a look

Re: gdbstub initial code, v9

2010-09-10 Thread Oleg Nesterov
On 09/10, Roland McGrath wrote: Oleg == Oleg Nesterov o...@redhat.com writes: Oleg (gdb) set var 0 You need: set variable var = 0 The variable can be abbreviated. I've always just used: (gdb) set var=0 No, I tried this too, doesn't work. (gdb) set var=0

Re: gdbstub initial code, v7

2010-09-10 Thread Oleg Nesterov
On 09/10, Roland McGrath wrote: But I meant another case, when the stopped tracee doesn't have siginfo. Currently ugdb just sends this signal to tracee, and then it will be reported to gdb. Not sure if this is right or not, I can change this. (or perhap this doesn't matter, I dunno).

Re: gdbstub initial code, v8 ptrace

2010-09-10 Thread Oleg Nesterov
On 09/10, Roland McGrath wrote: I am a bit confused... OK, ugdb is wrong wrt multitracing. UTRACE_SIGNAL_REPORT case shouldn't return UTRACE_STOP | UTRACE_SIGNAL_IGN, it should return UTRACE_STOP | UTRACE_SIGNAL_REPORT to keep report-result. No, UTRACE_SIGNAL_REPORT is not meant for

Re: gdbstub initial code, v7

2010-09-10 Thread Oleg Nesterov
On 09/10, Roland McGrath wrote: ugdb sets please stop flag and does utrace_control(INTERRUPT). However, in unlikely case the tracee can stop before -report_signal() reporting I don't think this is the right thing to do. When the intent is explicitly to interrupt, there is no reason to

Re: gdbstub initial code, v9

2010-09-09 Thread Oleg Nesterov
On 09/09, Frank Ch. Eigler wrote: Oleg Nesterov o...@redhat.com writes: [...] But, Jan. Implementing the memory writes does not mean breakpoints automatically start to work! It approximately should though. Yes, gdb writes cc, and yes the tracee reports SIGTRAP. But after

Re: gdbstub initial code, v9

2010-09-09 Thread Oleg Nesterov
On 09/09, Oleg Nesterov wrote: the tracee hits this bp and reports SIGTRAP = vStopped = OK = g = 00064000401f207d007f00... = P10=ba054000

gdbstub initial code, v9

2010-09-08 Thread Oleg Nesterov
Changes: - partly fix the multitracing problems. ugdb still can't work with ptrace, ptrace-utrace.c needs changes. But at least multiple udgb tracers can coexist, more or less. But of course they can confuse each other anyway, no matter

Re: gdbstub initial code, v8

2010-09-08 Thread Oleg Nesterov
On 09/06, Frank Ch. Eigler wrote: Oleg Nesterov o...@redhat.com writes: [...] Therefore until you track some ugdb-specific software(*) breakpoints ugdb does not need to support Z0 IMO. I guess ugdb will never have to support these: thread-related(?) and tracepoint ones. Good! I

Re: [PATCH 0/3] UTRACE_DETACH fixes

2010-09-06 Thread Oleg Nesterov
On 09/03, Roland McGrath wrote: So, it is technically kosher enough to use UTRACE_INTERRUPT without UTRACE_EVENT(QUIESCE) set, if you really know the situation and are sure about all those caveats above. How? see below. I mentioned the examples. I misunderstood the

Re: gdbstub initial code, v8

2010-09-06 Thread Oleg Nesterov
On 09/05, Jan Kratochvil wrote: On Sat, 04 Sep 2010 00:40:47 +0200, Oleg Nesterov wrote: - implement qXfer:siginfo:read - implement continue with signal. OK, thanks, just it was a bit premature to ask for it I see. I miss at least memory writes Yes. This is simple. (also

Re: gdbstub initial code, v8

2010-09-06 Thread Oleg Nesterov
On 09/06, Jan Kratochvil wrote: On Mon, 06 Sep 2010 20:18:08 +0200, Oleg Nesterov wrote: On 09/05, Jan Kratochvil wrote: (also to put in breakpoints): And this is not clear to me, I need your help ;) Sorry, I just meant that by implementing the memory writes breakpoints

Re: gdbstub initial code, v7

2010-09-02 Thread Oleg Nesterov
Sorry for the delay, I was distracted. Trying to switch back to ugdb. On 08/31, Jan Kratochvil wrote: ugdb should support qXfer:siginfo, currently accessible only via $_siginfo print/set, though. Still sure this feature should be also implemented one day. Yes sure. This should be simple,

Re: [PATCH 0/3] UTRACE_DETACH fixes

2010-09-02 Thread Oleg Nesterov
I was going to ping you ;) This is connected to the problem I hit today. Despite the fact I already complained about utrace_get_signal() QUIESCE, I forgot about this and figured out it doesn't work in practice. On 09/02, Roland McGrath wrote: If an engine used UTRACE_INTERRUPT without having

gdbstub initial code, v7

2010-08-30 Thread Oleg Nesterov
Changes: - report signals. A bit more code changes than I expected. - implement QPassSignals, trivial. Note: $CSIG is not supported yet, and I am not sure I understand how it should work. Next time... #include linux/module.h #include linux/proc_fs.h #include linux/utrace.h

gdbstub initial code, v6

2010-08-27 Thread Oleg Nesterov
Changes: - adapt to no more utrace changes. Whatever I think about utrace I have to agree, it is not practical to change utrace now - attach to the thread-group with the dead leader - fix the double-attaching bug - do not assume we can trust

Re: [PATCH 3/4] utrace_set_events: fix UTRACE_EVENT(REAP) case

2010-08-26 Thread Oleg Nesterov
On 08/19, Roland McGrath wrote: On 08/16, Roland McGrath wrote: Now that you merged c93fecc925ea7567168f0c94414b9021de2708c5 get_utrace_lock() must not succeed if utrace-reap == T, this becomes a bit off-topic. However, I thought about relaxing the dead check in get_utrace_lock(),

Re: [PATCH 2/3] fix utrace_control(DETACH) utrace-death interaction

2010-08-26 Thread Oleg Nesterov
On 08/19, Roland McGrath wrote: Wait. It doesn't break this. It only breaks -EALREADY contract. And I don't understand why this is bad. The -EALREADY contract lets you have a report_death callback that does all your cleanup and then returns UTRACE_DETACH. I think this is possible without

Re: [PATCH 0/3] UTRACE_DETACH fixes

2010-08-26 Thread Oleg Nesterov
On 08/19, Roland McGrath wrote: OK, instead of filling utrace_detached_ops{} we can change start_callback() - if (want UTRACE_EVENT(QUIESCE)) { + if ((want UTRACE_EVENT(QUIESCE)) || ops == detached_ops) { If we're going to have a special-case check for utrace_detached_ops,

Re: [PATCH] fix mark_engine_detached() vs start_callback() race

2010-08-26 Thread Oleg Nesterov
On 08/19, Roland McGrath wrote: I think in the longer term mark_engine_detached() should not change engine-flags at all but add QUIESCE to -utrace_flags. However, this breaks utrace_maybe_reap(reap = true) and we should avoid the race with finish_callback() which clears -reporting after

Re: gdbstub initial code, v5

2010-08-24 Thread Oleg Nesterov
On 08/23, Oleg Nesterov wrote: However. I spent all Monday trying to resolve the new bug, and so far I do not understand what happens. Extremely hard to reproduce, and the kernel just hangs silently, without any message. So far I suspect the proble in utrace.c, but this time I am not sure

Re: gdbstub initial code, v5

2010-08-23 Thread Oleg Nesterov
Just a small report to explain what I am doing... On 08/20, Oleg Nesterov wrote: - I forgot to implement the attach to the thread group with the dead leader. Next time. Almost done, but we should avoid the races with exec somehow. But this is minor. I tried to test this code

gdbstub initial code, v5

2010-08-20 Thread Oleg Nesterov
On 08/19, Oleg Nesterov wrote: Next step: handle exit correctly and report W/S. I misunderstood what gdbserver does when the main thread exits, it is not stupid as I wrongly thought. Yes, in non-stop mode gdbserver reports W/X;process:PID when the last thread exits. This makes sense, so does

Re: gdbstub initial code, v4

2010-08-20 Thread Oleg Nesterov
On 08/19, Roland McGrath wrote: Note the second attachment, GDBCAT. It is just the simple perl script which connects /proc/ugdb to tcp port. It can be used for remote debugging via tcp, or with (unpatched) gdb which can't do select() on /proc/ugdb. bash$ nc -l 2000 /proc/ugdb Yes,

Re: [PATCH 2/3] fix utrace_control(DETACH) utrace-death interaction

2010-08-18 Thread Oleg Nesterov
On 08/17, Oleg Nesterov wrote: On 08/16, Roland McGrath wrote: The problem is, utrace_control(DETACH) does nothing and returns -EALREADY if utrace-death is set, this is not right. We can and should detach in this case, we only should skip utrace_reset() to avoid the race

[PATCH] fix mark_engine_detached() vs start_callback() race

2010-08-18 Thread Oleg Nesterov
finish_callback() should check engine-ops == utrace_detached_ops before return. Instead we should change finish_callback_report() to return the boolean. We shouldn't return true without setting report-detaches. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c |2 +- 1 file changed, 1

[PATCH?] avoid the unnecessary utrace_resume()-utrace_reset()

2010-08-18 Thread Oleg Nesterov
utrace_flags UTRACE_EVENT(QUIESCE) and returns otherwise. This should be fixed somehow. This check is wrong anyway, but it is not clear how we can fix the race with DETACH. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c |2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH 3/4] utrace_set_events: fix UTRACE_EVENT(REAP) case

2010-08-17 Thread Oleg Nesterov
On 08/16, Roland McGrath wrote: - It is possible that both -death and -reap are true. In this case it is OK to clear UTRACE_EVENT(REAP), but set_events fails. No, it's not OK to clear it. Once -reap is set, then the engine's ops-report_reap might or might not have been called

Re: [PATCH 2/4] utrace_set_events: consolidate setting _UTRACE_DEATH_EVENTS checks

2010-08-17 Thread Oleg Nesterov
On 08/16, Roland McGrath wrote: In short: this double check allows to avoid tasklist when utrace_flags already has these bits while engine-flags doesn't. But multitracing is unlikely case, in the likely case if we add _UTRACE_DEATH_EVENTS to engine-flags we set these bits in

Re: [PATCH 0/3] UTRACE_DETACH fixes

2010-08-17 Thread Oleg Nesterov
On 08/17, Oleg Nesterov wrote: Suppose that, say, engine-flags == UTRACE_EVENT(EXEC) (no QUIESCE). 1. start_callback() reads want = engine-flags (== EXEC) 2. mark_engine_detached() sets engine-ops = utrace_detached_ops 3. start_callback() gets ops = utrace_detached_ops

[PATCH 2/3] fix utrace_control(DETACH) utrace-death interaction

2010-08-16 Thread Oleg Nesterov
in this case, but it doesn't hurt. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c | 49 ++--- 1 file changed, 10 insertions(+), 39 deletions(-) --- kstub/kernel/utrace.c~6_fix_control_dead2010-08-16 11:17:05.0 +0200

[PATCH 3/3] utrace_set_events: kill now unnecessary exit_state/reap checks

2010-08-16 Thread Oleg Nesterov
Now that get_utrace_lock() can never succeed if utrace-reap is true, we can kill this check in utrace_set_events(). This also means we can kill the target-exit_state check, it buys nothing now. Signed-off-by: Oleg Nesterov o...@redhat.com --- kernel/utrace.c | 13 - 1 file changed

Re: [PATCH 0/3] UTRACE_DETACH fixes

2010-08-16 Thread Oleg Nesterov
On 08/16, Oleg Nesterov wrote: Well, I tried to test these changes, seems to work. But... From 2/3 changelog: This means that mark_engine_detached() can race with REPORT_CALLBACKS() but there is nothing new. Yes, there is nothing new. But, Roland, this is WRONG

  1   2   3   4   5   6   >