Thread (110 messages) 110 messages, 8 authors, 2023-02-17

Re: [PATCH v5 06/39] x86/fpu: Add helper for modifying xstate

From: Borislav Petkov <bp@alien8.de>
Date: 2023-02-01 18:18:35
Also in: linux-arch, linux-doc, linux-mm, lkml

On Wed, Feb 01, 2023 at 05:31:50PM +0000, Edgecombe, Rick P wrote:
On Wed, 2023-02-01 at 12:01 +0100, Borislav Petkov wrote:
quoted
On Thu, Jan 19, 2023 at 01:22:44PM -0800, Rick Edgecombe wrote:
quoted
+void fpregs_lock_and_load(void)
+{
+     /*
+      * fpregs_lock() only disables preemption (mostly). So
modifying state
+      * in an interrupt could screw up some in progress fpregs
operation,
+      * but appear to work. Warn about it.
I don't like comments where it sounds like we don't know what we're
doing. "Appear to work"?
I can change it. This patch started with the observation that modifying
xstate from the kernel had been gotten wrong a couple times in the
past, so that is what this is referencing. Since then, the fancy
automatic solution got boiled down to this helper and a couple
warnings.
Yeah, but that comment right now reads like: modifying in interrupt
context can corrupt fpregs and you should not do it but it kinda works,
by chance. Thus encouraging people to keep doing that.

I guess "but appear to work" can go and then it is fine.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help