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: <YnDvye07/jRMBiPx@hirez.programming.kicks-ass.net>
Date:   Tue, 3 May 2022 11:03:05 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
        Filipe Manana <fdmanana@...e.com>
Subject: Re: [patch 3/3] x86/fpu: Make FPU protection more robust

On Sun, May 01, 2022 at 09:31:47PM +0200, Thomas Gleixner wrote:
> +void fpregs_lock(void)
> +{
> +	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> +		local_bh_disable();
> +	else
> +		preempt_disable();
> +
> +	WARN_ON_ONCE(this_cpu_read(fpu_in_use));
> +	this_cpu_write(fpu_in_use, true);

	barrier();
> +}
> +EXPORT_SYMBOL_GPL(fpregs_lock);

> +void fpregs_unlock(void)
> +{
	barrier();

> +	WARN_ON_ONCE(!this_cpu_read(fpu_in_use));
> +	this_cpu_write(fpu_in_use, false);
> +
> +	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> +		local_bh_enable();
> +	else
> +		preempt_enable();
> +}
> +EXPORT_SYMBOL_GPL(fpregs_unlock);

I think this isn't currently a problem because a function call is a C
sequence point, but 'funnily' C doesn't preserve sequence points when
inlining so LTO can actually break this without barrier() on.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ