public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Paul Mundt <lethal@linux-sh.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Will Deacon <will.deacon@arm.com>,
	Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>,
	"K . Prasad" <prasad@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Jason Wessel <jason.wessel@windriver.com>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 3/6] hw-breakpoints: Change/Enforce some breakpoints policies
Date: Sat, 1 May 2010 03:36:13 +0200	[thread overview]
Message-ID: <20100501013611.GD5357@nowhere> (raw)
In-Reply-To: <20100423093234.GC11770@linux-sh.org>

On Fri, Apr 23, 2010 at 06:32:35PM +0900, Paul Mundt wrote:
> On Fri, Apr 23, 2010 at 07:13:56AM +0200, Frederic Weisbecker wrote:
> > diff --git a/arch/sh/kernel/hw_breakpoint.c b/arch/sh/kernel/hw_breakpoint.c
> > index 675eea7..2d44a2d 100644
> > --- a/arch/sh/kernel/hw_breakpoint.c
> > +++ b/arch/sh/kernel/hw_breakpoint.c
> > @@ -120,25 +120,16 @@ static int get_hbp_len(u16 hbp_len)
> >  }
> >  
> >  /*
> > - * Check for virtual address in user space.
> > - */
> > -int arch_check_va_in_userspace(unsigned long va, u16 hbp_len)
> > -{
> > -	unsigned int len;
> > -
> > -	len = get_hbp_len(hbp_len);
> > -
> > -	return (va <= TASK_SIZE - len);
> > -}
> > -
> > -/*
> >   * Check for virtual address in kernel space.
> >   */
> 
> We were also using the va_in_userspace check for the case of signal
> delivery, so I've just inverted the test for that. Perhaps there's a
> cleaner way to handle it, though.


That looks fine. I wonder if I can assume that such tests, that
are the same between x86 and Sh, can apply to every archs, in which
case I could move that to the generic code.


> 
> Other than that, everything seems to work ok. The ksym tracer and ptrace
> tests still pass at least. Feel free to add my Tested/Acked-by on the
> rest if you're respinning it at some point.
> 
> Signed-off-by: Paul Mundt <lethal@linux-sh.org>


Great, I'll then merge this fix to the appropriate patch and
add the appropriate tags.

Thanks Paul!



> 
> ---
> 
> diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h
> index 4d5e514..89890f6 100644
> --- a/arch/sh/include/asm/hw_breakpoint.h
> +++ b/arch/sh/include/asm/hw_breakpoint.h
> @@ -54,8 +54,6 @@ static inline int hw_breakpoint_slots(int type)
>  /* arch/sh/kernel/hw_breakpoint.c */
>  extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
>  extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
> -extern int arch_validate_hwbkpt_settings(struct perf_event *bp,
> -					 struct task_struct *tsk);
>  extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
>  					   unsigned long val, void *data);
>  
> diff --git a/arch/sh/kernel/hw_breakpoint.c b/arch/sh/kernel/hw_breakpoint.c
> index 67564e3..efae6ab 100644
> --- a/arch/sh/kernel/hw_breakpoint.c
> +++ b/arch/sh/kernel/hw_breakpoint.c
> @@ -344,8 +344,7 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
>  		perf_bp_event(bp, args->regs);
>  
>  		/* Deliver the signal to userspace */
> -		if (arch_check_va_in_userspace(bp->attr.bp_addr,
> -					       bp->attr.bp_len)) {
> +		if (!arch_check_bp_in_kernelspace(bp)) {
>  			siginfo_t info;
>  
>  			info.si_signo = args->signr;


  reply	other threads:[~2010-05-01  1:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23  5:13 [PATCH 0/6] hw-breakpoints updates Frederic Weisbecker
2010-04-23  5:13 ` [PATCH 1/6] hw-breakpoints: Tag ptrace breakpoint as exclude_kernel Frederic Weisbecker
2010-04-23  5:13 ` [PATCH 2/6] hw-breakpoints: Check disabled breakpoints again Frederic Weisbecker
2010-04-23  5:13 ` [PATCH 3/6] hw-breakpoints: Change/Enforce some breakpoints policies Frederic Weisbecker
2010-04-23  5:21   ` Frederic Weisbecker
2010-04-23  8:37   ` Paul Mundt
2010-04-23  9:32   ` Paul Mundt
2010-05-01  1:36     ` Frederic Weisbecker [this message]
2010-04-23  5:13 ` [PATCH 4/6] hw-breakpoints: Separate constraint space for data and instruction breakpoints Frederic Weisbecker
2010-04-23  5:13 ` [PATCH 5/6] hw-breakpoints: Handle breakpoint weight in allocation constraints Frederic Weisbecker
2010-04-23  5:13 ` [PATCH 6/6] hw-breakpoints: Get the number of available registers on boot dynamically Frederic Weisbecker

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=20100501013611.GD5357@nowhere \
    --to=fweisbec@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=jason.wessel@windriver.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mahesh@linux.vnet.ibm.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=will.deacon@arm.com \
    /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