diff options
-rw-r--r-- | arch/arm64/Kconfig | 1 | ||||
-rw-r--r-- | arch/s390/Kconfig | 1 | ||||
-rw-r--r-- | arch/x86/Kconfig | 1 | ||||
-rw-r--r-- | init/Kconfig | 7 | ||||
-rw-r--r-- | kernel/bpf/core.c | 24 | ||||
-rw-r--r-- | lib/test_bpf.c | 13 | ||||
-rw-r--r-- | net/Kconfig | 2 | ||||
-rw-r--r-- | net/core/filter.c | 4 | ||||
-rw-r--r-- | net/core/sysctl_net_core.c | 6 | ||||
-rw-r--r-- | net/socket.c | 9 |
10 files changed, 7 insertions, 61 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 9fbb9c34b127..8b055133ae2a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -61,7 +61,6 @@ config ARM64 select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK select HAVE_BPF_JIT - select HAVE_EBPF_JIT select HAVE_C_RECORDMCOUNT select HAVE_CC_STACKPROTECTOR select HAVE_CMPXCHG_DOUBLE diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 73a301873fbf..848539d8cac1 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -125,7 +125,6 @@ config S390 select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_BPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES - select HAVE_EBPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES select HAVE_CMPXCHG_DOUBLE select HAVE_CMPXCHG_LOCAL select HAVE_DEBUG_KMEMLEAK diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 3d5d6f51d74c..51601246461a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -92,7 +92,6 @@ config X86 select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_ARCH_WITHIN_STACK_FRAMES - select HAVE_EBPF_JIT if X86_64 select HAVE_CC_STACKPROTECTOR select HAVE_CMPXCHG_DOUBLE select HAVE_CMPXCHG_LOCAL diff --git a/init/Kconfig b/init/Kconfig index bf501a633f9e..ad97499700dc 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1699,13 +1699,6 @@ config BPF_SYSCALL Enable the bpf() system call that allows to manipulate eBPF programs and maps via file descriptors. -config BPF_JIT_ALWAYS_ON - bool "Permanently enable BPF JIT and remove BPF interpreter" - depends on BPF_SYSCALL && HAVE_EBPF_JIT && BPF_JIT - help - Enables BPF JIT and removes BPF interpreter to avoid - speculative execution of BPF instructions by the interpreter - config SHMEM bool "Use full shmem filesystem" if EXPERT default y diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index c40e25e63bb0..e54ea31c5103 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -256,7 +256,6 @@ noinline u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5) } EXPORT_SYMBOL_GPL(__bpf_call_base); -#ifndef CONFIG_BPF_JIT_ALWAYS_ON /** * __bpf_prog_run - run eBPF program on a given context * @ctx: is the data we are operating on @@ -726,13 +725,6 @@ load_byte: return 0; } -#else -static unsigned int __bpf_prog_ret0(void *ctx, const struct bpf_insn *insn) -{ - return 0; -} -#endif - bool bpf_prog_array_compatible(struct bpf_array *array, const struct bpf_prog *fp) { @@ -779,23 +771,9 @@ static int bpf_check_tail_call(const struct bpf_prog *fp) */ int bpf_prog_select_runtime(struct bpf_prog *fp) { -#ifndef CONFIG_BPF_JIT_ALWAYS_ON fp->bpf_func = (void *) __bpf_prog_run; -#else - fp->bpf_func = (void *) __bpf_prog_ret0; -#endif - - /* eBPF JITs can rewrite the program in case constant - * blinding is active. However, in case of error during - * blinding, bpf_int_jit_compile() must always return a - * valid program, which in this case would simply not - * be JITed, but falls back to the interpreter. - */ + bpf_int_jit_compile(fp); -#ifdef CONFIG_BPF_JIT_ALWAYS_ON - if (!fp->jited) - return -ENOTSUPP; -#endif bpf_prog_lock_ro(fp); /* The tail call compatibility check can only be done at diff --git a/lib/test_bpf.c b/lib/test_bpf.c index 1a0d1e771e6c..69aee608ddec 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -5325,8 +5325,9 @@ static struct bpf_prog *generate_filter(int which, int *err) return NULL; } } + /* We don't expect to fail. */ if (*err) { - pr_cont("FAIL to prog_create err=%d len=%d\n", + pr_cont("FAIL to attach err=%d len=%d\n", *err, fprog.len); return NULL; } @@ -5345,11 +5346,7 @@ static struct bpf_prog *generate_filter(int which, int *err) fp->type = BPF_PROG_TYPE_SOCKET_FILTER; memcpy(fp->insnsi, fptr, fp->len * sizeof(struct bpf_insn)); - *err = bpf_prog_select_runtime(fp); - if (*err) { - pr_cont("FAIL to select_runtime err=%d\n", *err); - return NULL; - } + bpf_prog_select_runtime(fp); break; } @@ -5542,8 +5539,8 @@ static __init int test_bpf(void) pass_cnt++; continue; } - err_cnt++; - continue; + + return err; } pr_cont("jited:%u ", fp->jited); diff --git a/net/Kconfig b/net/Kconfig index d9da78da8cd9..e64d8df8609a 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -421,5 +421,3 @@ endif # if NET config HAVE_BPF_JIT bool -config HAVE_EBPF_JIT - bool diff --git a/net/core/filter.c b/net/core/filter.c index 38bdff721331..6015acbeec40 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -992,9 +992,7 @@ static struct bpf_prog *bpf_migrate_filter(struct bpf_prog *fp) */ goto out_err_free; - err = bpf_prog_select_runtime(fp); - if (err) - goto out_err_free; + bpf_prog_select_runtime(fp); kfree(old_prog); return fp; diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 32898247d8bf..a9a4276609ef 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -292,13 +292,7 @@ static struct ctl_table net_core_table[] = { .data = &bpf_jit_enable, .maxlen = sizeof(int), .mode = 0644, -#ifndef CONFIG_BPF_JIT_ALWAYS_ON .proc_handler = proc_dointvec -#else - .proc_handler = proc_dointvec_minmax, - .extra1 = &one, - .extra2 = &one, -#endif }, #endif { diff --git a/net/socket.c b/net/socket.c index d802296b9c46..07b1143d03dd 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2597,15 +2597,6 @@ out_fs: core_initcall(sock_init); /* early initcall */ -static int __init jit_init(void) -{ -#ifdef CONFIG_BPF_JIT_ALWAYS_ON - bpf_jit_enable = 1; -#endif - return 0; -} -pure_initcall(jit_init); - #ifdef CONFIG_PROC_FS void socket_seq_show(struct seq_file *seq) { |