aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/linux/pgtable.py
diff options
context:
space:
mode:
authorBjörn Töpel <[email protected]>2023-09-12 08:56:19 +0200
committerPalmer Dabbelt <[email protected]>2023-09-20 06:45:27 -0700
commit9f564b92cf6d0ecb398f9348600a7d8a7f8ea804 (patch)
tree1ba3577016784b8bb634dda8b146db1449f7eeb3 /scripts/gdb/linux/pgtable.py
parentb06fab003ae181c6690fe6d1f806636f816f4e50 (diff)
riscv: Only consider swbp/ss handlers for correct privileged mode
RISC-V software breakpoint trap handlers are used for {k,u}probes. When trapping from kernelmode, only the kernelmode handlers should be considered. Vice versa, only usermode handlers for usermode traps. This is not the case on RISC-V, which can trigger a bug if a userspace process uses uprobes, and a WARN() is triggered from kernelmode (which is implemented via {c.,}ebreak). The kernel will trap on the kernelmode {c.,}ebreak, look for uprobes handlers, realize incorrectly that uprobes need to be handled, and exit the trap handler early. The trap returns to re-executing the {c.,}ebreak, and enter an infinite trap-loop. The issue was found running the BPF selftest [1]. Fix this issue by only considering the swbp/ss handlers for kernel/usermode respectively. Also, move CONFIG ifdeffery from traps.c to the asm/{k,u}probes.h headers. Note that linux/uprobes.h only include asm/uprobes.h if CONFIG_UPROBES is defined, which is why asm/uprobes.h needs to be unconditionally included in traps.c Link: https://lore.kernel.org/linux-riscv/[email protected]/ # [1] Fixes: 74784081aac8 ("riscv: Add uprobes supported") Reviewed-by: Guo Ren <[email protected]> Reviewed-by: Nam Cao <[email protected]> Tested-by: Puranjay Mohan <[email protected]> Signed-off-by: Björn Töpel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/pgtable.py')
0 files changed, 0 insertions, 0 deletions