From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Mark Rutland <mark.rutland@arm.com>, linux-kernel@vger.kernel.org
Cc: aleksandar.qemu.devel@gmail.com, alexandru.elisei@arm.com,
anup@brainfault.org, aou@eecs.berkeley.edu,
atishp@atishpatra.org, benh@kernel.crashing.org, bp@alien8.de,
catalin.marinas@arm.com, chenhuacai@kernel.org,
dave.hansen@linux.intel.com, frederic@kernel.org,
hca@linux.ibm.com, james.morse@arm.com, jmattson@google.com,
joro@8bytes.org, maz@kernel.org, mingo@redhat.com,
mpe@ellerman.id.au, nsaenzju@redhat.com, palmer@dabbelt.com,
paulmck@kernel.org, paulus@samba.org, paul.walmsley@sifive.com,
pbonzini@redhat.com, seanjc@google.com, suzuki.poulose@arm.com,
svens@linux.ibm.com, tglx@linutronix.de,
tsbogend@alpha.franken.de, vkuznets@redhat.com,
wanpengli@tencent.com, will@kernel.org
Subject: Re: [PATCH v3 0/5] kvm: fix latent guest entry/exit bugs
Date: Tue, 1 Feb 2022 15:02:33 +0100 [thread overview]
Message-ID: <980279cc-7836-e330-e435-4fbe5c361e0d@linux.ibm.com> (raw)
In-Reply-To: <20220201132926.3301912-1-mark.rutland@arm.com>
Am 01.02.22 um 14:29 schrieb Mark Rutland:
> Several architectures have latent bugs around guest entry/exit,
> including:
Thanks for looking into this.
>
> 1) Enabling interrupts during an RCU EQS, allowing interrupt handlers to
> run without RCU watching.
>
> 2) Using (potentially) instrumented code between guest_enter() and
> guest_exit(), allowing instrumentation handlers to run without RCU
> watching.
>
> 3) Not informing lockdep and tracing about interrupt masking, or
> informing in an incorrect order (e.g. relative to entering/exiting an
> RCU EQS).
>
> 4) Unbalanced entry/exit accounting in some cases (which may or may not
> result in functional problems).
>
> Overall, the architectures affected are:
>
> arm64, mips, powerpc, riscv, s390, x86
>
> This series reworks the common code to make handling these issues
> earier, and for the following architectures fixes those issues by
> conversion to new helper functions:
>
> arm64, mips, riscv, x86
>
> The core, arm64, and x86 patches have reviews from the relevant
> maintainers, and I think those are good-to-go. I have not yet had
> acks/reviews for the mips and riscv patches. I'm fairly certain the
> riscv patch is correct by virtue of it being so simple, and I'm
> relatively confident that the mips patch is correct (though I may have
> missed additional issues), but I have no way of testing either so I've
> placed them at the end of the series where they can easily be dropped if
> necessary.
>
> This series does NOT fix the following architectures, which will need
> more substantial changes to architecture-specific entry logic and/or
> sequencing:
>
> powerpc, s390
Right, s390 is more complicated as we need to modify the page fault handling.
For the time being we should be as bad/good as before with the deprecated old
guest_enter/exit_irqoff. I will test this to be sure.
>
> ... and I assume it would be preferable to fix the common code and
> simple cases now, such that those can be addressed in subsequent
> follow-ups.
>
> Since v1 [1]:
> * Add arch_in_rcu_eqs()
> * Convert s390
> * Rename exit_to_guest_mode() -> guest_state_enter_irqoff()
> * Rename enter_from_guest_mode() -> guest_state_exit_irqoff()
> * Various commit message cleanups
>
> Since v2 [2]:
> * Rebase to v5.17-rc2
> * Fixup mips exit handling
> * Drop arch_in_rcu_eqs() & s390 patches
>
> I've pushed the series (based on v5.17-rc2) to my kvm/entry-rework branch:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=kvm/entry-rework
> git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git kvm/entry-rework
>
> This version of the series is tagged as kvm-entry-rework-20220201.
>
> [1] https://lore.kernel.org/r/20220111153539.2532246-1-mark.rutland@arm.com/
> [2] https://lore.kernel.org/r/20220119105854.3160683-1-mark.rutland@arm.com/
>
> Thanks,
>
>
> Mark Rutland (5):
> kvm: add guest_state_{enter,exit}_irqoff()
> kvm/arm64: rework guest entry logic
> kvm/x86: rework guest entry logic
> kvm/riscv: rework guest entry logic
> kvm/mips: rework guest entry logic
>
> arch/arm64/kvm/arm.c | 51 +++++++++++-------
> arch/mips/kvm/mips.c | 50 +++++++++++++++--
> arch/riscv/kvm/vcpu.c | 44 +++++++++------
> arch/x86/kvm/svm/svm.c | 4 +-
> arch/x86/kvm/vmx/vmx.c | 4 +-
> arch/x86/kvm/x86.c | 4 +-
> arch/x86/kvm/x86.h | 45 ----------------
> include/linux/kvm_host.h | 112 +++++++++++++++++++++++++++++++++++++--
> 8 files changed, 222 insertions(+), 92 deletions(-)
>
next prev parent reply other threads:[~2022-02-01 14:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 13:29 [PATCH v3 0/5] kvm: fix latent guest entry/exit bugs Mark Rutland
2022-02-01 13:29 ` [PATCH v3 1/5] kvm: add guest_state_{enter,exit}_irqoff() Mark Rutland
2022-02-01 13:29 ` [PATCH v3 2/5] kvm/arm64: rework guest entry logic Mark Rutland
2022-02-01 13:29 ` [PATCH v3 3/5] kvm/x86: " Mark Rutland
2022-02-01 13:29 ` [PATCH v3 4/5] kvm/riscv: " Mark Rutland
2022-02-01 13:29 ` [PATCH v3 5/5] kvm/mips: " Mark Rutland
2022-02-01 14:02 ` Christian Borntraeger [this message]
2022-02-01 15:59 ` [PATCH v3 0/5] kvm: fix latent guest entry/exit bugs Paolo Bonzini
2022-02-01 16:22 ` Marc Zyngier
2022-02-01 16:22 ` Mark Rutland
2022-02-01 17:10 ` Paolo Bonzini
2022-02-01 17:48 ` Marc Zyngier
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=980279cc-7836-e330-e435-4fbe5c361e0d@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=alexandru.elisei@arm.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atishp@atishpatra.org \
--cc=benh@kernel.crashing.org \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=frederic@kernel.org \
--cc=hca@linux.ibm.com \
--cc=james.morse@arm.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=nsaenzju@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=paulmck@kernel.org \
--cc=paulus@samba.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=suzuki.poulose@arm.com \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).