From nobody Mon Nov 25 21:26:37 2024 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.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 97B9C25566 for ; Wed, 28 Feb 2024 02:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709088139; cv=none; b=KocNDApRuuS/TEzmoPnpdr51nyaWQql4v0wOY3nau2fzzKRk5Ub5uk6uqdiesGbLadi8II4sWMcbQwOyFmtIzpE+nUtAy0S/gC5CC1f8dXcI7ybLOqfyzhD1Gg6atWm0IVkSTVTazFmkA/Cqcka6Rk7frj7PiZ7k8FfITSDBjQM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709088139; c=relaxed/simple; bh=JLsN4xg251qE9a3MZGdWpvkmGCZsQVcBJtHNmsnHqx0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=D+8up5P0Cwk7Z13SaB82BFsiLSw1intS5mt9FsVk4eQIzkUg2G37rXYQ+AWa9nCjgDxwrYEnkvvLZ7oG3rkMiNfVs4Zns+dvS7GkqYe4OpbRyd1mPHq042OwS6lipGVijYyvIeTgprhaJaIQ3aVgAxN5gz0s5XZWegdnRKYMcig= 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=B2DwrAqe; arc=none smtp.client-ip=209.85.215.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="B2DwrAqe" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5cf555b2a53so304953a12.1 for ; Tue, 27 Feb 2024 18:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709088137; x=1709692937; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=za8QaygzoKIY5MyMe/Z2Ubm1oLIN1MbBZtglXwIHigs=; b=B2DwrAqeZ3hxUE5PrHwB//zObnj3gOVUrBHZ7xlBCCpYJwsaZsujU1Wd6wRYLYKFVQ ciPVYnK1SHSFjRSfWcz7DzJ+KuBdcNZaVAp6YQxNlQrmZ9ozftnUOEf9bEVq6FwNyGZT uUcqGZbU2HNYM7KrHo3KmJ3Inmi3YIJoXDEDlrG5x1iddFnp9C48nEQ/1+7Hl1TrilfH 1qri28/ll7THvl6UBOzAy/IWkLi/YqZIdINLf52ijL2HEPWA9UL9M785vvTRjSWr1j7t FZnkQP1xBcX2LzHqHTFuGrsctfXMggNxh6HQiut930hQsKBmCOHK/+EpKSutmNoTP26H Gtuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709088137; x=1709692937; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=za8QaygzoKIY5MyMe/Z2Ubm1oLIN1MbBZtglXwIHigs=; b=e5ejnIR19Qolhbca8xPcAiE4CbjHHKo2gqnykfGQP4zQdHu+hk08fwW8bTEPMPWoso pBzXER+rdMAwcnFKgfZfayC5Y0tRgKQcY64ewfYy7bILtzapPoxjCJzt3rDfoFb+f02j JFoijE5mhM0K9wgj/TC1Oh6CYDR/GVWvdkcutsFssTH8GEGCisPxzE1IEWdIEA7ykhBE zauMEnHfQurhBYL9k24/t0Shu6YldrbIurO46m8kvoEGd3tCdU9slFjGbMCAd4R1024s WRdTrhlSxtxmp8TLVOh2wZfdyKSyYnTMA8V0m6Tjy9u0l/opz/CmPwupEhYSWMPYXxRz m6Lw== X-Forwarded-Encrypted: i=1; AJvYcCUsxrvWt2GowtecU3FClGzQ9D/+V1tCQhp8tFei36SlZA1l9M6+HZCcrTGgDPe5pSlxbewzX/Use7VU4KVAUIWfou0QmmW9IzAsByxM X-Gm-Message-State: AOJu0YyPEzk4xvq0m7NGWnYglDKa2dfpQYfSpRcgfoln/1LjOEagSyOx Kf+nfj956sqDynlN1KGbNWg4tmc1odlun0V/MEB0L+RBKbXMz7cPiLw+jP9CTMswPws1IPyCdxa 8cA== X-Google-Smtp-Source: AGHT+IEmZWdUDpfZFtSaGW+CNF5X12KqObi0fTpi5HyUpexKv6qJR0Hv72mZ7zAGZ81rRBqkZor7Gh8nLJE= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:fa83:b0:1db:a739:d17b with SMTP id lc3-20020a170902fa8300b001dba739d17bmr2743plb.1.1709088136837; Tue, 27 Feb 2024 18:42:16 -0800 (PST) Reply-To: Sean Christopherson Date: Tue, 27 Feb 2024 18:41:45 -0800 In-Reply-To: <20240228024147.41573-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240228024147.41573-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240228024147.41573-15-seanjc@google.com> Subject: [PATCH 14/16] KVM: x86/mmu: Set kvm_page_fault.hva to KVM_HVA_ERR_BAD for "no slot" faults From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yan Zhao , Isaku Yamahata , Michael Roth , Yu Zhang , Chao Peng , Fuad Tabba , David Matlack Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Explicitly set fault->hva to KVM_HVA_ERR_BAD when handling a "no slot" fault to ensure that KVM doesn't use a bogus virtual address, e.g. if there *was* a slot but it's unusable (APIC access page), or if there really was no slot, in which case fault->hva will be '0' (which is a legal address for x86). Signed-off-by: Sean Christopherson Reviewed-by: Kai Huang --- arch/x86/kvm/mmu/mmu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 4dee0999a66e..43f24a74571a 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -3325,6 +3325,7 @@ static int kvm_handle_noslot_fault(struct kvm_vcpu *v= cpu, fault->slot =3D NULL; fault->pfn =3D KVM_PFN_NOSLOT; fault->map_writable =3D false; + fault->hva =3D KVM_HVA_ERR_BAD; =20 /* * If MMIO caching is disabled, emulate immediately without --=20 2.44.0.278.ge034bb2e1d-goog