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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9765C433F5 for ; Sun, 24 Oct 2021 12:09:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC81960F45 for ; Sun, 24 Oct 2021 12:09:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbhJXMLo (ORCPT ); Sun, 24 Oct 2021 08:11:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:36652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231372AbhJXMLn (ORCPT ); Sun, 24 Oct 2021 08:11:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F283460EE3; Sun, 24 Oct 2021 12:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635077363; bh=jMfUU87AX+hPmwU/2ZiuTwLfmdT5wiWYxwz/NVzAWmI=; h=Subject:To:Cc:From:Date:From; b=p8R8R0ZqnxPOR0b+hBujKan74E8wI82z9o2WHlMMnp187I3ksZCbkvIKEIe3Exd2q NtNqDbDTjERDVD3rLg5qWr5tO0pvoj+aNaeygHmJBDfZ6Zo7KHOcIYBTd//4tQnKNg IgWXMc3MxeVilVzawPbUdZyYrEtH9ryQ+fdQc2sQ= Subject: FAILED: patch "[PATCH] KVM: MMU: Reset mmu->pkru_mask to avoid stale data" failed to apply to 4.19-stable tree To: chenyi.qiang@intel.com, pbonzini@redhat.com, seanjc@google.com Cc: From: Date: Sun, 24 Oct 2021 14:09:09 +0200 Message-ID: <1635077349169115@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From a3ca5281bb771d8103ea16f0a6a8a5df9a7fb4f3 Mon Sep 17 00:00:00 2001 From: Chenyi Qiang Date: Thu, 21 Oct 2021 15:10:22 +0800 Subject: [PATCH] KVM: MMU: Reset mmu->pkru_mask to avoid stale data When updating mmu->pkru_mask, the value can only be added but it isn't reset in advance. This will make mmu->pkru_mask keep the stale data. Fix this issue. Fixes: 2d344105f57c ("KVM, pkeys: introduce pkru_mask to cache conditions") Signed-off-by: Chenyi Qiang Message-Id: <20211021071022.1140-1-chenyi.qiang@intel.com> Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 1a64ba5b9437..0cc58901bf7a 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4596,10 +4596,10 @@ static void update_pkru_bitmask(struct kvm_mmu *mmu) unsigned bit; bool wp; - if (!is_cr4_pke(mmu)) { - mmu->pkru_mask = 0; + mmu->pkru_mask = 0; + + if (!is_cr4_pke(mmu)) return; - } wp = is_cr0_wp(mmu);