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]
Message-ID: <51D1019B.1020406@akamai.com>
Date:	Mon, 01 Jul 2013 00:12:11 -0400
From:	Jason Baron <jbaron@...mai.com>
To:	Ingo Molnar <mingo@...nel.org>
CC:	"rostedt@...dmis.org" <rostedt@...dmis.org>,
	"andi@...stfloor.org" <andi@...stfloor.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"peterz@...radead.org" <peterz@...radead.org>
Subject: Re: [PATCH 0/3] static keys: fix test/set races

On 06/29/2013 03:20 AM, Ingo Molnar wrote:
> * jbaron@...mai.com <jbaron@...mai.com> wrote:
>
>> Hi,
>>
>> As pointed out by Andi Kleen, some static key users can be racy because they
>> check the value of the key->enabled, and then subsequently update the branch
>> direction. A number of call sites have 'higher' level locking that avoids this
>> race, but the usage in the scheduler features does not. See:
>> http://lkml.indiana.edu/hypermail/linux/kernel/1304.2/01655.html
> But that's not an issue at all - switching the scheduler features is for
> development and debugging only, and in some cases higher level locking
> would be needed to solve it 'properly', beyond what the keys API could
> give ...
>
> So this is pretty pointless, sorry, please don't complicate this facility.
>
> Thanks,
>
> 	Ingo

Hi Ingo,

Yes, I agree that 'higher' level locking may be required for some 
callers of the newly proposed interface. However, I do think that the 
static_key_slow_set_true()/false() provides a nice abstraction for some 
callers, while addressing test/set() races, by making that sequence atomic.

I view the proposed inteface of set_true()/set_false() as somewhat 
analogous to an atomic_set() call. In the same way, the current 
static_key_slow_inc()/dec() are analogous to atomic_inc()/dec().

It arguably makes the code code a bit more readable, transforming 
sequences such as:

if (!static_key_enabled(&control_var))
         static_key_slow_inc(&control_var);

into:

         static_key_slow_set_true(&control_var);


I see at least 3 users of static_keys in the tree which I think would 
benefit  from this transformation. The 2 attached with this series, and 
the usage in kernel/tracepoint.c.

Thanks,

-Jason

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ