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:   Tue, 13 Jun 2023 15:26:06 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Beau Belgrave <beaub@...ux.microsoft.com>
Cc:     mhiramat@...nel.org, linux-kernel@...r.kernel.org,
        linux-trace-kernel@...r.kernel.org, ast@...nel.org,
        dcook@...ux.microsoft.com
Subject: Re: [PATCH v2 3/5] tracing/user_events: Add auto cleanup and a flag
 to persist events

On Mon,  5 Jun 2023 16:38:58 -0700
Beau Belgrave <beaub@...ux.microsoft.com> wrote:

Continuing on what Alexei was saying ...

> +	/*
> +	 * Unfortunately we have to attempt the actual destroy in a work
> +	 * queue. This is because not all cases handle a trace_event_call
> +	 * being removed within the class->reg() operation for unregister.
> +	 */
> +	INIT_WORK(&user->put_work, delayed_destroy_user_event);

We initialize the work here.

> +
> +	/*
> +	 * Since the event is still in the hashtable, we have to re-inc
> +	 * the ref count to 1. This count will be decremented and checked
> +	 * in the work queue to ensure it's still the last ref. This is
> +	 * needed because a user-process could register the same event in
> +	 * between the time of event_mutex release and the work queue
> +	 * running the delayed destroy. If we removed the item now from
> +	 * the hashtable, this would result in a timing window where a
> +	 * user process would fail a register because the trace_event_call
> +	 * register would fail in the tracing layers.
> +	 */
> +	refcount_set(&user->refcnt, 1);
> +
> +	if (!schedule_work(&user->put_work)) {

>From what I understand, schedule_work() can only fail if the work is
already queued. That should never happen if we just initialized it.

That means we need a WARN_ON_ONCE() here. Because it's a major bug if that
does return false.

-- Steve


> +		/*
> +		 * If we fail we must wait for an admin to attempt delete or
> +		 * another register/close of the event, whichever is first.
> +		 */
> +		pr_warn("user_events: Unable to queue delayed destroy\n");
> +	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ