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: <20250305212255.4989a8ab@pumpkin>
Date: Wed, 5 Mar 2025 21:22:55 +0000
From: David Laight <david.laight.linux@...il.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: Dave Hansen <dave.hansen@...el.com>, Eric Biggers <ebiggers@...nel.org>,
 x86@...nel.org, linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
 Ard Biesheuvel <ardb@...nel.org>, Ben Greear <greearb@...delatech.com>,
 Xiao Liang <shaw.leon@...il.com>, Thomas Gleixner <tglx@...utronix.de>,
 Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, Dave Hansen
 <dave.hansen@...ux.intel.com>, Andy Lutomirski <luto@...nel.org>, "Jason A
 . Donenfeld" <Jason@...c4.com>, "Bae, Chang Seok"
 <chang.seok.bae@...el.com>
Subject: Re: [RFC PATCH v2] x86/fpu: make kernel-mode FPU reliably usable in
 softirqs

On Wed, 5 Mar 2025 18:37:25 +0100
Ingo Molnar <mingo@...nel.org> wrote:

> * Dave Hansen <dave.hansen@...el.com> wrote:
> 
> > On 3/5/25 01:07, Ingo Molnar wrote:>> Alternatives considered:  
> > >> - Make kernel-mode FPU sections fully preemptible.  This would require
> > >>   growing task_struct by another struct fpstate which is more than 2K.  
> > > 
> > > So that's something that will probably happen once the kernel is built 
> > > using APX anyway?  
> > 
> > I was expecting that building the kernel with APX would be very 
> > different than a kernel_fpu_begin(). We don't just need *one* more 
> > save area for APX registers: we need a stack, just like normal GPRs.  
> 
> Yes - but my point is: with any APX build we'd probably be saving 
> FPU(-ish) registers at entry points, into a separate context area. If 
> that includes FPU registers then we'd not have to do 
> kernel_fpu_begin()/end().

Since the registers are caller saved (like the SSE onwards ones)
none of them really need to be saved on syscall entry
(just zeroed on return).
They do need saving on interrupt entry.

For some unknown reason the kernel saves the xyzmm ones on syscall entry.
For normal programs they won't be live - because of the asm syscall
wrapper is called from C.
So I think they can only be live if a system call is directly inlined
into the C function. Just marking them all 'clobbered' would have done.
But it now all too late to change.

	David

> 
> In other words, we'd be doing something close to 'growing task_struct 
> by another struct fpstate', or so - regardless of whether it's in 
> task_struct or some sort of extended pt_regs. The kernel would also be 
> close to 'FPU-safe', i.e. there likely wouldn't be a need for 
> kernel_fpu_begin()/end().
> 
> Thanks,
> 
> 	Ingo
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ