]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
riscv: kprobes: Use patch_text_nosync() for insn slots
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 27 Mar 2024 16:04:42 +0000 (09:04 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 26 Jun 2024 14:36:29 +0000 (07:36 -0700)
These instructions are not yet visible to the rest of the system,
so there is no need to do the whole stop_machine() dance.

Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20240327160520.791322-4-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/probes/kprobes.c

index dfb28e57d90018d8489643b0a24d0ba19abd49b7..03cd103b8449483fd9a325b8b627196d7173089c 100644 (file)
@@ -29,9 +29,8 @@ static void __kprobes arch_prepare_ss_slot(struct kprobe *p)
 
        p->ainsn.api.restore = (unsigned long)p->addr + offset;
 
-       patch_text(p->ainsn.api.insn, &p->opcode, 1);
-       patch_text((void *)((unsigned long)(p->ainsn.api.insn) + offset),
-                  &insn, 1);
+       patch_text_nosync(p->ainsn.api.insn, &p->opcode, 1);
+       patch_text_nosync(p->ainsn.api.insn + offset, &insn, 1);
 }
 
 static void __kprobes arch_prepare_simulate(struct kprobe *p)