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: <ZFyLAGastgJ5NGrN@chao-email>
Date:   Thu, 11 May 2023 14:28:16 +0800
From:   Chao Gao <chao.gao@...el.com>
To:     Binbin Wu <binbin.wu@...ux.intel.com>
CC:     <kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <seanjc@...gle.com>, <pbonzini@...hat.com>, <kai.huang@...el.com>,
        <robert.hu@...ux.intel.com>
Subject: Re: [PATCH v8 5/6] KVM: x86: Untag address when LAM applicable

On Wed, May 10, 2023 at 02:06:10PM +0800, Binbin Wu wrote:
>Untag address for 64-bit memory/MMIO operand in instruction emulations
>and VMExit handlers when LAM is applicable.
>
>For instruction emulation, untag address in __linearize() before
>canonical check. LAM doesn't apply to addresses used for instruction
>fetches or to those that specify the targets of jump and call instructions,
>use X86EMUL_F_SKIPLAM to skip LAM untag.
>
>For VMExit handlers related to 64-bit linear address:
>- Cases need to untag address
>  Operand(s) of VMX instructions and INVPCID.
>  Operand(s) of SGX ENCLS.
>- Cases LAM doesn't apply to
>  Operand of INVLPG.
>  Linear address in INVPCID descriptor (no change needed).
>  Linear address in INVVPID descriptor (it has been confirmed, although it is
>  not called out in LAM spec, no change needed).
>
>Note:
>LAM doesn't apply to the writes to control registers or MSRs.
>LAM masking applies before paging, so the faulting linear address in CR2
>doesn't contain the metadata.
>The guest linear address saved in VMCS doesn't contain metadata.
>
>Co-developed-by: Robert Hoo <robert.hu@...ux.intel.com>
>Signed-off-by: Robert Hoo <robert.hu@...ux.intel.com>
>Signed-off-by: Binbin Wu <binbin.wu@...ux.intel.com>
>Tested-by: Xuelian Guo <xuelian.guo@...el.com>

Reviewed-by: Chao Gao <chao.gao@...el.com>

>--- a/arch/x86/kvm/kvm_emulate.h
>+++ b/arch/x86/kvm/kvm_emulate.h
>@@ -230,6 +230,8 @@ struct x86_emulate_ops {
> 	int (*leave_smm)(struct x86_emulate_ctxt *ctxt);
> 	void (*triple_fault)(struct x86_emulate_ctxt *ctxt);
> 	int (*set_xcr)(struct x86_emulate_ctxt *ctxt, u32 index, u64 xcr);
>+
>+	void (*untag_addr)(struct x86_emulate_ctxt *ctxt, u64 *addr, u32 flags);

Nit: using 'gva_t *' as the second parameter would eliminate the need to
cast to 'u64 *' repeatedly.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ