lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 7 Jun 2021 21:32:08 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Barry Song <song.bao.hua@...ilicon.com>
Cc:     <akpm@...ux-foundation.org>, <hpa@...or.com>, <tglx@...utronix.de>,
        <mingo@...hat.com>, <bp@...en8.de>, <hca@...ux.ibm.com>,
        <gor@...ux.ibm.com>, <borntraeger@...ibm.com>,
        <naveen.n.rao@...ux.ibm.com>, <anil.s.keshavamurthy@...el.com>,
        <davem@...emloft.net>, <linux-s390@...r.kernel.org>,
        <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
        Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH v2] kprobes: remove duplicated strong free_insn_page in
 x86 and s390

On Mon, 7 Jun 2021 21:18:54 +1200
Barry Song <song.bao.hua@...ilicon.com> wrote:

> free_insn_page() in x86 and s390 are 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.

Hm, OK. Actually riscv and arm64 uses __vmalloc() but anyway
since module_memfree() calls vfree(). So it has no problem.

Acked-by: Masami Hiramatsu <mhiramat@...nel.org>

Thank you,

> 
> Cc: Christoph Hellwig <hch@...radead.org>
> Signed-off-by: Barry Song <song.bao.hua@...ilicon.com>
> ---
>  -v2:
>  remove free_insn_page in s390 as well and remove the __weak in common
>  code according to Christoph's comment;
> 
>  arch/s390/kernel/kprobes.c     | 5 -----
>  arch/x86/kernel/kprobes/core.c | 6 ------
>  kernel/kprobes.c               | 2 +-
>  3 files changed, 1 insertion(+), 12 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/kernel/kprobes.c b/kernel/kprobes.c
> index 745f08fdd7a6..ddb643f3879f 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)
> +void free_insn_page(void *page)
>  {
>  	module_memfree(page);
>  }
> -- 
> 2.25.1
> 


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ