]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
kprobes: remove duplicated strong free_insn_page in x86 and s390
authorBarry Song <song.bao.hua@hisilicon.com>
Thu, 1 Jul 2021 01:56:31 +0000 (18:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 1 Jul 2021 18:06:06 +0000 (11:06 -0700)
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.

Link: https://lkml.kernel.org/r/20210608065736.32656-1-song.bao.hua@hisilicon.com
Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Qi Liu <liuqi115@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/s390/kernel/kprobes.c
arch/x86/kernel/kprobes/core.c
include/linux/kprobes.h
kernel/kprobes.c

index aae24dc75df61bfed0c062822f60645bb783f380..60cfbd24229b173e0f29a2ab1f542c9657fec4ac 100644 (file)
@@ -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)
index d3d65545cb8b79555debd82996eaed42a83e6036..3bce67d3a03cc8a8f2066cdc188f09ea76111650 100644 (file)
@@ -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)
index 1883a4a9f16a7fc70bf533cd2206d046c6722b14..c98a35a75f40a7d5313a44be95182b4f17536324 100644 (file)
@@ -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);
index 745f08fdd7a698ebd6f3a40da3cffedaa35497c6..e0c4c9d572993c583b04ca209db3b96e426d416d 100644 (file)
@@ -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);
 }