From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1410CC433FE for ; Tue, 7 Dec 2021 19:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232106AbhLGTdm (ORCPT ); Tue, 7 Dec 2021 14:33:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbhLGTdl (ORCPT ); Tue, 7 Dec 2021 14:33:41 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3DC5C061746 for ; Tue, 7 Dec 2021 11:30:10 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id e4-20020a170902b78400b00143c2e300ddso2924593pls.17 for ; Tue, 07 Dec 2021 11:30:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:message-id:mime-version:subject:from:to:cc; bh=MoB4jyyuM207pVL6/iUpbqYwkxDsVhtPToauP0BYAVI=; b=IukAaH+brEOfA6uAAmYlfeQn5Z9ENUrwh7/plyA6VjvQv0ScLwr/5tusnfM2lYiNxo SJBp9P5tU9t24TDHoGZpp7AI/hoq1Or/SO2uQY+m0+xqAtGISl66jDkDwq8Zs3nvjyM+ zJVPvPdlt9G7VO1I708vmSvc0z9Ai6chUT7X+TW74QfQajgHpOwafQafp1iwvANxkIuP ZHTALzJQLelcpFOr2Mmc2g+bX0Qz0aEFRUGfzzonj6gGovTsClTb2QbWQo8XlEHe3TEG R1fn91teJjnw+9UgU2abqzuhBdj5KZV6pDV7cpiESMFVL892obWRkWaHLwdlRT5lZFGy rXVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:message-id:mime-version:subject :from:to:cc; bh=MoB4jyyuM207pVL6/iUpbqYwkxDsVhtPToauP0BYAVI=; b=nLM5mCWtSlCPvttNZpRpxz0R1LvdmRAa4qM6LF8XBXRAppXgp9jHySmVVu3JJbH9oL Chq1v4+oRS224QIH0B0fuaTzM8X+kjFcg48OWCVSzxKS5UU8yHL1AcmonnDvqfFqFmXt otag7jtX++o171HO7+vlWTIJ0EouI7dxpfXSl73zc1CNC8Dz7pCSH18MWjlbmhgrPclt Chz6erD5gOQCH/3AJTxAQZaf+gH3KiRNjqhMnSXrTqeOkjczLD5/jvh1QcFi0QozgCJ6 PLVUp5nKRRXUjspNxb1pQ5ZiRlx+lb1cMSyfaA4KNa5KhcybKwRdE0r7VHcU0C7P3Kq+ n+7A== X-Gm-Message-State: AOAM532JDsm4vECvRWG4Z/8SIZ6kMBK3SwWSKSkxEduGeA9C1gnrHXIz 4hpZA9zeoVCVkaAUkeQDSVb6toWMixY= X-Google-Smtp-Source: ABdhPJyHSZ0dpc4ulcH9BdyTZms9DzkIG21zOKBsrIyBcO2fL0yJBWYjtfhhN4e8QI13tmZOMK23KZ2CwCg= X-Received: from seanjc.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e5]) (user=seanjc job=sendgmr) by 2002:a17:903:4043:b0:142:4f21:6976 with SMTP id n3-20020a170903404300b001424f216976mr53889305pla.62.1638905410479; Tue, 07 Dec 2021 11:30:10 -0800 (PST) Reply-To: Sean Christopherson Date: Tue, 7 Dec 2021 19:30:02 +0000 Message-Id: <20211207193006.120997-1-seanjc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.34.1.400.ga245620fadb-goog Subject: [PATCH 0/4] KVM: VMX: Fix handling of invalid L2 guest state From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+f1d2136db9c80d4733e8@syzkaller.appspotmail.com, Maxim Levitsky Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes and a test for invalid L2 guest state. TL;DR: KVM should never emulate L2 if L2's guest state is invalid. Patch 01 fixes a regression found by syzbot. Patch 02 closes what I suspect was the hole the buggy patch was trying to close. Patch 03 is a related docs update. Patch 04 is a selftest for the regression and for a subset of patch 02's behavior. Sean Christopherson (4): KVM: VMX: Always clear vmx->fail on emulation_required KVM: nVMX: Synthesize TRIPLE_FAULT for L2 if emulation is required KVM: VMX: Fix stale docs for kvm-intel.emulate_invalid_guest_state KVM: selftests: Add test to verify TRIPLE_FAULT on invalid L2 guest state .../admin-guide/kernel-parameters.txt | 8 +- arch/x86/kvm/vmx/vmx.c | 36 ++++-- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 1 + .../x86_64/vmx_invalid_nested_guest_state.c | 105 ++++++++++++++++++ 5 files changed, 138 insertions(+), 13 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86_64/vmx_invalid_nested_guest_state.c -- 2.34.1.400.ga245620fadb-goog