From: Peter Zijlstra <peterz@infradead.org>
To: Andy Lutomirski <luto@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Juergen Gross <jgross@suse.com>,
LKML <linux-kernel@vger.kernel.org>,
He Zhe <zhe.he@windriver.com>,
Joel Fernandes <joel@joelfernandes.org>,
devel@etsukata.com
Subject: Re: [PATCH v3 6/6] x86/entry/64: Remove TRACE_IRQS_*_DEBUG
Date: Thu, 11 Jul 2019 20:28:02 +0200 [thread overview]
Message-ID: <20190711182802.GH3402@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CALCETrWYZHhP80PBxOcm5sc=p=StUbuwdvjDj-E3ma7wi3w-Pg@mail.gmail.com>
On Thu, Jul 11, 2019 at 07:45:56AM -0700, Andy Lutomirski wrote:
> On Thu, Jul 11, 2019 at 4:51 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > Since INT3/#BP no longer runs on an IST, this workaround is no longer
> > required.
> >
> > Tested by running lockdep+ftrace as described in the initial commit:
> >
> > 5963e317b1e9 ("ftrace/x86: Do not change stacks in DEBUG when calling lockdep")
> >
> > Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>
> I would definitely like to see this happen, but there are all kinds of
> possibly nasties here. Ideally we'd like get rid of IST for #DB, but
> we can't due to the MOV SS mess. There are a few relevant cases we
> care about:
>
> #DB from user mode -> anything that hits in C code: irrelevant --
> we've exited the IST stack already.
>
> #DB from user mode -> NMI/MCE in the asm -> #DB: The NMI code tries to
> get this right. The MCE code does not.
>
> #DB from kernel mode -> NMI/MCE -> #DB: same as above.
>
> MOV SS -> #DB from entry -> #DB again: ugh. We get some protection
> from shift_ist.
>
> IMO we would ideally just clear DR7 in sensitive contexts. Or extend
> the debug_stack_set_zero(), etc hack.
>
> All that being said, the actual _DEBUG macros shouldn't matter here, I
> think. But I'd like to sleep on it. So not-yet-acked-by me.
How about something lovely like:
#DB from kernel space; in say lockdep.
the #DB entry calls back into lockdep through trace_irq
which then hits the same #DB
and we get recursive #DB.
Now, I don't think we can actually make that happen, because most/all
the relevant functions have NOKPROBE_SYMBOL() on. Even the idtentry
generates _ASM_NOKPROBE().
Still, it might make sense to have #DB itself clear/restore DR7 if it
doesn't already.
Also, the comment on do_debug() seems wrong; we can set watchpoints on
kernel text just fine these days.
next prev parent reply other threads:[~2019-07-11 18:28 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-11 11:40 [PATCH v3 0/6] Tracing vs CR2 Peter Zijlstra
2019-07-11 11:40 ` [PATCH v3 1/6] x86/paravirt: Make read_cr2() CALLEE_SAVE Peter Zijlstra
2019-07-17 21:22 ` [tip:x86/urgent] " tip-bot for Peter Zijlstra
2019-07-11 11:40 ` [PATCH v3 2/6] x86/entry/32: Simplify common_exception Peter Zijlstra
2019-07-17 21:23 ` [tip:x86/urgent] " tip-bot for Peter Zijlstra
2019-07-11 11:40 ` [PATCH v3 3/6] x86/entry/64: Simplify idtentry a little Peter Zijlstra
2019-07-17 21:24 ` [tip:x86/urgent] " tip-bot for Peter Zijlstra
2019-07-11 11:40 ` [PATCH v3 4/6] x86/entry/64: Update comments and sanity tests for create_gap Peter Zijlstra
2019-07-17 21:25 ` [tip:x86/urgent] " tip-bot for Peter Zijlstra
2019-07-11 11:40 ` [PATCH v3 5/6] x86/mm, tracing: Fix CR2 corruption Peter Zijlstra
2019-07-17 21:25 ` [tip:x86/urgent] " tip-bot for Peter Zijlstra
2019-07-11 11:41 ` [PATCH v3 6/6] x86/entry/64: Remove TRACE_IRQS_*_DEBUG Peter Zijlstra
2019-07-11 14:45 ` Andy Lutomirski
2019-07-11 18:28 ` Peter Zijlstra [this message]
2019-07-16 19:33 ` [PATCH v3 0/6] Tracing vs CR2 Vegard Nossum
2019-07-16 21:51 ` Vegard Nossum
2019-07-17 1:02 ` Andy Lutomirski
2019-07-17 7:46 ` Vegard Nossum
2019-07-17 7:47 ` Peter Zijlstra
2019-07-17 9:37 ` Eiichi Tsukata
2019-07-18 20:27 ` Andy Lutomirski
2019-07-20 3:59 ` Eiichi Tsukata
2019-07-20 12:49 ` Andy Lutomirski
2019-07-20 14:23 ` Eiichi Tsukata
2019-07-17 8:07 ` Peter Zijlstra
2019-07-17 8:09 ` Vegard Nossum
2019-07-18 8:57 ` [PATCH] stacktrace: Force USER_DS for stack_trace_save_user() Peter Zijlstra
2019-07-18 13:21 ` Joel Fernandes
2019-07-18 14:52 ` [tip:core/urgent] " tip-bot for Peter Zijlstra
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=20190711182802.GH3402@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=devel@etsukata.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=zhe.he@windriver.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