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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 28 Oct 2017 17:47:59 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Zhou Chengming <zhouchengming1@...wei.com>
Cc:     <ananth@...ux.vnet.ibm.com>, <anil.s.keshavamurthy@...el.com>,
        <davem@...emloft.net>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 2/2] kprobes: initialize probed_mod to NULL

On Fri, 27 Oct 2017 17:23:15 +0800
Zhou Chengming <zhouchengming1@...wei.com> wrote:

> When check_kprobe_address_safe() return fail, the probed_mod
> should be set to NULL, because no module refcount held. And we
> initialize probed_mod to NULL in register_kprobe() for the same reason.
> 

Ok, it's a kind of hardening code but looks good to me.

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

Thank you!


> Signed-off-by: Zhou Chengming <zhouchengming1@...wei.com>
> ---
>  kernel/kprobes.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 1eeedac..a04588c 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1488,6 +1488,7 @@ static int check_kprobe_address_safe(struct kprobe *p,
>  		 * its code to prohibit unexpected unloading.
>  		 */
>  		if (unlikely(!try_module_get(*probed_mod))) {
> +			*probed_mod = NULL;
>  			ret = -ENOENT;
>  			goto out;
>  		}
> @@ -1514,7 +1515,7 @@ int register_kprobe(struct kprobe *p)
>  {
>  	int ret;
>  	struct kprobe *old_p;
> -	struct module *probed_mod;
> +	struct module *probed_mod = NULL;
>  	kprobe_opcode_t *addr;
>  
>  	/* Adjust probe address from symbol */
> -- 
> 1.8.3.1
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ