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: <56909a1e-b360-4090-945e-cf6ec623cccc@citrix.com>
Date: Wed, 3 Jul 2024 17:18:24 +0100
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: "H. Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...en8.de>,
 dave.hansen@...el.com
Cc: xin@...or.com, linux-kernel@...r.kernel.org, tglx@...utronix.de,
 mingo@...hat.com, dave.hansen@...ux.intel.com, x86@...nel.org,
 peterz@...radead.org, nik.borisov@...e.com, houwenlong.hwl@...group.com
Subject: Re: [PATCH v1 2/4] x86/fred: Write to FRED MSRs with wrmsrns()

On 03/07/2024 5:06 pm, H. Peter Anvin wrote:
> On July 3, 2024 9:00:53 AM PDT, Andrew Cooper <andrew.cooper3@...rix.com> wrote:
>> On 03/07/2024 4:54 pm, Borislav Petkov wrote:
>>> Dave Hansen <dave.hansen@...el.com> wrote:
>>>> On 7/3/24 01:54, Xin Li (Intel) wrote:
>>>> &gt; Do FRED MSR writes with wrmsrns() rather than wrmsrl().
>>>>
>>>> A longer changelog would be appreciated here.  The wrmsrns() is
>>>> presumably to avoid the WRMSR serialization overhead and the CR4 write
>>>> provides all of the serialization that we need.
>>> Also, all those wrmsrns() writes better be behind a CPUID check.
>> They're not, in Linux.
>>
>> For the $N'th time, here is the primitive that Linux wants to stea^w
>> borrow for this to be sane.
>>
>> /* Non-serialising WRMSR, when available.  Falls back to a serialising
>> WRMSR. */
>> static inline void wrmsrns(uint32_t msr, uint32_t lo, uint32_t hi)
>> {
>>     /*
>>      * WRMSR is 2 bytes.  WRMSRNS is 3 bytes.  Pad WRMSR with a redundant CS
>>      * prefix to avoid a trailing NOP.
>>      */
>>     alternative_input(".byte 0x2e; wrmsr",
>>                       ".byte 0x0f,0x01,0xc6", X86_FEATURE_WRMSRNS,
>>                       "c" (msr), "a" (lo), "d" (hi));
>> }
>>
>> ~Andrew
> I believe tglx declared to use them unconditionally since FRED depends on WRMSRNS (and the kernel enforces that.)

I know that Linux has chosen to have this as a software-enforced
requirement.

The dependency does not exist architecturally, and just because it
happens to be true on Intel processors doesn't mean it's true of other
implementations.

~Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ