* [PATCH] arm64: cpufeature: Check the override in __read_sysreg_by_encoding()
@ 2026-11-13 9:57 Fuad Tabba
2026-11-18 18:21 ` Catalin Marinas
0 siblings, 1 reply; 2+ messages in thread
From: Fuad Tabba @ 2026-11-13 9:57 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon
Cc: Mark Rutland, Marc Zyngier, Suzuki K Poulose, linux-arm-kernel,
linux-kernel, Fuad Tabba
__read_sysreg_by_encoding() backs the capability checks a secondary
runs before its cpuinfo is stored, and folds an ID register override
into the value it reads without checking it against that CPU. A
secondary whose field is below an override the boot CPU accepted
passes verification and comes online without the feature.
Apply the override through arm64_ftr_reg_override(), as the cpuinfo
store does, so that it only applies where it is safe against that CPU's
value.
Fixes: b3341ae0efa2 ("arm64: cpufeature: Use IDreg override in __read_sysreg_by_encoding()")
Reported-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/all/abwXl35xQ2ze1XwJ@arm.com/
Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---
Notes:
Based on v7.4-rc1 (6628e7d4c6b2), where arm64_ftr_reg_override() was
added.
arch/arm64/kernel/cpufeature.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 34c5c03c0c9b4..3980acdd6e1b7 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1415,7 +1415,6 @@ EXPORT_SYMBOL_GPL(read_sanitised_ftr_reg);
*/
u64 __read_sysreg_by_encoding(u32 sys_id)
{
- struct arm64_ftr_reg *regp;
u64 val;
switch (sys_id) {
@@ -1468,13 +1467,7 @@ u64 __read_sysreg_by_encoding(u32 sys_id)
return 0;
}
- regp = get_arm64_ftr_reg(sys_id);
- if (regp) {
- val &= ~regp->override->mask;
- val |= (regp->override->val & regp->override->mask);
- }
-
- return val;
+ return arm64_ftr_reg_override(sys_id, val);
}
#include <linux/irqchip/arm-gic-v3.h>
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] arm64: cpufeature: Check the override in __read_sysreg_by_encoding()
2026-11-13 9:57 [PATCH] arm64: cpufeature: Check the override in __read_sysreg_by_encoding() Fuad Tabba
@ 2026-11-18 18:21 ` Catalin Marinas
0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2026-11-18 18:21 UTC (permalink / raw)
To: Fuad Tabba
Cc: Will Deacon, Mark Rutland, Marc Zyngier, Suzuki K Poulose,
linux-arm-kernel, linux-kernel, Fuad Tabba
On Fri, Nov 13, 2026 at 09:57:01AM +0000, Fuad Tabba wrote:
> __read_sysreg_by_encoding() backs the capability checks a secondary
> runs before its cpuinfo is stored, and folds an ID register override
> into the value it reads without checking it against that CPU. A
> secondary whose field is below an override the boot CPU accepted
> passes verification and comes online without the feature.
>
> Apply the override through arm64_ftr_reg_override(), as the cpuinfo
> store does, so that it only applies where it is safe against that CPU's
> value.
>
> Fixes: b3341ae0efa2 ("arm64: cpufeature: Use IDreg override in __read_sysreg_by_encoding()")
> Reported-by: Catalin Marinas <catalin.marinas@arm.com>
> Link: https://lore.kernel.org/all/abwXl35xQ2ze1XwJ@arm.com/
> Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Patch looks fine but I don't think it's worth adding Fixes tag (or, if
we do, we shouldn't add cc stable; my commit hook does this
automatically).
I'd leave it for 7.5, so:
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-18 18:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 9:57 [PATCH] arm64: cpufeature: Check the override in __read_sysreg_by_encoding() Fuad Tabba
2026-11-18 18:21 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox