Skip to content

Commit fa9dd59

Browse files
borkmannAlexei Starovoitov
authored andcommitted
bpf: get rid of pure_initcall dependency to enable jits
Having a pure_initcall() callback just to permanently enable BPF JITs under CONFIG_BPF_JIT_ALWAYS_ON is unnecessary and could leave a small race window in future where JIT is still disabled on boot. Since we know about the setting at compilation time anyway, just initialize it properly there. Also consolidate all the individual bpf_jit_enable variables into a single one and move them under one location. Moreover, don't allow for setting unspecified garbage values on them. Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 87c1793 commit fa9dd59

File tree

13 files changed

+24
-42
lines changed

13 files changed

+24
-42
lines changed

arch/arm/net/bpf_jit_32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
#include "bpf_jit_32.h"
2727

28-
int bpf_jit_enable __read_mostly;
29-
3028
#define STACK_OFFSET(k) (k)
3129
#define TMP_REG_1 (MAX_BPF_JIT_REG + 0) /* TEMP Register 1 */
3230
#define TMP_REG_2 (MAX_BPF_JIT_REG + 1) /* TEMP Register 2 */

arch/arm64/net/bpf_jit_comp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
#include "bpf_jit.h"
3333

34-
int bpf_jit_enable __read_mostly;
35-
3634
#define TMP_REG_1 (MAX_BPF_JIT_REG + 0)
3735
#define TMP_REG_2 (MAX_BPF_JIT_REG + 1)
3836
#define TCALL_CNT (MAX_BPF_JIT_REG + 2)

arch/mips/net/bpf_jit.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,8 +1207,6 @@ static int build_body(struct jit_ctx *ctx)
12071207
return 0;
12081208
}
12091209

1210-
int bpf_jit_enable __read_mostly;
1211-
12121210
void bpf_jit_compile(struct bpf_prog *fp)
12131211
{
12141212
struct jit_ctx ctx;

arch/mips/net/ebpf_jit.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ static u32 b_imm(unsigned int tgt, struct jit_ctx *ctx)
177177
(ctx->idx * 4) - 4;
178178
}
179179

180-
int bpf_jit_enable __read_mostly;
181-
182180
enum which_ebpf_reg {
183181
src_reg,
184182
src_reg_no_fp,

arch/powerpc/net/bpf_jit_comp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
#include "bpf_jit32.h"
2020

21-
int bpf_jit_enable __read_mostly;
22-
2321
static inline void bpf_flush_icache(void *start, void *end)
2422
{
2523
smp_wmb();

arch/powerpc/net/bpf_jit_comp64.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
#include "bpf_jit64.h"
2323

24-
int bpf_jit_enable __read_mostly;
25-
2624
static void bpf_jit_fill_ill_insns(void *area, unsigned int size)
2725
{
2826
memset32(area, BREAKPOINT_INSTRUCTION, size/4);

arch/s390/net/bpf_jit_comp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#include <asm/set_memory.h>
2929
#include "bpf_jit.h"
3030

31-
int bpf_jit_enable __read_mostly;
32-
3331
struct bpf_jit {
3432
u32 seen; /* Flags to remember seen eBPF instructions */
3533
u32 seen_reg[16]; /* Array to remember which registers are used */

arch/sparc/net/bpf_jit_comp_32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
#include "bpf_jit_32.h"
1313

14-
int bpf_jit_enable __read_mostly;
15-
1614
static inline bool is_simm13(unsigned int value)
1715
{
1816
return value + 0x1000 < 0x2000;

arch/sparc/net/bpf_jit_comp_64.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
#include "bpf_jit_64.h"
1414

15-
int bpf_jit_enable __read_mostly;
16-
1715
static inline bool is_simm13(unsigned int value)
1816
{
1917
return value + 0x1000 < 0x2000;

arch/x86/net/bpf_jit_comp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#include <asm/set_memory.h>
1616
#include <linux/bpf.h>
1717

18-
int bpf_jit_enable __read_mostly;
19-
2018
/*
2119
* assembly code in arch/x86/net/bpf_jit.S
2220
*/

0 commit comments

Comments
 (0)