Skip to content

Commit 8cb22be

Browse files
covanampalmer-dabbelt
authored andcommitted
riscv: kprobes: allow writing to x0
Instructions can write to x0, so we should simulate these instructions normally. Currently, the kernel hangs if an instruction who writes to x0 is simulated. Fixes: c22b0bc ("riscv: Add kprobes supported") Cc: [email protected] Signed-off-by: Nam Cao <[email protected]> Reviewed-by: Charlie Jenkins <[email protected]> Acked-by: Guo Ren <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent b701f9e commit 8cb22be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/kernel/probes/simulate-insn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static inline bool rv_insn_reg_set_val(struct pt_regs *regs, u32 index,
2424
unsigned long val)
2525
{
2626
if (index == 0)
27-
return false;
27+
return true;
2828
else if (index <= 31)
2929
*((unsigned long *)regs + index) = val;
3030
else

0 commit comments

Comments
 (0)