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: <b707bf9c-14b6-e210-2da8-c5d01d36d804@amd.com>
Date: Mon, 21 Oct 2024 12:10:55 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Borislav Petkov <bp@...en8.de>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
 Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
 Dave Hansen <dave.hansen@...ux.intel.com>,
 Michael Roth <michael.roth@....com>, Ashish Kalra <ashish.kalra@....com>
Subject: Re: [PATCH v3 2/8] x86/sev: Add support for the RMPREAD instruction

On 10/21/24 10:41, Borislav Petkov wrote:
> On Fri, Oct 18, 2024 at 10:14:04AM -0500, Tom Lendacky wrote:
>> I don't think so. RCX does not change on output, the contents that RCX
>> points to changes, but the register value does not so the "+" is not
>> correct. The instruction doesn't take a memory location as part of
>> operands (like a MOV instruction could), which is why the "memory" clobber
>> is specified.
> 
> Just confirmed it with my compiler guy: yes, you're right. The rule is this:
> *if* RCX itself doesn't change but memory it points to, does change, then you
> need the "memory" clobber. Otherwise the compiler can reorder accesses.
> 
>> For RAX, yes, if I set "ret" to the input value then I can use "+"
>> specification. But the way it's coded now is also correct.
> 
> If you set ret, it means a smaller and simpler inline asm which is always
> better.

The input value is a 64-bit value and on output the return code is in
EAX, a 32-bit value. So the use of the "=a" (ret) for output and "a"
(pfn << PAGE_SHIFT) for input is more accurate.

It's not a complicated statement and is much clearer to me.

I can change it if you really want the "+a" thing (including changing
the ret variable to a u64), but would prefer not to do that.

Thanks,
Tom

> 
> :-)
> 
> Thx.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ