* [PATCH v3] kprobes: remove duplicated strong free_insn_page in x86 and s390
@ 2021-06-08 6:57 Barry Song
2021-06-08 9:14 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Barry Song @ 2021-06-08 6:57 UTC (permalink / raw)
To: akpm, hpa, tglx, mingo, bp, hca, gor, borntraeger, naveen.n.rao,
anil.s.keshavamurthy, davem, mhiramat, linux-s390, x86
Cc: linux-kernel, liuqi115, linuxarm, Barry Song, Christoph Hellwig
free_insn_page() in x86 and s390 is same with the common weak function
in kernel/kprobes.c.
Plus, the comment "Recover page to RW mode before releasing it" in x86
seems insensible to be there since resetting mapping is done by common
code in vfree() of module_memfree().
So drop these two duplicated strong functions and related comment, then
mark the common one in kernel/kprobes.c strong.
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
-v3: mark free_insn_page as static according to Christoph's comment
arch/s390/kernel/kprobes.c | 5 -----
arch/x86/kernel/kprobes/core.c | 6 ------
include/linux/kprobes.h | 1 -
kernel/kprobes.c | 2 +-
4 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index aae24dc75df6..60cfbd24229b 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -44,11 +44,6 @@ void *alloc_insn_page(void)
return page;
}
-void free_insn_page(void *page)
-{
- module_memfree(page);
-}
-
static void *alloc_s390_insn_page(void)
{
if (xchg(&insn_page_in_use, 1) == 1)
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index d3d65545cb8b..3bce67d3a03c 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -422,12 +422,6 @@ void *alloc_insn_page(void)
return page;
}
-/* Recover page to RW mode before releasing it */
-void free_insn_page(void *page)
-{
- module_memfree(page);
-}
-
/* Kprobe x86 instruction emulation - only regs->ip or IF flag modifiers */
static void kprobe_emulate_ifmodifiers(struct kprobe *p, struct pt_regs *regs)
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 1883a4a9f16a..c98a35a75f40 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -407,7 +407,6 @@ int enable_kprobe(struct kprobe *kp);
void dump_kprobe(struct kprobe *kp);
void *alloc_insn_page(void);
-void free_insn_page(void *page);
int kprobe_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
char *sym);
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 745f08fdd7a6..e0c4c9d57299 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -106,7 +106,7 @@ void __weak *alloc_insn_page(void)
return module_alloc(PAGE_SIZE);
}
-void __weak free_insn_page(void *page)
+static void free_insn_page(void *page)
{
module_memfree(page);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] kprobes: remove duplicated strong free_insn_page in x86 and s390
2021-06-08 6:57 [PATCH v3] kprobes: remove duplicated strong free_insn_page in x86 and s390 Barry Song
@ 2021-06-08 9:14 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2021-06-08 9:14 UTC (permalink / raw)
To: Barry Song
Cc: akpm, hpa, tglx, mingo, bp, hca, gor, borntraeger, naveen.n.rao,
anil.s.keshavamurthy, davem, mhiramat, linux-s390, x86,
linux-kernel, liuqi115, linuxarm, Christoph Hellwig
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-08 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 6:57 [PATCH v3] kprobes: remove duplicated strong free_insn_page in x86 and s390 Barry Song
2021-06-08 9:14 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).