From: Fuad Tabba <fuad.tabba@linux.dev>
To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Marc Zyngier <maz@kernel.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Fuad Tabba <tabba@google.com>
Subject: [PATCH] arm64: cpufeature: Check the override in __read_sysreg_by_encoding()
Date: Fri, 13 Nov 2026 09:57:01 +0000 [thread overview]
Message-ID: <20261113095701.2042858-1-fuad.tabba@linux.dev> (raw)
__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
next reply other threads:[~2026-11-13 9:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 9:57 Fuad Tabba [this message]
2026-11-18 18:21 ` [PATCH] arm64: cpufeature: Check the override in __read_sysreg_by_encoding() Catalin Marinas
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=20261113095701.2042858-1-fuad.tabba@linux.dev \
--to=fuad.tabba@linux.dev \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=tabba@google.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 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.