From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA51D38E129 for ; Tue, 24 Feb 2026 16:54:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771952041; cv=none; b=fk4kvmDkaiktIuKCSIlJZMawTIDpxGmnVpuYe5KVpSq4wk/Akuz5UNNxcx9ZCpSiUuAmRhiBkNpq5NuU4wxvA3EpK8qKiRLTujWjyS7EiXJEPWcZDd5sq7UFZEdfjJBEkvtRgbZ4xA9uQQc6ejE8bGyJl2+MYL2HA1my1ijK5Fc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771952041; c=relaxed/simple; bh=dxdLkEr9HO1lfK5ZRmtSdayjHPORyjOrNXj4iGn7ucQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lD+wtOiC00Q397thb5HnDf0b7J9fj0+NZ2Byd4ZDMwCShAKJ2EIpLE/1WoISzKPJ9JQs9R+dMkWj2Rk+ojNdeovxIclAgIWZYUlKt4iQ2eETQ0yaN4lD0KQfHk1fQD58Sb4+WQo3L8/RrUo1XvT2ZW1gYQYITtpT6gE7gNBiZHQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1ozOKkeH; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1ozOKkeH" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2a75ed2f89dso54101525ad.1 for ; Tue, 24 Feb 2026 08:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771952040; x=1772556840; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Fx3rYBrGAPp95i6QwzqVGUinfO1R1iWt+5aDys+G0f8=; b=1ozOKkeHN+HBO484h3+L7AzU4+G/4TKIknVeSss5doNbOlzeVC4zmttGL0cbTRL7pb 8PFRYMt2IgZt9/1RULB0fAFWycENfFEhRlzM3IDTLgaamQrrMmIUVhIba+i2f2pSYkqw rlPIVh37/8gdUkUHbF4y1ZzLRcOFQzU741TAK7yW8rxENA672ESsVyAcjxK3ZDWSbTrN NcqsFir9vgsMnukXo0+IjAsWMdMYErktEntn4aItCCchLOYaDFEYd6lmTtT32biYifSm JxaHG85w8J3PL7GHGwby0DcKHFNS51h4+frj5InuNNzARj+T6XsvVS1RXuwjAiJnE47x x2xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771952040; x=1772556840; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Fx3rYBrGAPp95i6QwzqVGUinfO1R1iWt+5aDys+G0f8=; b=fv0vhRI7U+MujvETYeYMf/UhLDPq32WONw7U04/5taNKYKC3C6dn8dU6sv7x1SrzVQ jpe6b+2vDc/vuqrkVpNyR6Oqhp9Q8TZJMl6SgPfcuLmaXBK1Uql3qo5P81MJKxTwnsLT VS87uZauo90i0VnNSN+pgxxMJ2fZ5Nwf2uFpSVOipZd51VLocRraMgH9XZNYSUmitxoX 07PbRvU3HBRS9vtrGglZVtO+CNncNAKtDchAU9WFMjhSMAKB5YNSTZzKqfOIfmwxzUde DMxFBIswMSrKbXXQgEfvX9MCejOihRWHSBpnHQF/E3u9m2tEoE1dFC0bFITIlAO/o1XB 2UoA== X-Forwarded-Encrypted: i=1; AJvYcCVpgCn4wlpur8F+OoEziFhO8ABmsI4zkctArRLwiHyW/uhUom31UiXgRDudlJhi5hBsLSnSx0R/dYbwPJU=@vger.kernel.org X-Gm-Message-State: AOJu0YxTo+6lCf7YJX0uusBsVTWzo1Hp8JRn9TL0IRAtfMfGNQTfooCE qo4fmNa/AxqeAAhFmLCIMMOvS5AtdB6EoDCX6ChuVfi2SGTEosA55AW48yQp5th/PSUlg2umXh2 Bl84UGg== X-Received: from plil12.prod.google.com ([2002:a17:903:17cc:b0:2a0:96e9:38e3]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:e542:b0:2aa:ecec:a43d with SMTP id d9443c01a7336-2ad744a0062mr148401575ad.21.1771952040020; Tue, 24 Feb 2026 08:54:00 -0800 (PST) Date: Tue, 24 Feb 2026 08:53:58 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260224071822.369326-1-chengkev@google.com> <20260224071822.369326-3-chengkev@google.com> Message-ID: Subject: Re: [PATCH V2 2/4] KVM: SVM: Fix nested NPF injection to set PFERR_GUEST_{PAGE,FINAL}_MASK From: Sean Christopherson To: Kevin Cheng Cc: pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, yosry.ahmed@linux.dev Content-Type: text/plain; charset="us-ascii" On Tue, Feb 24, 2026, Sean Christopherson wrote: > > diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h > > index 37eba7dafd14f..f148c92b606ba 100644 > > --- a/arch/x86/kvm/mmu/paging_tmpl.h > > +++ b/arch/x86/kvm/mmu/paging_tmpl.h > > @@ -385,18 +385,12 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, > > real_gpa = kvm_translate_gpa(vcpu, mmu, gfn_to_gpa(table_gfn), > > nested_access, &walker->fault); > > > > - /* > > - * FIXME: This can happen if emulation (for of an INS/OUTS > > - * instruction) triggers a nested page fault. The exit > > - * qualification / exit info field will incorrectly have > > - * "guest page access" as the nested page fault's cause, > > - * instead of "guest page structure access". To fix this, > > - * the x86_exception struct should be augmented with enough > > - * information to fix the exit_qualification or exit_info_1 > > - * fields. > > - */ > > - if (unlikely(real_gpa == INVALID_GPA)) > > + if (unlikely(real_gpa == INVALID_GPA)) { > > +#if PTTYPE != PTTYPE_EPT > > I would rather swap the order of patches two and three, so that we end up with > a "positive" if-statement. I.e. add EPT first so that we get (spoiler alert): > > #if PTTYPE == PTTYPE_EPT > walker->fault.exit_qualification |= EPT_VIOLATION_GVA_IS_VALID; > #else > walker->fault.error_code |= PFERR_GUEST_PAGE_MASK; > #endif Scratch this comment, I got my walkers confused.