From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A81C3016F7 for ; Fri, 15 May 2026 06:36:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778826969; cv=none; b=A5ASoHmKJNSb1Yf5z04vAIfZhHIpl15KoJQKjo5b5Lb+n1jZD2yW1EGpLwS/RhXjDOPf24Jru9NgrPsyuJ2RgzUuCH199LgcFhtue/QUx9TE+EiIasaWoJOdATNRkLAUnnbDT7OsYzPmf7eNWrT99R4KZZpBkyAvEaKY/bbiuMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778826969; c=relaxed/simple; bh=+4AeulQzD37kZOUE28U9l/cmQsoYUzC1yxLCdrk2Bko=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aktnx4q1OXg2Etyjpigdkg/S1EygfQTgxTp3UhMV/TLI8KB2bK+XnCkhOHxnDyk6+pxF7GtiCZxGjcqNkKBVLlPzwgZKUUzZSUg2SrBrmovXTReewIGpmPmEbPK1+HdVGjPpfO3Q8GmTx/7rxYjW/46ZFySeuxnK3imoimP9ks0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XnuwxVGh; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XnuwxVGh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778826968; x=1810362968; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=+4AeulQzD37kZOUE28U9l/cmQsoYUzC1yxLCdrk2Bko=; b=XnuwxVGhoymaoAVY0UT+kR2UysnRQphHk6aVpturoVCB9yxUfpilhiHC IZDQIFg7jbwJ2VljL4eXO4uxrBxljMKUkDsfdQ6dtVui1GZIzmDGvoZaL PlHqi5QoF7mn4/vFup3qmlmzoGh8eerXvTnZrD65rjk6oXodTbRn8dWrt OHH9TEd6VzkKZt23aPDlAjByWkLupmVE/5/drUUWOW+YBAj2nZoWk+DDc AJqUvHdL1AjuuHYvOBrRS7XYuq6RY6evtxFH5OzLdGk+Svd2L6jp2tMwO ESznN1arbMB8k7eJ9KK6lP9eR+tjDUMmED3ym9S3lRH85MSNEPfAG74+G Q==; X-CSE-ConnectionGUID: efgogBkgRWaVe4phBqPH0g== X-CSE-MsgGUID: vNPNtmwzSOe99PMBxa/lug== X-IronPort-AV: E=McAfee;i="6800,10657,11786"; a="79673185" X-IronPort-AV: E=Sophos;i="6.23,236,1770624000"; d="scan'208";a="79673185" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2026 23:36:08 -0700 X-CSE-ConnectionGUID: 8V/pLRLDQqqQ2zugjXMBGw== X-CSE-MsgGUID: 4wgy2oNtQl6dgThe2YslJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,236,1770624000"; d="scan'208";a="232217271" Received: from binbinwu-mobl.ccr.corp.intel.com (HELO [10.124.240.207]) ([10.124.240.207]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2026 23:36:03 -0700 Message-ID: <784d6d93-07d9-4fe7-a531-957fa45c9b69@linux.intel.com> Date: Fri, 15 May 2026 14:36:01 +0800 Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 01/15] KVM: SVM: Truncate INVLPGA address in compatibility mode To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Kiryl Shutsemau , David Woodhouse , Paul Durrant , Dave Hansen , Rick Edgecombe , kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Yosry Ahmed , Kai Huang References: <20260514215355.1648463-1-seanjc@google.com> <20260514215355.1648463-2-seanjc@google.com> Content-Language: en-US From: Binbin Wu In-Reply-To: <20260514215355.1648463-2-seanjc@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/15/2026 5:53 AM, Sean Christopherson wrote: > Check for full 64-bit mode, not just long mode, when truncating the > virtual address as part of INVLPGA emulation. Compatibility mode doesn't > support 64-bit addressing. > > Note, the FIXME still applies, e.g. if the guest deliberately targeted > EAX while in 64-bit via an address size override. That flaw isn't worth > fixing as it would require decoding the code stream, which would open a ^ an extra 'a' > an entirely different can of worms, and in practice no sane guest would > shove garbage into RAX[63:32] and execute INVLPGA. > > Note #2, VMSAVE, VMLOAD, and VMRUN all suffer from the same architectural > flaw of not providing the full linear address in a VMCB exit information > field, because, quoting the APM verbatim: > > the linear address is available directly from the guest rAX register > > (VMSAVE, VMLOAD, and VMRUN take a physical address, but they're behavior ^ their > with respect to rAX is otherwise identical). > > Fixes: bc9eff67fc35 ("KVM: SVM: Use default rAX size for INVLPGA emulation") > Reviewed-by: Yosry Ahmed > Signed-off-by: Sean Christopherson Reviewed-by: Binbin Wu > --- > arch/x86/kvm/svm/svm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c > index e74fcde6155e..4ad87f8df392 100644 > --- a/arch/x86/kvm/svm/svm.c > +++ b/arch/x86/kvm/svm/svm.c > @@ -2415,7 +2415,7 @@ static int invlpga_interception(struct kvm_vcpu *vcpu) > return 1; > > /* FIXME: Handle an address size prefix. */ > - if (!is_long_mode(vcpu)) > + if (!is_64_bit_mode(vcpu)) > gva = (u32)gva; > > trace_kvm_invlpga(to_svm(vcpu)->vmcb->save.rip, asid, gva);