From: Oleg Nesterov <oleg@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Roland McGrath <roland@redhat.com>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
stan_shebs@mentor.com
Subject: Re: [PATCH v3] x86/uprobes: implement x86 specific arch_uprobe_*_step
Date: Wed, 29 Aug 2012 19:37:48 +0200 [thread overview]
Message-ID: <20120829173748.GA1121@redhat.com> (raw)
In-Reply-To: <20120822155943.GA4237@redhat.com>
On 08/22, Oleg Nesterov wrote:
>
> > Ehm. Is there anything I missed to do? Or are you speculating on
> > changes which will clash with these here?
>
> If we have task_set_blockstep(), then perhaps it mmakes sense to
> avoid user_enable_singlestep()/TIF_SINGLESTEP from the start.
> We will see.
But it is not clear when we will have task_set_blockstep.
So I am starting to think it would be better to apply your 1-2 and
change the code later. Still not correct, but better than nothing.
But. The more I think about the current code, the more I dislike it.
And I am starting to think we do not need yet another "weak arch*"
hook for single-stepping. Yes, it was me who suggested it, but this
is because I didn't want to complicate the merging of powerpc port.
However.
Ananth, Sebastian, what if we start with the patch below? Then
we can change arch/x86/kernel/uprobes.c to use the static
uprobe_*_step() helpers from the 2nd patch.
If we agree this code should be per-arch, then why do need other
hooks? This is just ugly, we already have arch_pre/post_xol.
The only problem is the pending powerpc patches, the change below
obviously breaks them. Were they already applied? If not, then
probably Ananth can do v6 on top of the patch below ;) The necessary
fixup is trivial.
What do you think?
Oleg.
--- x/kernel/events/uprobes.c
+++ x/kernel/events/uprobes.c
@@ -1440,10 +1440,8 @@ static void handle_swbp(struct pt_regs *
goto cleanup_ret;
utask->state = UTASK_SSTEP;
- if (!pre_ssout(uprobe, regs, bp_vaddr)) {
- user_enable_single_step(current);
+ if (!pre_ssout(uprobe, regs, bp_vaddr))
return;
- }
cleanup_ret:
if (utask) {
@@ -1480,7 +1478,6 @@ static void handle_singlestep(struct upr
put_uprobe(uprobe);
utask->active_uprobe = NULL;
utask->state = UTASK_RUNNING;
- user_disable_single_step(current);
xol_free_insn_slot(current);
spin_lock_irq(¤t->sighand->siglock);
--- x/arch/x86/kernel/uprobes.c
+++ x/arch/x86/kernel/uprobes.c
@@ -471,6 +471,7 @@ int arch_uprobe_pre_xol(struct arch_upro
regs->ip = current->utask->xol_vaddr;
pre_xol_rip_insn(auprobe, regs, autask);
+ user_enable_single_step(current);
return 0;
}
@@ -596,6 +597,7 @@ int arch_uprobe_post_xol(struct arch_upr
if (auprobe->fixups & UPROBE_FIX_CALL)
result = adjust_ret_addr(regs->sp, correction);
+ user_disable_single_step(current);
return result;
}
@@ -640,6 +642,7 @@ void arch_uprobe_abort_xol(struct arch_u
current->thread.trap_nr = utask->autask.saved_trap_nr;
handle_riprel_post_xol(auprobe, regs, NULL);
instruction_pointer_set(regs, utask->vaddr);
+ user_disable_single_step(current);
}
/*
next prev parent reply other threads:[~2012-08-29 17:35 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-07 16:12 uprobe: single step over uprobe & global breakpoints Sebastian Andrzej Siewior
2012-08-07 16:12 ` [PATCH 1/5] uprobes: Use a helper instead of ptrace's single step enable Sebastian Andrzej Siewior
2012-08-07 16:12 ` [PATCH 2/5] x86/uprobes: implement x86 specific arch_uprobe_*_step Sebastian Andrzej Siewior
2012-08-08 12:57 ` Oleg Nesterov
2012-08-08 13:17 ` Sebastian Andrzej Siewior
2012-08-08 14:53 ` Oleg Nesterov
2012-08-08 15:02 ` Sebastian Andrzej Siewior
2012-08-09 4:43 ` Ananth N Mavinakayanahalli
2012-08-09 17:09 ` [PATCH v2 " Sebastian Andrzej Siewior
2012-08-13 13:24 ` Oleg Nesterov
2012-08-14 8:28 ` Sebastian Andrzej Siewior
2012-08-14 14:27 ` Oleg Nesterov
2012-08-20 10:47 ` [PATCH v3] " Sebastian Andrzej Siewior
2012-08-22 14:03 ` Oleg Nesterov
2012-08-22 14:11 ` Sebastian Andrzej Siewior
2012-08-22 15:59 ` Oleg Nesterov
2012-08-29 17:37 ` Oleg Nesterov [this message]
2012-08-30 8:47 ` Ananth N Mavinakayanahalli
2012-08-30 11:18 ` [PATCH] x86/uprobes: don't disable single stepping if it was already on Sebastian Andrzej Siewior
2012-08-30 14:37 ` [PATCH v3] x86/uprobes: implement x86 specific arch_uprobe_*_step Oleg Nesterov
2012-08-30 15:03 ` Ananth N Mavinakayanahalli
2012-08-30 15:11 ` Oleg Nesterov
2012-08-07 16:12 ` [PATCH 3/5] uprobes: remove check for uprobe variable in handle_swbp() Sebastian Andrzej Siewior
2012-08-08 9:10 ` Suzuki K. Poulose
2012-08-08 9:35 ` Sebastian Andrzej Siewior
2012-08-10 5:23 ` Suzuki K. Poulose
2012-08-08 12:58 ` Oleg Nesterov
2012-08-07 16:12 ` [PATCH 4/5] uprobes: probe definiton can only start with 'p' and '-' Sebastian Andrzej Siewior
2012-08-07 16:12 ` [RFC 5/5] uprobes: add global breakpoints Sebastian Andrzej Siewior
2012-08-08 13:14 ` Oleg Nesterov
2012-08-09 17:18 ` Sebastian Andrzej Siewior
2012-08-13 13:16 ` Oleg Nesterov
2012-08-14 11:43 ` Sebastian Andrzej Siewior
2012-08-13 11:34 ` Peter Zijlstra
2012-08-20 15:26 ` Sebastian Andrzej Siewior
2012-08-21 19:42 ` [RFC 5/5 v2] " Sebastian Andrzej Siewior
2012-08-22 13:48 ` Oleg Nesterov
2012-08-27 18:56 ` Sebastian Andrzej Siewior
2012-08-29 15:49 ` Oleg Nesterov
2012-08-30 20:42 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120829173748.GA1121@redhat.com \
--to=oleg@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=ananth@in.ibm.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=srikar@linux.vnet.ibm.com \
--cc=stan_shebs@mentor.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).