[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1662604440-30524-1-git-send-email-yangtiezhu@loongson.cn>
Date: Thu, 8 Sep 2022 10:34:00 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: davem@...emloft.net, Masami Hiramatsu <mhiramat@...nel.org>
Cc: sparclinux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] sparc: kprobes: Free instructions in arch_remove_kprobe()
Call free_insn_slot() to free instructions in arch_remove_kprobe()
as other arches do.
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.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
Powered by blists - more mailing lists