From: sashiko-bot@kernel.org
To: "Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>
Cc: kvm@vger.kernel.org, "Marc Zyngier" <maz@kernel.org>,
kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>
Subject: Re: [PATCH v9 09/16] arm64: errata: Require Apple IMPDEF PMUv3 traps on all CPUs
Date: Mon, 20 Jul 2026 06:01:00 +0000 [thread overview]
Message-ID: <20260720060101.764901F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720-hybrid-v9-9-2b713ca1b5dc@rsg.ci.i.u-tokyo.ac.jp>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Critical] Permitting late CPUs with IMPDEF PMUv3 to boot without enabling hypervisor traps allows untrapped guest access to host PMU registers.
Pre-existing issues:
- [High] Writes to control-plane system registers in CPU capability enable callbacks lack a mandatory `isb()` instruction.
--
--- Patch [9]: [PATCH v9 09/16] arm64: errata: Require Apple IMPDEF PMUv3 traps on all CPUs ---
commit 3e98f085c1f1b418fb0ec6e336b981ba1df07b03
Author: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
arm64: errata: Require Apple IMPDEF PMUv3 traps on all CPUs
This commit changes the ARM64_WORKAROUND_PMUV3_IMPDEF_TRAPS erratum to an
all-early-CPU capability. It ensures the capability is only advertised if all
early CPUs match, aiming to reject late CPUs that miss the capability while
permitting late CPUs to have it when the system does not.
> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index 1995e1198648e..a5ae628204a12 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c
[ ... ]
> @@ -1005,7 +1005,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
> {
> .desc = "Apple IMPDEF PMUv3 Traps",
> .capability = ARM64_WORKAROUND_PMUV3_IMPDEF_TRAPS,
> - .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
> + .type = ARM64_CPUCAP_EARLY_LOCAL_CPU_FEATURE,
[Severity: Critical]
By changing the capability type to ARM64_CPUCAP_EARLY_LOCAL_CPU_FEATURE,
does this allow a late CPU with IMPDEF PMUv3 to boot without enabling the
hypervisor trap if the system lacks the capability system-wide?
If an asymmetric system boots without the PMUv3 IMPDEF capability system-wide
and a late Apple CPU with the feature is onlined, verify_local_cpu_caps()
will permit the CPU. However, because system_has_cap is false, it skips
caps->cpu_enable() which leaves HACR_EL2 bit 56 clear.
Since KVM relies on this hardware trap to intercept these instructions and
inject an UNDEF exception, could this missing trap allow a malicious guest
scheduled on the late CPU to execute IMPDEF PMU instructions natively and
manipulate host physical PMU state?
> .matches = has_impdef_pmuv3,
> .cpu_enable = cpu_enable_impdef_pmuv3_traps,
[Severity: High]
This is a pre-existing issue, but do the writes to control-plane system
registers in capability enable callbacks require an isb() synchronization
barrier?
Currently, callbacks like cpu_enable_impdef_pmuv3_traps update SYS_HACR_EL2
using sysreg_clear_set_s, and then return immediately without a trailing
isb(). Other callbacks like cpu_enable_trap_ctr_access and
cpu_enable_cache_maint_trap update sctlr_el1 in a similar way.
Under the ARM64 subsystem rules, every write to a control-plane system
register must be followed by an isb() as the very next instruction. Since
sysreg_clear_set_s does not issue this barrier, returning immediately places
the return branch instruction against an architecturally undefined pipeline
state. Should these callbacks issue an explicit isb() before returning?
> },
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260720-hybrid-v9-0-2b713ca1b5dc@rsg.ci.i.u-tokyo.ac.jp?part=9
next prev parent reply other threads:[~2026-07-20 6:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 5:37 [PATCH v9 00/16] KVM: arm64: PMU: Use multiple host PMUs Akihiko Odaki
2026-07-20 5:37 ` [PATCH v9 01/16] KVM: arm64: Serialize repeated vCPU initialization Akihiko Odaki
2026-07-20 5:37 ` [PATCH v9 02/16] KVM: arm64: PMU: Stop updating MDCR_EL2.HPMN Akihiko Odaki
2026-07-20 5:58 ` sashiko-bot
2026-07-20 5:37 ` [PATCH v9 03/16] KVM: arm64: PMU: Freeze counter count after first run Akihiko Odaki
2026-07-20 5:37 ` [PATCH v9 04/16] KVM: arm64: selftests: Test SET_NR_COUNTERS " Akihiko Odaki
2026-07-20 6:08 ` sashiko-bot
2026-07-20 5:37 ` [PATCH v9 05/16] KVM: arm64: PMU: Keep implemented counter mask EL-independent Akihiko Odaki
2026-07-20 5:53 ` sashiko-bot
2026-07-20 5:38 ` [PATCH v9 06/16] KVM: arm64: PMU: Recreate events after MDCR_EL2 changes Akihiko Odaki
2026-07-20 5:57 ` sashiko-bot
2026-07-20 5:38 ` [PATCH v9 07/16] tools headers: Use u* types for bitfield helpers Akihiko Odaki
2026-07-20 5:38 ` [PATCH v9 08/16] KVM: arm64: selftests: Cover PMU state in MDCR_EL2 Akihiko Odaki
2026-07-20 5:38 ` [PATCH v9 09/16] arm64: errata: Require Apple IMPDEF PMUv3 traps on all CPUs Akihiko Odaki
2026-07-20 6:01 ` sashiko-bot [this message]
2026-07-20 5:38 ` [PATCH v9 10/16] KVM: arm64: Don't clear vcpu->cpu in kvm_arch_vcpu_put() Akihiko Odaki
2026-07-20 5:38 ` [PATCH v9 11/16] KVM: arm64: PMU: Protect the list of PMUs with RCU Akihiko Odaki
2026-07-20 5:38 ` [PATCH v9 12/16] KVM: arm64: PMU: Pass the pPMU to kvm_map_pmu_event() Akihiko Odaki
2026-07-20 6:03 ` sashiko-bot
2026-07-20 5:38 ` [PATCH v9 13/16] KVM: arm64: PMU: Pass the target CPU to kvm_pmu_probe_armpmu() Akihiko Odaki
2026-07-20 5:38 ` [PATCH v9 14/16] KVM: arm64: PMU: Implement fixed-counters-only emulation Akihiko Odaki
2026-07-20 6:17 ` sashiko-bot
2026-07-20 5:38 ` [PATCH v9 15/16] KVM: arm64: PMU: Introduce FIXED_COUNTERS_ONLY Akihiko Odaki
2026-07-20 5:38 ` [PATCH v9 16/16] KVM: arm64: selftests: Test PMU_V3_FIXED_COUNTERS_ONLY Akihiko Odaki
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=20260720060101.764901F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.