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: <20250620081542.GK1613200@noisy.programming.kicks-ass.net>
Date: Fri, 20 Jun 2025 10:15:42 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
	bpf@...r.kernel.org, x86@...nel.org,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Josh Poimboeuf <jpoimboe@...nel.org>,
	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andrii Nakryiko <andrii@...nel.org>,
	Indu Bhagat <indu.bhagat@...cle.com>,
	"Jose E. Marchesi" <jemarch@....org>,
	Beau Belgrave <beaub@...ux.microsoft.com>,
	Jens Remus <jremus@...ux.ibm.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v10 08/14] unwind deferred: Use bitmask to determine
 which callbacks to call

On Tue, Jun 10, 2025 at 08:54:29PM -0400, Steven Rostedt wrote:


>  void unwind_deferred_cancel(struct unwind_work *work)
>  {
> +	struct task_struct *g, *t;
> +
>  	if (!work)
>  		return;
>  
>  	guard(mutex)(&callback_mutex);
>  	list_del(&work->list);
> +
> +	clear_bit(work->bit, &unwind_mask);

atomic bitop

> +
> +	guard(rcu)();
> +	/* Clear this bit from all threads */
> +	for_each_process_thread(g, t) {
> +		clear_bit(work->bit, &t->unwind_info.unwind_mask);
> +	}
>  }
>  
>  int unwind_deferred_init(struct unwind_work *work, unwind_callback_t func)
> @@ -256,6 +278,14 @@ int unwind_deferred_init(struct unwind_work *work, unwind_callback_t func)
>  	memset(work, 0, sizeof(*work));
>  
>  	guard(mutex)(&callback_mutex);
> +
> +	/* See if there's a bit in the mask available */
> +	if (unwind_mask == ~0UL)
> +		return -EBUSY;
> +
> +	work->bit = ffz(unwind_mask);
> +	unwind_mask |= BIT(work->bit);

regular or

> +
>  	list_add(&work->list, &callbacks);
>  	work->func = func;
>  	return 0;
> @@ -267,6 +297,7 @@ void unwind_task_init(struct task_struct *task)
>  
>  	memset(info, 0, sizeof(*info));
>  	init_task_work(&info->work, unwind_deferred_task_work);
> +	info->unwind_mask = 0;
>  }

Which is somewhat inconsistent;

  __clear_bit()/__set_bit()

or:

  unwind_mask &= ~BIT() / unwind_mask |= BIT()

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ