linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: hw_breakpoint: use target state to determine ABI behaviour
Date: Wed, 16 Sep 2015 10:09:11 +0100	[thread overview]
Message-ID: <20150916090911.GA25444@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <20150915165528.GH31157@arm.com>

On Tue, Sep 15, 2015 at 05:55:29PM +0100, Will Deacon wrote:
> On Tue, Sep 15, 2015 at 05:43:01PM +0100, Catalin Marinas wrote:
> > On Tue, Sep 15, 2015 at 05:16:13PM +0100, Will Deacon wrote:
> > > diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
> > > index bba85c8f8037..2926c3dd6479 100644
> > > --- a/arch/arm64/kernel/hw_breakpoint.c
> > > +++ b/arch/arm64/kernel/hw_breakpoint.c
> > > @@ -163,6 +163,12 @@ enum hw_breakpoint_ops {
> > >  	HW_BREAKPOINT_RESTORE
> > >  };
> > >  
> > > +static int is_compat_bp(struct perf_event *bp)
> > > +{
> > > +	struct task_struct *tsk = bp->hw.target;
> > > +	return tsk && is_compat_thread(task_thread_info(tsk));
> > > +}
> > 
> > What are the conditions for tsk == NULL?
> 
> If you create a per-cpu breakpoint (i.e. a breakpoint that isn't affine
> to a task), then the target is NULL. These can only be created by the
> perf_event_open syscall, not from ptrace.

OK, so can sys_perf_event_open() be called from a compat task? If that's
the case, is_compat_bp() should do:

	if (tsk)
		return is_compat_thread(task_thread_info(tsk));
	else
		return is_compat_task();

and a comment on why this is (not) needed. Your patch changes the
current code behaviour when tsk == NULL.

-- 
Catalin

      reply	other threads:[~2015-09-16  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 16:16 [PATCH] arm64: hw_breakpoint: use target state to determine ABI behaviour Will Deacon
2015-09-15 16:43 ` Catalin Marinas
2015-09-15 16:55   ` Will Deacon
2015-09-16  9:09     ` Catalin Marinas [this message]

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=20150916090911.GA25444@e104818-lin.cambridge.arm.com \
    --to=catalin.marinas@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 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).