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]
Message-Id: <20220329094752.d0950054058846197f573349@kernel.org>
Date:   Tue, 29 Mar 2022 09:47:52 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Beau Belgrave <beaub@...ux.microsoft.com>
Cc:     rostedt@...dmis.org, mathieu.desnoyers@...icios.com,
        linux-trace-devel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tracing/user_events: Hold event_mutex during
 dyn_event_add

On Mon, 28 Mar 2022 15:32:25 -0700
Beau Belgrave <beaub@...ux.microsoft.com> wrote:

> Make sure the event_mutex is properly held during dyn_event_add call.
> This is required when adding dynamic events.
> 

Good catch!

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

Thank you,

> Reported-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Signed-off-by: Beau Belgrave <beaub@...ux.microsoft.com>
> ---
>  kernel/trace/trace_events_user.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> index 8b3d241a31c2..61d78d64bdf0 100644
> --- a/kernel/trace/trace_events_user.c
> +++ b/kernel/trace/trace_events_user.c
> @@ -1165,11 +1165,11 @@ static int user_event_parse(char *name, char *args, char *flags,
>  #endif
>  
>  	mutex_lock(&event_mutex);
> +
>  	ret = user_event_trace_register(user);
> -	mutex_unlock(&event_mutex);
>  
>  	if (ret)
> -		goto put_user;
> +		goto put_user_lock;
>  
>  	user->index = index;
>  
> @@ -1181,8 +1181,12 @@ static int user_event_parse(char *name, char *args, char *flags,
>  	set_bit(user->index, page_bitmap);
>  	hash_add(register_table, &user->node, key);
>  
> +	mutex_unlock(&event_mutex);
> +
>  	*newuser = user;
>  	return 0;
> +put_user_lock:
> +	mutex_unlock(&event_mutex);
>  put_user:
>  	user_event_destroy_fields(user);
>  	user_event_destroy_validators(user);
> 
> base-commit: c87857e214862a125208a4b1a510839d0c5a1bd4
> -- 
> 2.25.1
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ