Skip to content

Commit f596cf0

Browse files
solbjornpaulburton
authored andcommitted
MIPS: BPF: eBPF JIT: check for MIPS ISA compliance in Kconfig
It is completely wrong to check for compile-time MIPS ISA revision in the body of bpf_int_jit_compile() as it may lead to get MIPS JIT fully omitted by the CC while the rest system will think that the JIT is actually present and works [1]. We can check if the selected CPU really supports MIPS eBPF JIT at configure time and avoid such situations when kernel can be built without both JIT and interpreter, but with CONFIG_BPF_SYSCALL=y. [1] https://lore.kernel.org/linux-mips/[email protected]/ Fixes: 716850a ("MIPS: eBPF: Initial eBPF support for MIPS32 architecture.") Cc: <[email protected]> # v5.2+ Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Paul Burton <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: James Hogan <[email protected]> Cc: Hassan Naveed <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Song Liu <[email protected]> Cc: Yonghong Song <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
1 parent f8fffeb commit f596cf0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ config MIPS
4747
select HAVE_ARCH_TRACEHOOK
4848
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES
4949
select HAVE_ASM_MODVERSIONS
50-
select HAVE_EBPF_JIT if (64BIT && !CPU_MICROMIPS)
50+
select HAVE_EBPF_JIT if 64BIT && !CPU_MICROMIPS && TARGET_ISA_REV >= 2
5151
select HAVE_CONTEXT_TRACKING
5252
select HAVE_COPY_THREAD_TLS
5353
select HAVE_C_RECORDMCOUNT

arch/mips/net/ebpf_jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
18031803
unsigned int image_size;
18041804
u8 *image_ptr;
18051805

1806-
if (!prog->jit_requested || MIPS_ISA_REV < 2)
1806+
if (!prog->jit_requested)
18071807
return prog;
18081808

18091809
tmp = bpf_jit_blind_constants(prog);

0 commit comments

Comments
 (0)