From: Paolo Bonzini <pbonzini@redhat.com>
To: Sasha Levin <sashal@kernel.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Chenyi Qiang <chenyi.qiang@intel.com>,
Sean Christopherson <seanjc@google.com>,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org,
huaitong.han@intel.com, guangrong.xiao@linux.intel.com,
kvm@vger.kernel.org
Subject: Re: [PATCH MANUALSEL 5.14 5/5] KVM: MMU: Reset mmu->pkru_mask to avoid stale data
Date: Tue, 26 Oct 2021 18:17:09 +0200 [thread overview]
Message-ID: <54842867-9d40-5b8d-ea24-3ce32c8137ac@redhat.com> (raw)
In-Reply-To: <20211025203828.1404503-5-sashal@kernel.org>
On 25/10/21 22:38, Sasha Levin wrote:
> From: Chenyi Qiang <chenyi.qiang@intel.com>
>
> [ Upstream commit a3ca5281bb771d8103ea16f0a6a8a5df9a7fb4f3 ]
>
> 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 <chenyi.qiang@intel.com>
> Message-Id: <20211021071022.1140-1-chenyi.qiang@intel.com>
> Reviewed-by: Sean Christopherson <seanjc@google.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> arch/x86/kvm/mmu/mmu.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index c268fb59f779..6719a8041f59 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -4465,10 +4465,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);
>
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
next prev parent reply other threads:[~2021-10-26 16:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 20:38 [PATCH MANUALSEL 5.14 1/5] KVM: X86: fix lazy allocation of rmaps Sasha Levin
2021-10-25 20:38 ` [PATCH MANUALSEL 5.14 2/5] KVM: x86: WARN if APIC HW/SW disable static keys are non-zero on unload Sasha Levin
2021-10-26 16:15 ` Paolo Bonzini
2021-10-25 20:38 ` [PATCH MANUALSEL 5.14 3/5] KVM: VMX: Remove redundant handling of bus lock vmexit Sasha Levin
2021-10-26 16:15 ` Paolo Bonzini
2021-10-25 20:38 ` [PATCH MANUALSEL 5.14 4/5] KVM: SEV-ES: Set guest_state_protected after VMSA update Sasha Levin
2021-10-26 16:16 ` Paolo Bonzini
2021-10-25 20:38 ` [PATCH MANUALSEL 5.14 5/5] KVM: MMU: Reset mmu->pkru_mask to avoid stale data Sasha Levin
2021-10-26 16:17 ` Paolo Bonzini [this message]
2021-10-26 16:14 ` [PATCH MANUALSEL 5.14 1/5] KVM: X86: fix lazy allocation of rmaps Paolo Bonzini
2021-10-26 17:32 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54842867-9d40-5b8d-ea24-3ce32c8137ac@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=chenyi.qiang@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=guangrong.xiao@linux.intel.com \
--cc=huaitong.han@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sashal@kernel.org \
--cc=seanjc@google.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox