diff options
author | Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> | 2022-03-30 19:37:18 +0530 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-05-06 00:00:20 +1000 |
commit | 54cdacd7d3b3c1a8dc10965f56c8b5eb8eda1a33 (patch) | |
tree | f2827fb522282693d36de004170c5a42df965b0b /tools/laptop | |
parent | f31c618373f2051a32e30002d8eacad7bbbd3885 (diff) | |
download | linux-stable-54cdacd7d3b3c1a8dc10965f56c8b5eb8eda1a33.tar.gz linux-stable-54cdacd7d3b3c1a8dc10965f56c8b5eb8eda1a33.tar.bz2 linux-stable-54cdacd7d3b3c1a8dc10965f56c8b5eb8eda1a33.zip |
powerpc: Reject probes on instructions that can't be single stepped
Per the ISA, a Trace interrupt is not generated for:
- [h|u]rfi[d]
- rfscv
- sc, scv, and Trap instructions that trap
- Power-Saving Mode instructions
- other instructions that cause interrupts (other than Trace interrupts)
- the first instructions of any interrupt handler (applies to Branch and Single Step tracing;
CIABR matches may still occur)
- instructions that are emulated by software
Add a helper to check for instructions belonging to the first four
categories above and to reject kprobes, uprobes and xmon breakpoints on
such instructions. We reject probing on instructions belonging to these
categories across all ISA versions and across both BookS and BookE.
For trap instructions, we can't know in advance if they can cause a
trap, and there is no good reason to allow probing on those. Also,
uprobes already refuses to probe trap instructions and kprobes does not
allow probes on trap instructions used for kernel warnings and bugs. As
such, stop allowing any type of probes/breakpoints on trap instruction
across uprobes, kprobes and xmon.
For some of the fp/altivec instructions that can generate an interrupt
and which we emulate in the kernel (altivec assist, for example), we
check and turn off single stepping in emulate_single_step().
Instructions generating a DSI are restarted and single stepping normally
completes once the instruction is completed.
In uprobes, if a single stepped instruction results in a non-fatal
signal to be delivered to the task, such signals are "delayed" until
after the instruction completes. For fatal signals, single stepping is
cancelled and the instruction restarted in-place so that core dump
captures proper addresses.
In kprobes, we do not allow probes on instructions having an extable
entry and we also do not allow probing interrupt vectors.
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/f56ee979d50b8711fae350fc97870f3ca34acd75.1648648712.git.naveen.n.rao@linux.vnet.ibm.com
Diffstat (limited to 'tools/laptop')
0 files changed, 0 insertions, 0 deletions