From nobody Sun Jun 14 04:10:28 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 BBEC934C9A6 for ; Sun, 3 May 2026 20:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777838953; cv=none; b=I6dUYpHJE32RSAgZMgYljnnVPBL8zzi0Nffa53F9S1QkxOC2bK6RBgWyAhNtV8CrC+Ky8KgKjF2rTKn0AapkYVO0VsijlNEK1ogA3Y2lJgcEUIvbyai/MW3NIlw4nc8bxS/GxXCuIRR15ljD63zrtkBvuggM1M0T67cvSzvBBEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777838953; c=relaxed/simple; bh=oOi3H+m0S3nG3y+tRC2W4XyeP4p8ekL5EgzM1Dix+vc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Ll75aVtMNw/sd3Yys5zqAeMIBhccRqHV122/pX8a2U35lCc0buSS716mUA0Oy9iNjJSrObV4gpUPC9QVIqpV8jYAjg9kX51OA2aw4qxfYWm/jfagH6PJyibg2n8nDViw/dTBGyfBYfy2vqG9LSe9jJPsrg8VhkXLqhawcNMdmjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QYCZwgly; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Jf+5DocZ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QYCZwgly"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Jf+5DocZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777838950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=2r5G2c1iaCHwo5jhUQua5IUe/K7Qy+faxKLRNRyePd4=; b=QYCZwgly6CKAu+fPLoooFFKx8CfTWun+P6C2QOD53wAJfsQS8aImNJf1HvQQhXOdRGAWmW 80D535SyH65tNr8zQ+CKokE2qkvJp/XjOhALeo5u8Vkfgwi5+bD5/3ENgkm15IP7pzGtq8 bZ3pLAxzhj1v0Iu9Su77Lm4nWpDgzY0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-C-ZwACVCOuGVzVtiD8M1Eg-1; Sun, 03 May 2026 16:09:08 -0400 X-MC-Unique: C-ZwACVCOuGVzVtiD8M1Eg-1 X-Mimecast-MFC-AGG-ID: C-ZwACVCOuGVzVtiD8M1Eg_1777838948 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-48a7994e8ddso33888235e9.0 for ; Sun, 03 May 2026 13:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1777838947; x=1778443747; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2r5G2c1iaCHwo5jhUQua5IUe/K7Qy+faxKLRNRyePd4=; b=Jf+5DocZBKir2W67Mx4kvwn4uUheFsan1OOJ0Z4c6CKUYYRLNMC3O7vXgkamyXoQht Mj+36oi4gkaUpe1vy9yaPKCmZOBZFiEpfimeBoX8Jgk8tk0+THNBOSb5nO14ezL/xZ9f w5VQjHtIJuVM6Aky+B7SrVZd+TxRvkvEvqxd8Taf8cbL0aQF/k5lCqjhvEtGyP1+zdb1 dUGaQgVS59g3gEIHFhiOBWE66QPOLa9qGwF8EhrwwpfKrYsmfLcoAvr1/PlUit4pERK7 FW1lDKdVb6DV7ACPqglRo8LjC7aM5YqYe5y4MK+V5l0hck3iA+HcRoYRheUPyp+GIOuL lZbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777838947; x=1778443747; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2r5G2c1iaCHwo5jhUQua5IUe/K7Qy+faxKLRNRyePd4=; b=FmIOLT5us7FtKuGIeydld3nR4ZILtqTZNdj9mp3ofII2QpapbhnZZkpRikoCZvqtAx y/kSgYUgjiLrm3taOlENF+kaDLIfELzeL6u66C+on1g/OnxGu4p2cNPt5zups2a+g93N 0AK4dhuogCZfykTXCiWPUiw8HAODg/zg+pUnRx7M/n5XGgp2U25JbgLTCvDl1V5zt2NL 8L1GpEbkxbvzj6TsPqYDNDYifriVS666dheP5akKK5EYKk8NuZPrKEKHLM3LYSxle4bq tyzKSASmmMTCnjrqrueBWGJGG3bhXjKYIy2ijs07SIuqd3vLkCpCK20cZQq9UQAkZAuh z6dQ== X-Gm-Message-State: AOJu0YxTBR/F90dF8QRteBhJkIixl/OMBa9k5DUwtTioRWhf0X+tRRL3 vCVN6e+RITJ2DRw0H+gZDuT1qRcoPXvW1jhrfWdNA3iXz0YWBzpzVR0vrobJuooLNpThRu2lHI3 wbVKP0jtonADVz8QZUu7eyvLwiHxgIyR3bTo/OiSpf/rEZwOzlKN1h8hRx8LfO1Lr33D1kr+xlI TEjsN8BtK0shPidLq/2CbFgHspSDFylYpeBL836aRuHOa4R9w7Ug== X-Gm-Gg: AeBDiesG5QglYDrODUgdCdQtokiBozuQPJu/w4odmIt30dUkU1k8mHzLMWHDea1hqO5 977vrqdnoWMSOep4MYX7yCySxEJ7gqT6QlAdvf1B/XSAVT2ekAyPaHraneirEOkEsWnQz9UtTOR DNO7WA0NcPDsv0T9Q/YAVfYNgBb+otRtMkmASh6j9F2RGAYi1cXmUgQBP5po5TeZfFg+jahe503 4vrMBUBtz6jGisbN6KzpvggT76Zfp8RFI7KmKucTbx1aaupz+8QOItNjtNJKVhfzkufZyYLcz7o wGTkM6VRaO3kIdmwl61KCUtRR2YwnwK4DobHF/5lHyNBPw8GXxOfaaxqLxLByurjAAHxqxHViCX xkcT4OKfcHJ4WAFXsD2kDoP9Io0QMIHTXF9CdFKSEBOLllcR4PtW12gFGIz+ye7M0mg12ajEdS8 JyRgAhp2QABEM+j9DOKY4wYVp5Oahh3up38Vo= X-Received: by 2002:a05:600c:348a:b0:488:c744:49b with SMTP id 5b1f17b1804b1-48a98637f79mr114920715e9.7.1777838947174; Sun, 03 May 2026 13:09:07 -0700 (PDT) X-Received: by 2002:a05:600c:348a:b0:488:c744:49b with SMTP id 5b1f17b1804b1-48a98637f79mr114920505e9.7.1777838946767; Sun, 03 May 2026 13:09:06 -0700 (PDT) Received: from [192.168.10.48] ([151.49.85.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a8fef2a67sm86407655e9.5.2026.05.03.13.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2026 13:09:06 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: stable@vger.kernel.org, Sean Christopherson Subject: [PATCH] KVM: x86: check for nEPT/nNPT in slow flush hypercalls Date: Sun, 3 May 2026 22:09:05 +0200 Message-ID: <20260503200905.106077-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Checking is_guest_mode(vcpu) is incorrect, because translate_nested_gpa() is only valid if an L2 guest is running *with nested EPT/NPT enabled*. Instead use the same condition as translate_nested_gpa() itself. Cc: stable@vger.kernel.org Reviewed-by: Sean Christopherson Fixed: 3e300570b42a ("KVM: x86: check for nEPT/nNPT in slow flush hypercall= s", 2026-05-03) Signed-off-by: Paolo Bonzini --- arch/x86/kvm/hyperv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 9b140bbdc1d8..4438ecac9a89 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -2040,7 +2040,7 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *vcpu, st= ruct kvm_hv_hcall *hc) * flush). Translate the address here so the memory can be uniformly * read with kvm_read_guest(). */ - if (!hc->fast && is_guest_mode(vcpu)) { + if (!hc->fast && mmu_is_nested(vcpu)) { hc->ingpa =3D translate_nested_gpa(vcpu, hc->ingpa, 0, NULL); if (unlikely(hc->ingpa =3D=3D INVALID_GPA)) return HV_STATUS_INVALID_HYPERCALL_INPUT; --=20 2.54.0