linux/Documentation/arch
Marc Zyngier cad0406ad7 arm64: Filter out SVE hwcaps when FEAT_SVE isn't implemented
commit 064737920b upstream.

The hwcaps code that exposes SVE features to userspace only
considers ID_AA64ZFR0_EL1, while this is only valid when
ID_AA64PFR0_EL1.SVE advertises that SVE is actually supported.

The expectations are that when ID_AA64PFR0_EL1.SVE is 0, the
ID_AA64ZFR0_EL1 register is also 0. So far, so good.

Things become a bit more interesting if the HW implements SME.
In this case, a few ID_AA64ZFR0_EL1 fields indicate *SME*
features. And these fields overlap with their SVE interpretations.
But the architecture says that the SME and SVE feature sets must
match, so we're still hunky-dory.

This goes wrong if the HW implements SME, but not SVE. In this
case, we end-up advertising some SVE features to userspace, even
if the HW has none. That's because we never consider whether SVE
is actually implemented. Oh well.

Fix it by restricting all SVE capabilities to ID_AA64PFR0_EL1.SVE
being non-zero. The HWCAPS documentation is amended to reflect the
actually checks performed by the kernel.

Fixes: 06a916feca ("arm64: Expose SVE2 features for userspace")
Reported-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: stable@vger.kernel.org
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250107-arm64-2024-dpisa-v5-1-7578da51fc3d@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-02-21 13:57:26 +01:00
..
arc docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
arm docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
arm64 arm64: Filter out SVE hwcaps when FEAT_SVE isn't implemented 2025-02-21 13:57:26 +01:00
ia64 Documentation/arch/ia64/features.rst: fix kernel-feat directive 2024-02-23 09:25:28 +01:00
loongarch docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
m68k docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
mips docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
nios2 docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
openrisc docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
parisc docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
s390 docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
sh docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
sparc docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
x86 x86/Kconfig: Remove CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT 2024-04-03 15:28:50 +02:00
xtensa docs: kernel_feat.py: fix potential command injection 2024-01-31 16:18:46 -08:00
index.rst Documentation work keeps chugging along; stuff for 6.6 includes: 2023-08-30 20:05:42 -07:00