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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210628232621.778201d638c421ddda0e3c59@kernel.org>
Date:   Mon, 28 Jun 2021 23:26:21 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     jpoimboe@...hat.com, jbaron@...mai.com, rostedt@...dmis.org,
        ardb@...nel.org, naveen.n.rao@...ux.ibm.com,
        anil.s.keshavamurthy@...el.com, davem@...emloft.net,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] static_call: Fix static_call_text_reserved() vs
 __init

On Mon, 28 Jun 2021 13:24:11 +0200
Peter Zijlstra <peterz@...radead.org> wrote:

> It turns out that static_call_text_reserved() was reporting __init
> text as being reserved past the time when the __init text was freed
> and re-used.
> 
> This is mostly harmless and will at worst result in refusing a kprobe.
> 
> Fixes: 6333e8f73b83 ("static_call: Avoid kprobes on inline static_call()s")
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>

This looks good to me.

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

Thank you,

> ---
>  kernel/static_call.c |   13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> --- a/kernel/static_call.c
> +++ b/kernel/static_call.c
> @@ -292,13 +292,15 @@ static int addr_conflict(struct static_c
>  
>  static int __static_call_text_reserved(struct static_call_site *iter_start,
>  				       struct static_call_site *iter_stop,
> -				       void *start, void *end)
> +				       void *start, void *end, bool init)
>  {
>  	struct static_call_site *iter = iter_start;
>  
>  	while (iter < iter_stop) {
> -		if (addr_conflict(iter, start, end))
> -			return 1;
> +		if (init || !static_call_is_init(iter)) {
> +			if (addr_conflict(iter, start, end))
> +				return 1;
> +		}
>  		iter++;
>  	}
>  
> @@ -324,7 +326,7 @@ static int __static_call_mod_text_reserv
>  
>  	ret = __static_call_text_reserved(mod->static_call_sites,
>  			mod->static_call_sites + mod->num_static_call_sites,
> -			start, end);
> +			start, end, mod->state == MODULE_STATE_COMING);
>  
>  	module_put(mod);
>  
> @@ -459,8 +461,9 @@ static inline int __static_call_mod_text
>  
>  int static_call_text_reserved(void *start, void *end)
>  {
> +	bool init = system_state < SYSTEM_RUNNING;
>  	int ret = __static_call_text_reserved(__start_static_call_sites,
> -			__stop_static_call_sites, start, end);
> +			__stop_static_call_sites, start, end, init);
>  
>  	if (ret)
>  		return ret;
> 
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ