Received: by 2002:a05:7208:20d2:b0:82:bbfa:f723 with SMTP id z18csp56229rbz; Tue, 7 May 2024 10:22:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtNnE+p0BgW1EA+r7V25TXgmk0ZpGwLJIasavIKSGErIjAy6HFdaan4PvGeVhwGtPWMcNAzPSo3aQQlTnfoVkqe5gzhQVgddK+j1zTOQ== X-Google-Smtp-Source: AGHT+IE7otAT6D3kRIe62S9hpYDSrPF3vJnoyJQLGs3pZKjTTmlTq9/pNyGom6O2aZ7Es5uF0px6 X-Received: by 2002:a17:902:bf03:b0:1e7:b7a7:9f20 with SMTP id d9443c01a7336-1eeb088d207mr2902445ad.59.1715102544303; Tue, 07 May 2024 10:22:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715102544; cv=pass; d=google.com; s=arc-20160816; b=v5RFEc1quleFIYgzAbetR9xQuCdY7irWjma8nBm+ITlx/jQZR8N+cHUIwNvP0s28bP 86pUr+nVB9LLm2yHA7emIN+pYqbB75Zj06AGjydhPfl8tK5gaENl0hgYdHTHSnshv1MO Rz70KYgQq5QM+UDbaJ7VXGKQYPGTTQHrEZfa7ROce17Jen1efDbJJYKPtqdJC7z5qxok bEXOlkACHRqeYzh7uNq6UREerrAv6s1IM3l+iWEfO6qVqphPYVUewy41llJt0WVViBYP y6WkSUp1px3f8RxHxjTxsFyOPYVnIOrfs1ZM8N0DF9uwEXLDhJXr8xlPyW9hkBlDmMZ+ KMlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=00bIdkKU7IiQvRDc2CeuHoJggB43wbBXZ1HWrMjjV7o=; fh=ZzFhOPU4F3Fa2UhGVAjpaB/PrQqmJJmai45vQY5deVI=; b=e+1/vhqLd6Fyj50/inZGFb442dFyTUMK+Zuu79N8t0FQvKOgU3pahqYDy1zy6fgZ/J De8JM1TigiFkPALQw2SZFcVEItp7yHX3wFW0K9uYbDLiELBYJYOP60wOwH28GvlH3wr3 MTBjRky22UireCcnGkJ21KGHppS64bSYWfTcctazuwWucOOEyNVhEozQBn2vK2v2DA0H Y9zd82gmodfDS5xHABvqI5E7RzikxE6yBjD6209t6Ii3KkyvMnuht9+/v0ybuKYKofWe lUMi+x9xQlSI02f3g4ze3LppuCU01hkSGoKHBf+GUJnBurltVZ48I5NRMYQqo5uZI/e/ CQAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T3fZdWd1; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-171749-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171749-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p11-20020a170902e74b00b001ec3bf71870si8333965plf.89.2024.05.07.10.22.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 10:22:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171749-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T3fZdWd1; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-171749-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171749-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0934C288E6F for ; Tue, 7 May 2024 16:02:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 080D1168AEB; Tue, 7 May 2024 15:58:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T3fZdWd1" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 393E716C68B for ; Tue, 7 May 2024 15:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715097506; cv=none; b=IniU+RV7Uh7J42mD/LwZDJJGmgQJzFB7lBEHiPx3MDbQE+Pql7oSdRJcHIkRQ+r5q8FnjPhR564DShXkOJeQ/2M4zR5FK0cJWmWXN5e9WaA5yCMf+9TTVo3RTZt69yMeSei1VTTcgfQGWFwj2DmGAVl9P8P5Ihlcnu5EvQvP/LI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715097506; c=relaxed/simple; bh=ODFZZ8d+SWP0XNs2wsvqmCW7R0GYR0Ecn26Iz0CsQ3Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WPznVJSHV/bcBs76DRZEWyOZEFbc86IyfN2NL1temNgMripOCjP/QPcFW7MSGEIkiKl+cKUmcaRNjOyP+9G4Klsv3U8Y1UagnifhfWM8FC/bBvbGQbglctF8Ig9JrBw4jHWQYOnVX9CjyUzDd+S6Oc6flPL4oBxK5GHxGL2ZOz0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=T3fZdWd1; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715097503; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=00bIdkKU7IiQvRDc2CeuHoJggB43wbBXZ1HWrMjjV7o=; b=T3fZdWd1myoTWopQlGOG/kuIna+wwFN30uqYXVIb4S8amB39281wc8Y5sAZA9rHJ/wqYxr zbtKZop+7HenEbylkOA95mfdmEWmAmLt19X3yMwKzMgC9DQlRr9PzZ5d3U08u9EO3KVukj Sf2pF8Q2+yEtmvVvQEiYKaAX2YbRzbc= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-241-uw8ZhJCAO229GeyubDCfVg-1; Tue, 07 May 2024 11:58:19 -0400 X-MC-Unique: uw8ZhJCAO229GeyubDCfVg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78D113C3D0CF; Tue, 7 May 2024 15:58:19 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C962200C7D5; Tue, 7 May 2024 15:58:19 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson Subject: [PATCH 09/17] KVM: x86/mmu: WARN and skip MMIO cache on private, reserved page faults Date: Tue, 7 May 2024 11:58:09 -0400 Message-ID: <20240507155817.3951344-10-pbonzini@redhat.com> In-Reply-To: <20240507155817.3951344-1-pbonzini@redhat.com> References: <20240507155817.3951344-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 From: Sean Christopherson WARN and skip the emulated MMIO fastpath if a private, reserved page fault is encountered, as private+reserved should be an impossible combination (KVM should never create an MMIO SPTE for a private access). Signed-off-by: Sean Christopherson Message-ID: <20240228024147.41573-9-seanjc@google.com> Signed-off-by: Paolo Bonzini --- arch/x86/kvm/mmu/mmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index d52794663290..0d884d0b0f35 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -5819,6 +5819,9 @@ int noinline kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u64 err r = RET_PF_INVALID; if (unlikely(error_code & PFERR_RSVD_MASK)) { + if (WARN_ON_ONCE(error_code & PFERR_PRIVATE_ACCESS)) + return -EFAULT; + r = handle_mmio_page_fault(vcpu, cr2_or_gpa, direct); if (r == RET_PF_EMULATE) goto emulate; -- 2.43.0