From patchwork Fri Apr 21 00:49:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 9691507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C74FE6038E for ; Fri, 21 Apr 2017 00:50:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9F362847C for ; Fri, 21 Apr 2017 00:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEEB428489; Fri, 21 Apr 2017 00:50:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E3EE28480 for ; Fri, 21 Apr 2017 00:50:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033642AbdDUAuR (ORCPT ); Thu, 20 Apr 2017 20:50:17 -0400 Received: from mail-io0-f169.google.com ([209.85.223.169]:36240 "EHLO mail-io0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033580AbdDUAuP (ORCPT ); Thu, 20 Apr 2017 20:50:15 -0400 Received: by mail-io0-f169.google.com with SMTP id o22so104066998iod.3 for ; Thu, 20 Apr 2017 17:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cSwQZOMsCPev0Yci1+Eav0335Zt+8rpj3jUxdNEXti8=; b=K0284YX+r3TOd1D/zjL9f4Ywn8zPHQd74frf63dg8cWotTQnt9CT/cy99e1gTdWYzi scRHqh3ecIh4ytFhxGZt+u5Yv98XVMMidaDHO+cq49MsYbtGtyUZ/AtPvXBPo8YiXEYF 8xAh1fh5xsFd1LFm1FkirMiZPt80Z3XJ1KieCVPPMMUI+oAcDTcQEgH3jUIFyVh/ORsV sIQhammN87h6RUUXGxCB1RvSKRK232TR7r6d8vwZKGGZGpqSCxOTJJUKrGQFOIx7ccMa ML/ddD7l4Paq1NcwsoeZ/4YYIaEtkpZWFFIvTABykkMdqhI3VmS09aWhuyiFwLuyfRJq E7ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cSwQZOMsCPev0Yci1+Eav0335Zt+8rpj3jUxdNEXti8=; b=cwJljD9dwvSTQRk+As4fM8tqBKdiHSiuqHuav15aV/qWLLTzSMWAca5GgAglhOHxAE PbH2cn7DeelyYXs3Lg5OdaqcGDl5xPaHCtZ76QqwIxjiQak+alYog9tEvNxjmp3TtK/W A4yEr5tBAQI3vxltEDUKj3gBEZ7ksHL5vy3T/GcU8qkETdDx8h2kJNGeI6VJK+QnApxp 4UBkUBCAw4pvnNv++fh0rvTDnHQ4I8qnypGCVJsMNQOLym1h2jG6RtEuYTI/UkK5eGGr BaS5gzIsXUvGhajGRaQbZ9fUGPHYKB8aBnYVjxN6gs+KeBMXIlcVNw8FzKKFUiEhYBM7 X+qA== X-Gm-Message-State: AN3rC/5QDmvSsaLv8Njfw1FE8bjCMokVh42oP7hIbs2GdDDuOWi0QOqs 45jMiOc6sOjay7vz X-Received: by 10.98.72.144 with SMTP id q16mr10160544pfi.152.1492735814594; Thu, 20 Apr 2017 17:50:14 -0700 (PDT) Received: from dmatlack.sea.corp.google.com ([100.100.206.82]) by smtp.gmail.com with ESMTPSA id e13sm12466486pfb.30.2017.04.20.17.50.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Apr 2017 17:50:13 -0700 (PDT) From: David Matlack To: kvm@vger.kernel.org Cc: Peter Feiner , David Matlack Subject: [kvm-unit-tests PATCH 07/32] x86: test exit while vmcs02 is loaded Date: Thu, 20 Apr 2017 17:49:39 -0700 Message-Id: <20170421005004.137260-8-dmatlack@google.com> X-Mailer: git-send-email 2.12.2.816.g2cccc81164-goog In-Reply-To: <20170421005004.137260-1-dmatlack@google.com> References: <20170421005004.137260-1-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Feiner Before applying "KVM: nVMX: fix lifetime issues for vmcs0", exiting while vmcs02 was loaded would trigger a VM_BUG_ON. Signed-off-by: Peter Feiner Signed-off-by: David Matlack --- x86/vmx_tests.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index cd18b133a3a3..35af67744971 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -1884,6 +1884,18 @@ int into_exit_handler() return VMX_TEST_VMEXIT; } +static void exit_monitor_from_l2_main(void) +{ + printf("Calling exit(0) from l2...\n"); + exit(0); +} + +static int exit_monitor_from_l2_handler(void) +{ + report("The guest should have killed the VMM", false); + return VMX_TEST_EXIT; +} + /* name/init/guest_main/exit_handler/syscall_handler/guest_regs */ struct vmx_test vmx_tests[] = { { "null", NULL, basic_guest_main, basic_exit_handler, NULL, {0} }, @@ -1914,5 +1926,7 @@ struct vmx_test vmx_tests[] = { disable_rdtscp_exit_handler, NULL, {0} }, { "int3", int3_init, int3_guest_main, int3_exit_handler, NULL, {0} }, { "into", into_init, into_guest_main, into_exit_handler, NULL, {0} }, + { "exit_monitor_from_l2_test", NULL, exit_monitor_from_l2_main, + exit_monitor_from_l2_handler, NULL, {0} }, { NULL, NULL, NULL, NULL, NULL, {0} }, };