Skip to content

Commit 4977712

Browse files
James Morsegregkh
authored andcommitted
arm64: proton-pack: Expose whether the branchy loop k value
commit a1152be30a043d2d4dcb1683415f328bf3c51978 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 351a505 commit 4977712

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
@@ -96,6 +96,7 @@ enum mitigation_state arm64_get_meltdown_state(void);
9696

9797
enum mitigation_state arm64_get_spectre_bhb_state(void);
9898
bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry, int scope);
99+
u8 get_spectre_bhb_loop_value(void);
99100
bool is_spectre_bhb_fw_mitigated(void);
100101
void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
101102
#endif /* __ASSEMBLY__ */

arch/arm64/kernel/proton-pack.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,11 @@ bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry,
10101010
return true;
10111011
}
10121012

1013+
u8 get_spectre_bhb_loop_value(void)
1014+
{
1015+
return max_bhb_k;
1016+
}
1017+
10131018
static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot)
10141019
{
10151020
const char *v = arm64_get_bp_hardening_vector(slot);

0 commit comments

Comments
 (0)