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]
Date:   Fri, 12 May 2023 10:46:15 -0700
From:   "Chang S. Bae" <chang.seok.bae@...el.com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Adamos Ttofari <attofari@...zon.de>
CC:     <abusse@...zon.de>, <dwmw@...zon.co.uk>, <hborghor@...zon.de>,
        <sironi@...zon.de>, Ingo Molnar <mingo@...hat.com>,
        Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>, Kyle Huey <me@...ehuey.com>,
        Andrew Cooper <andrew.cooper3@...rix.com>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fpu: xstate: Keep xfd_state always in-sync with IA32_XFD
 MSR

On 5/11/2023 12:11 PM, Thomas Gleixner wrote:
> On Thu, May 11 2023 at 15:28, Adamos Ttofari wrote:
> 
>> @@ -915,7 +921,7 @@ void fpu__resume_cpu(void)
>>   	}
>>   
>>   	if (fpu_state_size_dynamic())
>> -		wrmsrl(MSR_IA32_XFD, current->thread.fpu.fpstate->xfd);
>> +		xfd_update_state(&init_fpstate);

xfd_update_state() here is not a right choice as Thomas pointed out 
multiple times.

> On suspend per CPU xfd_state == current->thread.fpu.fpstate->xfd so it's
> correct to restore the exact state which was active _before_ suspend.
> xfd_state can't be out of sync in that case, no?

Indeed! But, looking around the code, writing 'xfd_state' here appears 
to be consistent and logical I suppose.

Every time writing the MSR in the kernel (except for the init), the 
value is saved in 'xfd_state'. So we don't do it on the sleep path. 
Then, on the wake-up path, perhaps it makes sense to restore the context 
with the saved.

Thanks,
Chang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ