public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc: kprobes: Free instructions in arch_remove_kprobe()
@ 2022-09-08  2:34 Tiezhu Yang
  2022-09-08  4:10 ` Tiezhu Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tiezhu Yang @ 2022-09-08  2:34 UTC (permalink / raw)
  To: davem, Masami Hiramatsu; +Cc: sparclinux, linux-kernel

Call free_insn_slot() to free instructions in arch_remove_kprobe()
as other arches do.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/sparc/include/asm/kprobes.h | 2 +-
 arch/sparc/kernel/kprobes.c      | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/sparc/include/asm/kprobes.h b/arch/sparc/include/asm/kprobes.h
index 06c2bc7..0788286 100644
--- a/arch/sparc/include/asm/kprobes.h
+++ b/arch/sparc/include/asm/kprobes.h
@@ -17,7 +17,7 @@ typedef u32 kprobe_opcode_t;
 
 #define kretprobe_blacklist_size 0
 
-#define arch_remove_kprobe(p)	do {} while (0)
+void arch_remove_kprobe(struct kprobe *p);
 
 #define flush_insn_slot(p)		\
 do { 	flushi(&(p)->ainsn.insn[0]);	\
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 535c7b3..a251f73 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -74,6 +74,14 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
 	flushi(p->addr);
 }
 
+void __kprobes arch_remove_kprobe(struct kprobe *p)
+{
+	if (p->ainsn.insn) {
+		free_insn_slot(p->ainsn.insn, 0);
+		p->ainsn.insn = NULL;
+	}
+}
+
 static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
 {
 	kcb->prev_kprobe.kp = kprobe_running();
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-11 23:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-08  2:34 [PATCH] sparc: kprobes: Free instructions in arch_remove_kprobe() Tiezhu Yang
2022-09-08  4:10 ` Tiezhu Yang
2022-09-08  4:33 ` kernel test robot
2022-09-11 23:43 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox