All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 6/8] ARM64: Handle TRAP_HWBRKPT for user mode as well
Date: Thu, 8 Jan 2015 17:01:52 +0000	[thread overview]
Message-ID: <20150108170152.GS11583@arm.com> (raw)
In-Reply-To: <20150102180523.GC6761@redhat.com>

On Fri, Jan 02, 2015 at 06:05:23PM +0000, Oleg Nesterov wrote:
> Let me repeat once again that I know absolutely nothing about arm* ;)
> 
> On 12/31, Pratyush Anand wrote:
> >
> > uprobe registers a handler at step_hook. So, single_step_handler now
> > checks for user mode as well if there is a valid hook.
> >
> > Signed-off-by: Pratyush Anand <panand@redhat.com>
> > ---
> >  arch/arm64/kernel/debug-monitors.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
> > index b056369fd47d..2676b8655241 100644
> > --- a/arch/arm64/kernel/debug-monitors.c
> > +++ b/arch/arm64/kernel/debug-monitors.c
> > @@ -236,6 +236,9 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
> >  	if (!reinstall_suspended_bps(regs))
> >  		return 0;
> >
> > +	if (call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
> > +		return 0;
> > +
> >  	if (user_mode(regs)) {
> >  		info.si_signo = SIGTRAP;
> >  		info.si_errno = 0;
> > @@ -251,9 +254,6 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
> >  		 */
> >  		user_rewind_single_step(current);
> >  	} else {
> > -		if (call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
> > -			return 0;
> > -
> 
> Agreed, we need something like this change...
> 
> But did you verify that it can't break other users of register_step_hook() ?
> The current handlers do not check user_mode() == F, they assume that they
> can't be called otherwise.
> 
> If this all is correct, please explain why in the changelog.

I think you're right, and kgdb will need fixing with this change.

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Pratyush Anand <panand@redhat.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
	"tixy@linaro.org" <tixy@linaro.org>,
	"ananth@in.ibm.com" <ananth@in.ibm.com>,
	"sandeepa.prabhu@linaro.org" <sandeepa.prabhu@linaro.org>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"anil.s.keshavamurthy@intel.com" <anil.s.keshavamurthy@intel.com>,
	"masami.hiramatsu.pt@hitachi.com"
	<masami.hiramatsu.pt@hitachi.com>,
	"wcohen@redhat.com" <wcohen@redhat.com>
Subject: Re: [RFC 6/8] ARM64: Handle TRAP_HWBRKPT for user mode as well
Date: Thu, 8 Jan 2015 17:01:52 +0000	[thread overview]
Message-ID: <20150108170152.GS11583@arm.com> (raw)
In-Reply-To: <20150102180523.GC6761@redhat.com>

On Fri, Jan 02, 2015 at 06:05:23PM +0000, Oleg Nesterov wrote:
> Let me repeat once again that I know absolutely nothing about arm* ;)
> 
> On 12/31, Pratyush Anand wrote:
> >
> > uprobe registers a handler at step_hook. So, single_step_handler now
> > checks for user mode as well if there is a valid hook.
> >
> > Signed-off-by: Pratyush Anand <panand@redhat.com>
> > ---
> >  arch/arm64/kernel/debug-monitors.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
> > index b056369fd47d..2676b8655241 100644
> > --- a/arch/arm64/kernel/debug-monitors.c
> > +++ b/arch/arm64/kernel/debug-monitors.c
> > @@ -236,6 +236,9 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
> >  	if (!reinstall_suspended_bps(regs))
> >  		return 0;
> >
> > +	if (call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
> > +		return 0;
> > +
> >  	if (user_mode(regs)) {
> >  		info.si_signo = SIGTRAP;
> >  		info.si_errno = 0;
> > @@ -251,9 +254,6 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
> >  		 */
> >  		user_rewind_single_step(current);
> >  	} else {
> > -		if (call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
> > -			return 0;
> > -
> 
> Agreed, we need something like this change...
> 
> But did you verify that it can't break other users of register_step_hook() ?
> The current handlers do not check user_mode() == F, they assume that they
> can't be called otherwise.
> 
> If this all is correct, please explain why in the changelog.

I think you're right, and kgdb will need fixing with this change.

Will

  reply	other threads:[~2015-01-08 17:01 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-31 15:21 [RFC 0/8] ARM64: Uprobe support added Pratyush Anand
2014-12-31 15:21 ` Pratyush Anand
2014-12-31 15:21 ` [RFC 1/8] ARM64: Move BRK opcodes defines from kprobes.h to insn.h Pratyush Anand
2015-01-08 16:55   ` Will Deacon
2015-01-08 16:55     ` Will Deacon
2015-01-08 17:31     ` Pratyush Anand
2015-01-08 17:31       ` Pratyush Anand
2014-12-31 15:21 ` [RFC 2/8] ARM64: Refactor kprobes-arm64 Pratyush Anand
2015-01-08 16:55   ` Will Deacon
2015-01-08 16:55     ` Will Deacon
2015-01-08 17:33     ` Pratyush Anand
2015-01-08 17:33       ` Pratyush Anand
2015-01-08 17:36       ` Will Deacon
2015-01-08 17:36         ` Will Deacon
2015-01-08 17:39         ` Pratyush Anand
2015-01-08 17:39           ` Pratyush Anand
2014-12-31 15:21 ` [RFC 3/8] Kernel/uprobe: Define arch_uprobe_exception_notify as __weak Pratyush Anand
2015-01-02 17:43   ` Oleg Nesterov
2015-01-02 17:43     ` Oleg Nesterov
2015-01-04 13:50     ` Pratyush Anand
2015-01-04 13:50       ` Pratyush Anand
2014-12-31 15:21 ` [RFC 4/8] ARM64: Add instruction_pointer_set function Pratyush Anand
2015-01-08 16:59   ` Will Deacon
2015-01-08 16:59     ` Will Deacon
2015-01-09  5:18     ` Pratyush Anand
2015-01-09  5:18       ` Pratyush Anand
2014-12-31 15:21 ` [RFC 5/8] ARM64: Re-factor flush_ptrace_access Pratyush Anand
2015-01-02 17:51   ` Oleg Nesterov
2015-01-02 17:51     ` Oleg Nesterov
2015-01-02 18:19     ` Oleg Nesterov
2015-01-02 18:19       ` Oleg Nesterov
2015-01-04 13:50       ` Pratyush Anand
2015-01-04 13:50         ` Pratyush Anand
2014-12-31 15:21 ` [RFC 6/8] ARM64: Handle TRAP_HWBRKPT for user mode as well Pratyush Anand
2015-01-02 18:05   ` Oleg Nesterov
2015-01-02 18:05     ` Oleg Nesterov
2015-01-08 17:01     ` Will Deacon [this message]
2015-01-08 17:01       ` Will Deacon
2015-01-08 17:51       ` Pratyush Anand
2015-01-08 17:51         ` Pratyush Anand
2014-12-31 15:21 ` [RFC 7/8] ARM64: Handle TRAP_BRKPT " Pratyush Anand
2014-12-31 15:21 ` [RFC 8/8] ARM64: Add uprobe support Pratyush Anand
2015-01-02 17:23   ` Oleg Nesterov
2015-01-02 17:23     ` Oleg Nesterov
2015-01-04 13:49     ` Pratyush Anand
2015-01-04 13:49       ` Pratyush Anand
2015-01-04 18:40       ` Oleg Nesterov
2015-01-04 18:40         ` Oleg Nesterov
2015-01-05  4:17         ` Pratyush Anand
2015-01-05  4:17           ` Pratyush Anand
2015-01-08 17:03   ` Will Deacon
2015-01-08 17:03     ` Will Deacon
2015-01-08 17:54     ` Pratyush Anand
2015-01-08 17:54       ` Pratyush Anand
2015-01-09 17:45       ` Oleg Nesterov
2015-01-09 17:45         ` Oleg Nesterov
2015-01-12  4:50         ` Pratyush Anand
2015-01-12  4:50           ` Pratyush Anand
2015-01-09 17:59   ` Oleg Nesterov
2015-01-09 17:59     ` Oleg Nesterov
2015-01-12  5:04     ` Pratyush Anand
2015-01-12  5:04       ` Pratyush Anand
2015-01-12  6:45       ` Pratyush Anand
2015-01-12  6:45         ` Pratyush Anand
2015-01-12 14:38         ` Oleg Nesterov
2015-01-12 14:38           ` Oleg Nesterov
2015-01-12 14:28       ` Oleg Nesterov
2015-01-12 14:28         ` Oleg Nesterov
2015-01-01  1:59 ` [RFC 0/8] ARM64: Uprobe support added Pratyush Anand
2015-01-01  1:59   ` Pratyush Anand

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=20150108170152.GS11583@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.