Thread (6 messages) flat view 6 messages, 3 authors, 2018-04-04

Re: [PATCH] powerpc: Clear branch trap (MSR.BE) before delivering SIGTRAP

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-03-28 05:54:30

Matt Evans [off-list ref] writes:
When using SIG_DBG_BRANCH_TRACING, MSR.BE is left enabled in the
user context when single_step_exception() prepares the SIGTRAP
delivery.  The resulting branch-trap-within-the-SIGTRAP-handler
isn't healthy.

Commit 2538c2d08f46141550a1e68819efa8fe31c6e3dc broke this, by
replacing an MSR mask operation of ~(MSR_SE | MSR_BE) with a call
to clear_single_step() which only clears MSR_SE.

This patch adds a new helper, clear_br_trace(), which clears the
debug trap before invoking the signal handler.  This helper is a
NOP for BookE as SIG_DBG_BRANCH_TRACING isn't supported on BookE.

Signed-off-by: Matt Evans <redacted>
Hi Matt!

It seems we might not be regularly testing this code :}

How did you hit/find the bug? And do you have a test case by any chance?

I found the test code at the bottom of:
  https://lwn.net/Articles/114587/

But it didn't immediately work.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help