[PW_SID:1119531] riscv: add c.jal instruction simulation for kprobes#2184
[PW_SID:1119531] riscv: add c.jal instruction simulation for kprobes#2184linux-riscv-bot wants to merge 3 commits into
Conversation
The c.jal instruction is currently marked REJECTED in kprobes instruction decoding, but it should be SIMULATED like other compressed jump instructions. Add simulate_c_jal() which saves the return address to RA and sets the program counter to the target offset, reusing simulate_c_j for the common jump logic. Although c.jal is RV32-only, the function compiles unconditionally. On RV64, riscv_insn_is_c_jal() always returns 0, so the simulation code is never invoked and the small overhead in kernel size is acceptable. Signed-off-by: Xiaofeng Yuan <xiaofengmian@163.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add a test case validating that kprobes correctly simulates the c.jal instruction on RV32. The test uses two probe points: a forward c.jal and a backward c.jal, and verifies that the containing function returns the expected magic value KPROBE_TEST_MAGIC after kprobe interception. Co-developed-by: Xiaofeng Yuan <xiaofengmian@163.com> Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Xiaofeng Yuan <xiaofengmian@163.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 1: "[v6,1/2] riscv: probes: simulate c.jal instruction" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
|
Patch 2: "[v6,2/2] riscv: kprobes: add test case for c.jal instruction simulation" |
89be0ce to
dc5ff20
Compare
PR for series 1119531 applied to workflow__riscv__fixes
Name: riscv: add c.jal instruction simulation for kprobes
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1119531
Version: 6