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: <20170801164520.5a56wrieijlwgyds@hirez.programming.kicks-ass.net>
Date:   Tue, 1 Aug 2017 18:45:20 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] jump_labels: fix concurrent
 static_key_enable/disable()


Thanks for doing these patches, I hadn't come around to them yet.

On Tue, Aug 01, 2017 at 05:24:04PM +0200, Paolo Bonzini wrote:
>  
> +void static_key_enable(struct static_key *key)
> +{
> +	STATIC_KEY_CHECK_USE();
> +	if (atomic_read(&key->enabled) > 0) {
> +		WARN_ON_ONCE(atomic_read(&key->enabled) != 1);
> +		return;
> +	}
> +
> +	cpus_read_lock();
> +	jump_label_lock();
> +	if (atomic_read(&key->enabled) == 0) {
> +		atomic_set(&key->enabled, -1);
> +		jump_label_update(key);

As per the previous discussion, should I do a patch adding barriers here
(or using atomic_set_release()) such that we close the window where a
concurrent inc/enable sees 1 but not all text changes?

> +		atomic_set(&key->enabled, 1);
> +	}
> +	jump_label_unlock();
> +	cpus_read_unlock();
> +}
> +EXPORT_SYMBOL_GPL(static_key_enable);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ