Message ID | 20240314232637.2538648-8-seanjc@google.com |
---|---|
State | New |
Headers | show
Return-Path: <kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=suGCtSWm; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=PAUzV/vS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TwlYv4jjyz23s2 for <incoming@patchwork.ozlabs.org>; Fri, 15 Mar 2024 11:32:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID :References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5wC0vIPnGYbDeCiq45BElB59U5nhqCTm8sRLoarsIgc=; b=suGCtSWmKW72U+ SpER3qBpR4uZNR6v5tDJqstXvZiZ2gRJ+XUlnp+zNYp4rnMANy1pn+MxOxz67QZ7e5cc4sBfrPV4X F1mvWKo3isqXk8RnzgOwONXad35qJlpNN+aQ8RifRepGZyQ6HLOhQ/r059tKFlQh8tf9ephviwhd3 3116Kp1LFO2V397gYP5P1V7K+KOe41Uo7EZTG8uD/uH999sYF9Jdf7XUlniKbBN57aTjhYiO358Cx cuG1u4CF4kYAigbUmgKET00JF/Jq/5g3/uG8ZD3xj/ubA0OFLM2CQDHxt8dK/ScG0CDekvRlPh846 FkVKECCx9OVemWLzrsxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkvUQ-0000000GAms-05dt; Fri, 15 Mar 2024 00:32:02 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkuTR-0000000G012-1u5e for kvm-riscv@lists.infradead.org; Thu, 14 Mar 2024 23:27:04 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-dcc05887ee9so2118190276.1 for <kvm-riscv@lists.infradead.org>; Thu, 14 Mar 2024 16:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710458813; x=1711063613; darn=lists.infradead.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=bGD1oHLzIwlI71Um3uWf9rz8YDkt0fT9aZFmZxidv5s=; b=PAUzV/vSfJRkljJvJJVdoBy+eFTx3Mo8vYwMHSjW4oBFmGYiSPZ/mN6KL43WekCIWj BBAPZuoiekVIEhGl4cVktgdly9h0Az7rvg1hbYPsjyZZ+Ja9I9DARa9DTnLnanVfD7Xu gfoLjyjpk9Ic9B5lR5sofpb6gdE2XtgqL2GveyQTNtrcrcr4KiUPZMt5SxZVm2w4TmM0 BwLr/aCi2flTlHHUxEx/6pGeW4RdIJwjGlmfRs3vZ3jrvzi1wwKjtYFE1lVZc5Di1I0m 4QgP6fHLPsky4uiOTm6K0Be0WRANahL3Ol/VssVJZtWQVhCGay0vOCB/4geliE1nAZZW DjHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710458813; x=1711063613; 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=bGD1oHLzIwlI71Um3uWf9rz8YDkt0fT9aZFmZxidv5s=; b=s3KuyeFEBqS2z2GOQAtx0rgGXrPY5HyIydfd4t0hZLSlyBIvrtjWIISpPVkwxD/u3X ov4rJpAtoG2tb9GE3uF2H/DCw9x608qpR9TWW/Z+LpfJq1nzmtTYS12ExiZ/B1GS6MUw I1L7Kj9oraKXL6fnCEuzIDxk0vDU9KVoGUsNHRYqy0Prl49a9V8Lj0IAaJW3Nsz4m9d0 oT6b8pB13o6c0WiKn8P+W5gi6BuZgGI78FIIhwOgoZq/1zBAyKm5APyzovU50Z7udxfo Gd4Me8epSr9MjggiBaHTZRRWk2qBuEPNzN4ju/0MUnaHg6ZBMN0KL0Mxym6FzzNELNAL tc0A== X-Forwarded-Encrypted: i=1; AJvYcCULUGzyo4I3Y9UuKQnihM+C+P1M8fZp8qu/dKcN/DwabilZTsGMhz/wX4+sHV9vNbcFf73ynmMu4Rciq6bgmyYVX2rjRlX54N0QBUY4+g== X-Gm-Message-State: AOJu0YwvD9SFYNd2rrMhl4C1J7G/iw/uG+Jo3n1ARhpZ9DF7siYBg6mV PFVOy+Tg1LMN7z2d+zpCvVGJwzZVRBkR1G8qHpp3WODDtzGHCoeBWyNUHfF0qOmd6nH9NJU6tXy irQ== X-Google-Smtp-Source: AGHT+IEf2SHyoW7Ci/nXvsu/vvl6dD716Be1qw4xm14NPqmYsKQJNpbDJU6sbwjkwsuGTYDcc+4TPOzUy5A= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:1b85:b0:dbe:30cd:8fcb with SMTP id ei5-20020a0569021b8500b00dbe30cd8fcbmr188618ybb.0.1710458812732; Thu, 14 Mar 2024 16:26:52 -0700 (PDT) Date: Thu, 14 Mar 2024 16:26:26 -0700 In-Reply-To: <20240314232637.2538648-1-seanjc@google.com> Mime-Version: 1.0 References: <20240314232637.2538648-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.291.gc1ea87d7ee-goog Message-ID: <20240314232637.2538648-8-seanjc@google.com> Subject: [PATCH 07/18] KVM: selftests: Explicitly clobber the IDT in the "delete memslot" testcase From: Sean Christopherson <seanjc@google.com> To: Marc Zyngier <maz@kernel.org>, Oliver Upton <oliver.upton@linux.dev>, Paolo Bonzini <pbonzini@redhat.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Janosch Frank <frankja@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Sean Christopherson <seanjc@google.com>, Anup Patel <anup@brainfault.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu> Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Ackerley Tng <ackerleytng@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240314_162657_891605_F1B1147C X-CRM114-Status: GOOD ( 12.43 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Explicitly clobber the guest IDT in the "delete memslot" test, which expects the deleted memslot to result in either a KVM emulation error, or a triple fault shutdown. A future change to the core self [...] Content analysis details: (-7.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:b49 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 T_SCC_BODY_TEXT_LINE No description available. -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <kvm-riscv.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/kvm-riscv>, <mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/kvm-riscv/> List-Post: <mailto:kvm-riscv@lists.infradead.org> List-Help: <mailto:kvm-riscv-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/kvm-riscv>, <mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe> Reply-To: Sean Christopherson <seanjc@google.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kvm-riscv" <kvm-riscv-bounces@lists.infradead.org> Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
KVM: selftests: Clean up x86's DT initialization
|
expand
|
diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/testing/selftests/kvm/set_memory_region_test.c index 06b43ed23580..9b814ea16eb4 100644 --- a/tools/testing/selftests/kvm/set_memory_region_test.c +++ b/tools/testing/selftests/kvm/set_memory_region_test.c @@ -221,8 +221,20 @@ static void test_move_memory_region(void) static void guest_code_delete_memory_region(void) { + struct desc_ptr idt; uint64_t val; + /* + * Clobber the IDT so that a #PF due to the memory region being deleted + * escalates to triple-fault shutdown. Because the memory region is + * deleted, there will be no valid mappings. As a result, KVM will + * repeatedly intercepts the state-2 page fault that occurs when trying + * to vector the guest's #PF. I.e. trying to actually handle the #PF + * in the guest will never succeed, and so isn't an option. + */ + memset(&idt, 0, sizeof(idt)); + __asm__ __volatile__("lidt %0" :: "m"(idt)); + GUEST_SYNC(0); /* Spin until the memory region is deleted. */
Explicitly clobber the guest IDT in the "delete memslot" test, which expects the deleted memslot to result in either a KVM emulation error, or a triple fault shutdown. A future change to the core selftests library will configuring the guest IDT and exception handlers by default, i.e. will install a guest #PF handler and put the guest into an infinite #NPF loop (the guest hits a !PRESENT SPTE when trying to vector a #PF, and KVM reinjects the #PF without fixing the #NPF, because there is no memslot). Note, it's not clear whether or not KVM's behavior is reasonable in this case, e.g. arguably KVM should try (and fail) to emulate in response to the #NPF. But barring a goofy/broken userspace, this scenario will likely never happen in practice. Punt the KVM investigation to the future. Signed-off-by: Sean Christopherson <seanjc@google.com> --- tools/testing/selftests/kvm/set_memory_region_test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)