Skip to content

Commit a1152be

Browse files
author
James Morse
committed
arm64: proton-pack: Expose whether the branchy loop k value
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 <[email protected]> Reviewed-by: Catalin Marinas <[email protected]>
1 parent e7956c9 commit a1152be

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

arch/arm64/include/asm/spectre.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ enum mitigation_state arm64_get_meltdown_state(void);
9797

9898
enum mitigation_state arm64_get_spectre_bhb_state(void);
9999
bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry, int scope);
100+
u8 get_spectre_bhb_loop_value(void);
100101
bool is_spectre_bhb_fw_mitigated(void);
101102
void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
102103
bool try_emulate_el1_ssbs(struct pt_regs *regs, u32 instr);

arch/arm64/kernel/proton-pack.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,11 @@ bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry,
999999
return true;
10001000
}
10011001

1002+
u8 get_spectre_bhb_loop_value(void)
1003+
{
1004+
return max_bhb_k;
1005+
}
1006+
10021007
static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot)
10031008
{
10041009
const char *v = arm64_get_bp_hardening_vector(slot);

0 commit comments

Comments
 (0)