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: <15f56e6a-6edd-43d0-8e83-bb6430096514@citrix.com>
Date: Wed, 3 Jul 2024 17:00:53 +0100
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: Borislav Petkov <bp@...en8.de>, dave.hansen@...el.com
Cc: xin@...or.com, linux-kernel@...r.kernel.org, hpa@...or.com,
 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 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ