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 2EF09C433F5 for ; Fri, 27 May 2022 17:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354164AbiE0RHF (ORCPT ); Fri, 27 May 2022 13:07:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238777AbiE0RHC (ORCPT ); Fri, 27 May 2022 13:07:02 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78F5E6C0FD for ; Fri, 27 May 2022 10:07:01 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id z16-20020a17090a015000b001dbc8da29a1so3030650pje.7 for ; Fri, 27 May 2022 10:07:01 -0700 (PDT) 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=9DJdjdQfpcnVpPyggfIa1qFXIxfq8b79BilK9w/NCMk=; b=VpE0RCMwbMTen5kAKvFC8lT8COxhcuz8NIbXoPPx5NG5zwnsMY47H7V95OAyz8LCzr R6fQRQG9L/ZuTtN9tQUWcWrABH1YkePU7l5rBlHbj6MafvfM7jtvnZCP4kcuPbTw1r0a 7wWjhtp5HGbJkBzO4LsIexzDCNMwoUUmLnDqhIOC5rG6FtijeTky5NL5ShGtXOg1nQwx LLwWavtHpb4vRbo5mAROTm3R3K9TYAuM8lTXxs+YZ8S5NtTVEd3Ls9kBm2BLbmMGWtcS YcvCClR2qjnO/3QD+XLyJsRTC0UmWMuWKg9jfJTJ5wIcF61cIPUPtJ5BdRmvThmNKvTN fMWQ== 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=9DJdjdQfpcnVpPyggfIa1qFXIxfq8b79BilK9w/NCMk=; b=uwuRFbi1Xdu0rKy/KDLGGoAQW+bz8D4zC1HlnqgBOVjSSxOQsZaJhlE33FbhhfyIiN Nw8AWjjzywosgl8zsZGc3x1nOVvNHIK4iM8uGbDPCuKaC96IlKM9eF+gNWrl5uiRfQl9 vr2Hf1fNxZU6Fl7hB5YoMADZTGxEYyn1KxIJ2Nfy0Wr1PTIaqztZRwoNE7WQafc1RyRa xXUhqtZt9B8Z6QmGs7dMLBgoNYzB2uBMbPkH2tAV12KugMBYSO1111cxv54v0/VQ4PdX gi8P7qPdHUWboKumS/7cg82Q3puzZzj5h7xiAtILpIFxi1szwHBiljEDBqZuZwDO/HQv Ax/A== X-Gm-Message-State: AOAM533ecetdOgRIE0UrIvbqVi93oKYT8BYLa8k++ZZjUsbx3xWzqKHT ITLRYush5mfCFWKCakVvFJleBTyj1SY= X-Google-Smtp-Source: ABdhPJy/MxK8R9tE/ppkI9QXVvxv+Y2LEn6i6YQMe01XhN/mFom9mlwlSW5NzeEUm9FlqBFt91qCZ5ZhLXg= X-Received: from seanjc.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e5]) (user=seanjc job=sendgmr) by 2002:a17:902:8698:b0:158:99d4:6256 with SMTP id g24-20020a170902869800b0015899d46256mr44760250plo.104.1653671220960; Fri, 27 May 2022 10:07:00 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 27 May 2022 17:06:56 +0000 Message-Id: <20220527170658.3571367-1-seanjc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog Subject: [PATCH v2 0/2] KVM: VMX: Sanitize VM-Entry/VM-Exit pairs during setup 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, Chenyi Qiang , Lei Wang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sanitize the VM-Entry/VM-Exit load+load and load+clear pairs when kvm_intel is loaded instead of checking both controls at runtime. Not sanitizing means KVM ends up setting non-dynamic bits in the VMCS. Add an on-by-default knob to reject kvm_intel if an inconsistent VMCS config is detected instead of using a degraded and/or potentially broken setup. v2: - Drop the macros. [Paolo] - Tweak the module param name to try to capture that KVM doesn't check for all possible inconsistencies. [Jim] - Enable the knob by default. [Paolo] v1: https://lore.kernel.org/all/20220525210447.2758436-1-seanjc@google.com Sean Christopherson (2): KVM: VMX: Sanitize VM-Entry/VM-Exit control pairs at kvm_intel load time KVM: VMX: Reject kvm_intel if an inconsistent VMCS config is detected arch/x86/kvm/vmx/capabilities.h | 13 +++------ arch/x86/kvm/vmx/vmx.c | 52 +++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 12 deletions(-) base-commit: 90bde5bea810d766e7046bf5884f2ccf76dd78e9 -- 2.36.1.255.ge46751e96f-goog