From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Peter Zijlstra <peterz@infradead.org>, <x86@kernel.org>,
<tdevries@suse.de>
Cc: <linux-kernel@vger.kernel.org>, Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [PATCH] x86/debug: 'Fix' ptrace dr6 output
Date: Thu, 28 Jan 2021 18:45:38 +0000 [thread overview]
Message-ID: <3ae6318c-b7b5-5174-af6e-c7f7241e9a47@citrix.com> (raw)
In-Reply-To: <YBMAbQGACujjfz+i@hirez.programming.kicks-ass.net>
On 28/01/2021 18:20, Peter Zijlstra wrote:
> --- a/arch/x86/kernel/hw_breakpoint.c
> +++ b/arch/x86/kernel/hw_breakpoint.c
> @@ -496,9 +496,32 @@ static int hw_breakpoint_handler(struct
> dr6_p = (unsigned long *)ERR_PTR(args->err);
> dr6 = *dr6_p;
>
> - /* If it's a single step, TRAP bits are random */
> - if (dr6 & DR_STEP)
> + /*
> + * If DR_STEP is set, TRAP bits might also be set, but we must not
> + * process them since another exception (without DR_STEP) will follow.
:) How lucky are you feeling?
Data breakpoints will in principle merge with DR_STEP (as will all other
#DB's with trap semantics), other than the many errata about breakpoints
not being recognised correctly.
Under VT-x because there is a still unfixed vmexit microcode bug which
loses all breakpoint information if DR_STEP is set. %dr6 handling works
fine when #DB isn't intercepted, but then you get to keep the pipeline
livelock vulnerability as a consequence.
Instruction breakpoints on the following instruction will be delivered
as a second #DB, because fault style #DBs are raised at a separate
position in the instruction execution cycle.
~Andrew
next prev parent reply other threads:[~2021-01-28 18:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 18:20 Peter Zijlstra
2021-01-28 18:45 ` Andrew Cooper [this message]
2021-01-28 20:21 ` Tom de Vries
2021-01-28 21:16 ` [PATCH v2] x86/debug: Fix DR6 handling Peter Zijlstra
2021-01-28 23:28 ` [PATCH] selftests: breakpoints: Add "WINE" test for x86 Thomas Gleixner
[not found] ` <YBPQq6ccKL68aIZg@hirez.programming.kicks-ass.net>
2021-01-29 19:09 ` Thomas Gleixner
[not found] ` <20210129154109.GA1391@redhat.com>
2021-01-29 16:27 ` [PATCH v2] x86/debug: Fix DR6 handling Borislav Petkov
[not found] ` <20210129144816.GB27841@zn.tnic>
2021-01-29 16:59 ` Tom de Vries
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=3ae6318c-b7b5-5174-af6e-c7f7241e9a47@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tdevries@suse.de \
--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
all inboxes | Powered by JetHome®