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]
Date: Mon, 10 Jun 2024 08:46:51 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Steven Rostedt <rostedt@...dmis.org>, Sam Sun <samsun1006219@...il.com>,
	linux-kernel@...r.kernel.org, x86@...nel.org,
	syzkaller-bugs@...glegroups.com, jpoimboe@...nel.org,
	jbaron@...mai.com, ardb@...nel.org, mingo@...hat.com,
	Borislav Petkov <bp@...en8.de>, dave.hansen@...ux.intel.com,
	hpa@...or.com, xrivendell7@...il.com,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Tejun Heo <tj@...nel.org>
Subject: Re: [Linux kernel bug] WARNING in static_key_slow_inc_cpuslocked

On Sun, Jun 09, 2024 at 06:56:14PM +0200, Thomas Gleixner wrote:

> Ok. Now I found if for real. It's in the jump label core:
> 
> CPU0                            CPU1
> 
> static_key_slow_dec()
>  static_key_slow_try_dec()
> 
>    key->enabled == 1
>    val = atomic_fetch_add_unless(&key->enabled, -1, 1);
>    if (val == 1)
>    	return false;
> 
>    jump_label_lock();
>    if (atomic_dec_and_test(&key->enabled)) {
>       --> key->enabled == 0
>       __jump_label_update()
> 
>                                 static_key_slow_dec()
>                                  static_key_slow_try_dec()
> 
>                                     key->enabled == 0
>                                     val = atomic_fetch_add_unless(&key->enabled, -1, 1);
> 
>                                     --> key->enabled == -1 <- FAIL
> 
> static_key_slow_try_dec() is buggy. It needs similar logic as
> static_key_slow_try_inc() to work correctly.
> 
> It's not only the 0, key->enabled can be -1 when the other CPU is in the
> slow path of enabling it.

Well, the -1 thing is in the 0->1 path, that is, the very first enabler.

That *should* not race with a disabler. If it does, there is external
confusion. (As I think the follow up email shows..)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ