public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Daniel Thompson <daniel.thompson@linaro.org>
Cc: x86@kernel.org, sumit.garg@linaro.org,
	jason.wessel@windriver.com, dianders@chromium.org,
	kgdb-bugreport@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, pmladek@suse.com,
	sergey.senozhatsky@gmail.com, will@kernel.org,
	laijs@linux.alibaba.com
Subject: Re: x86/entry vs kgdb
Date: Tue, 26 May 2020 18:28:06 +0200	[thread overview]
Message-ID: <20200526162806.GD325280@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200526161621.7ucj5jn6rm5yednb@holly.lan>

On Tue, May 26, 2020 at 05:16:21PM +0100, Daniel Thompson wrote:
> On Mon, May 25, 2020 at 11:18:32AM +0200, Peter Zijlstra wrote:
> > On Mon, May 25, 2020 at 10:36:05AM +0200, Peter Zijlstra wrote:
> > > Hi!
> > > 
> > > Since you seem to care about kgdb, I figured you might want to fix this
> > > before I mark it broken on x86 (we've been considering doing that for a
> > > while).
> > > 
> > > AFAICT the whole debugreg usage of kgdb-x86_64 is completely hosed; it
> > > doesn't respsect the normal exclusion zones as per arch_build_bp_info().
> > > 
> > > That is, breakpoints must never be in:
> > > 
> > >   - in the cpu_entry_area
> > >   - in .entry.text
> > >   - in .noinstr.text
> > >   - in anything else marked NOKPROBE
> > > 
> > > by not respecting these constraints it is trivial to completely and
> > > utterly hose the machine. The entry rework that is current underway will
> > > explicitly not deal with #DB triggering in any of those places.
> > 
> > This also very much includes single stepping those bits.  Which KGDB
> > obviously also does not respects.
> 
> For breakpoints there's already a pre-poke validation hook that
> architectures can override if they want to. I can modify the default
> implementation to include checking the nokprobe list.

Excellent, and I suppose the arch callback should be changed to share
code with arch_build_bp_info(), which Lai was extending here:

  https://lkml.kernel.org/r/20200526014221.2119-1-laijs@linux.alibaba.com

> Stepping is a bit more complex. There are hooks for some of the
> underlying work but not pre-step validation hook. I'll see if we can add
> one.

That'd be great; because where we're going getting this wrong is
insta-fail.

Another point to look at is the whole dbg_is_early; I suspect that's
similarly wrecked, the entry code isn't more robust early on.

      reply	other threads:[~2020-05-26 16:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25  8:36 x86/entry vs kgdb Peter Zijlstra
2020-05-25  9:18 ` Peter Zijlstra
2020-05-26 16:16   ` Daniel Thompson
2020-05-26 16:28     ` Peter Zijlstra [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=20200526162806.GD325280@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=daniel.thompson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=laijs@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=sumit.garg@linaro.org \
    --cc=will@kernel.org \
    --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