diff options
| author | James Morse <james.morse@arm.com> | 2025-06-07 15:35:31 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-27 11:05:37 +0100 |
| commit | fc061c32e32709e139e7af963e2fbe88683154e1 (patch) | |
| tree | 5264b070d3a2b3189845bf70496d429b95cb64f6 | |
| parent | 005f3b7bd3787a2c246f08b7190aa3289378e1dd (diff) | |
| download | linux-fc061c32e32709e139e7af963e2fbe88683154e1.tar.gz linux-fc061c32e32709e139e7af963e2fbe88683154e1.tar.bz2 linux-fc061c32e32709e139e7af963e2fbe88683154e1.zip | |
arm64: proton-pack: Expose whether the branchy loop k value
[ Upstream commit a1152be30a043d2d4dcb1683415f328bf3c51978 ]
Add a helper to expose the k value of the branchy loop. This is needed
by the BPF JIT to generate the mitigation sequence in BPF programs.
Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | arch/arm64/include/asm/spectre.h | 1 | ||||
| -rw-r--r-- | arch/arm64/kernel/proton-pack.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/spectre.h b/arch/arm64/include/asm/spectre.h index af06d2a4c49c..56d1427b95d0 100644 --- a/arch/arm64/include/asm/spectre.h +++ b/arch/arm64/include/asm/spectre.h @@ -97,6 +97,7 @@ enum mitigation_state arm64_get_meltdown_state(void); enum mitigation_state arm64_get_spectre_bhb_state(void); bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry, int scope); +u8 get_spectre_bhb_loop_value(void); bool is_spectre_bhb_fw_mitigated(void); void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *__unused); bool try_emulate_el1_ssbs(struct pt_regs *regs, u32 instr); diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index e79ca2c4841d..71a6d3dd393a 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -998,6 +998,11 @@ bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry, return true; } +u8 get_spectre_bhb_loop_value(void) +{ + return max_bhb_k; +} + static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot) { const char *v = arm64_get_bp_hardening_vector(slot); |
