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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180726004113.d578f6e6a2fa59adf1efb4ea@kernel.org>
Date:   Thu, 26 Jul 2018 00:41:13 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Artem Savkov <asavkov@...hat.com>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH v2] tracing/kprobes: Fix trace_probe flags on
 enable_trace_kprobe() failure

On Wed, 25 Jul 2018 16:20:38 +0200
Artem Savkov <asavkov@...hat.com> wrote:

> If enable_trace_kprobe fails to enable the probe in enable_k(ret)probe
> it returns an error, but does not unset the tp flags it set previously.
> This results in a probe being considered enabled and failures like being
> unable to remove the probe through kprobe_events file since probes_open()
> expects every probe to be disabled.
> 

Looks good to me.

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

Thanks!

> Signed-off-by: Artem Savkov <asavkov@...hat.com>
> ---
>  kernel/trace/trace_kprobe.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 21f718472942..27ace4513c43 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -400,11 +400,10 @@ static struct trace_kprobe *find_trace_kprobe(const char *event,
>  static int
>  enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
>  {
> +	struct event_file_link *link;
>  	int ret = 0;
>  
>  	if (file) {
> -		struct event_file_link *link;
> -
>  		link = kmalloc(sizeof(*link), GFP_KERNEL);
>  		if (!link) {
>  			ret = -ENOMEM;
> @@ -424,6 +423,16 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
>  		else
>  			ret = enable_kprobe(&tk->rp.kp);
>  	}
> +
> +	if (ret) {
> +		if (file) {
> +			list_del_rcu(&link->list);
> +			kfree(link);
> +			tk->tp.flags &= ~TP_FLAG_TRACE;
> +		} else {
> +			tk->tp.flags &= ~TP_FLAG_PROFILE;
> +		}
> +	}
>   out:
>  	return ret;
>  }
> -- 
> 2.13.6
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ