linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Yang Shi <yang.shi@linaro.org>
Cc: Catalin.Marinas@arm.com, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linaro-kernel@lists.linaro.org
Subject: Re: [PATCH] arm64: reenable interrupt when handling ptrace breakpoint
Date: Wed, 16 Dec 2015 11:13:17 +0000	[thread overview]
Message-ID: <20151216111316.GD4308@arm.com> (raw)
In-Reply-To: <1450225088-2456-1-git-send-email-yang.shi@linaro.org>

On Tue, Dec 15, 2015 at 04:18:08PM -0800, Yang Shi wrote:
> The kernel just send out a SIGTRAP signal when handling ptrace breakpoint in
> debug exception, so it sounds safe to have interrupt enabled if it is not
> disabled by the parent process.

Is this actually fixing an issue you're seeing, or did you just spot this?
Given that force_sig_info disable interrupts, I don't think this is really
worth doing.

> Signed-off-by: Yang Shi <yang.shi@linaro.org>
> ---
>  arch/arm64/kernel/debug-monitors.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
> index 8aee3ae..90d70e4 100644
> --- a/arch/arm64/kernel/debug-monitors.c
> +++ b/arch/arm64/kernel/debug-monitors.c
> @@ -239,6 +239,9 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
>  		return 0;
>  
>  	if (user_mode(regs)) {
> +		if (interrupts_enabled(regs))
> +			local_irq_enable();
> +

My worry here is that we take an interrupt and, on the return path,
decide to reschedule due to CONFIG_PREEMPT. If we somehow end up back
in the debugger, I'm concerned that it could remove the breakpoint and
then later see an unexpected SIGTRAP from the child.

Having said that, I've failed to construct a non-racy scenario in which
that can happen, but I'm just really uncomfortable making this change
unless there's a real problem being solved.

Will

  reply	other threads:[~2015-12-16 11:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16  0:18 [PATCH] arm64: reenable interrupt when handling ptrace breakpoint Yang Shi
2015-12-16 11:13 ` Will Deacon [this message]
2015-12-16 20:45   ` Shi, Yang
2015-12-21 10:48     ` Will Deacon
2015-12-21 16:51       ` Thomas Gleixner
2015-12-21 17:00         ` Will Deacon
2015-12-21 17:27           ` Shi, Yang
2016-01-12 19:59           ` Shi, Yang
2016-01-13 10:26             ` Will Deacon
2016-01-13 17:17               ` Shi, Yang
2016-01-13 17:23                 ` Will Deacon
2016-01-13 18:10                   ` Shi, Yang
2016-02-05 21:25                     ` Shi, Yang
2016-02-11 13:54                       ` Will Deacon
2016-02-11 17:29                         ` Shi, Yang

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=20151216111316.GD4308@arm.com \
    --to=will.deacon@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yang.shi@linaro.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).