Skip to content

Commit addb067

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2018-12-11 The following pull-request contains BPF updates for your *net-next* tree. It has three minor merge conflicts, resolutions: 1) tools/testing/selftests/bpf/test_verifier.c Take first chunk with alignment_prevented_execution. 2) net/core/filter.c [...] case bpf_ctx_range_ptr(struct __sk_buff, flow_keys): case bpf_ctx_range(struct __sk_buff, wire_len): return false; [...] 3) include/uapi/linux/bpf.h Take the second chunk for the two cases each. The main changes are: 1) Add support for BPF line info via BTF and extend libbpf as well as bpftool's program dump to annotate output with BPF C code to facilitate debugging and introspection, from Martin. 2) Add support for BPF_ALU | BPF_ARSH | BPF_{K,X} in interpreter and all JIT backends, from Jiong. 3) Improve BPF test coverage on archs with no efficient unaligned access by adding an "any alignment" flag to the BPF program load to forcefully disable verifier alignment checks, from David. 4) Add a new bpf_prog_test_run_xattr() API to libbpf which allows for proper use of BPF_PROG_TEST_RUN with data_out, from Lorenz. 5) Extend tc BPF programs to use a new __sk_buff field called wire_len for more accurate accounting of packets going to wire, from Petar. 6) Improve bpftool to allow dumping the trace pipe from it and add several improvements in bash completion and map/prog dump, from Quentin. 7) Optimize arm64 BPF JIT to always emit movn/movk/movk sequence for kernel addresses and add a dedicated BPF JIT backend allocator, from Ard. 8) Add a BPF helper function for IR remotes to report mouse movements, from Sean. 9) Various cleanups in BPF prog dump e.g. to make UAPI bpf_prog_info member naming consistent with existing conventions, from Yonghong and Song. 10) Misc cleanups and improvements in allowing to pass interface name via cmdline for xdp1 BPF example, from Matteo. 11) Fix a potential segfault in BPF sample loader's kprobes handling, from Daniel T. 12) Fix SPDX license in libbpf's README.rst, from Andrey. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 8cc196d + aa570ff commit addb067

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3070
-676
lines changed

arch/arm64/include/asm/memory.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@
6262
#define PAGE_OFFSET (UL(0xffffffffffffffff) - \
6363
(UL(1) << (VA_BITS - 1)) + 1)
6464
#define KIMAGE_VADDR (MODULES_END)
65+
#define BPF_JIT_REGION_START (VA_START + KASAN_SHADOW_SIZE)
66+
#define BPF_JIT_REGION_SIZE (SZ_128M)
67+
#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE)
6568
#define MODULES_END (MODULES_VADDR + MODULES_VSIZE)
66-
#define MODULES_VADDR (VA_START + KASAN_SHADOW_SIZE)
69+
#define MODULES_VADDR (BPF_JIT_REGION_END)
6770
#define MODULES_VSIZE (SZ_128M)
6871
#define VMEMMAP_START (PAGE_OFFSET - VMEMMAP_SIZE)
6972
#define PCI_IO_END (VMEMMAP_START - SZ_2M)

arch/arm64/net/bpf_jit_comp.c

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,18 @@ static inline void emit_a64_mov_i64(const int reg, const u64 val,
134134
}
135135

136136
/*
137-
* This is an unoptimized 64 immediate emission used for BPF to BPF call
138-
* addresses. It will always do a full 64 bit decomposition as otherwise
139-
* more complexity in the last extra pass is required since we previously
140-
* reserved 4 instructions for the address.
137+
* Kernel addresses in the vmalloc space use at most 48 bits, and the
138+
* remaining bits are guaranteed to be 0x1. So we can compose the address
139+
* with a fixed length movn/movk/movk sequence.
141140
*/
142141
static inline void emit_addr_mov_i64(const int reg, const u64 val,
143142
struct jit_ctx *ctx)
144143
{
145144
u64 tmp = val;
146145
int shift = 0;
147146

148-
emit(A64_MOVZ(1, reg, tmp & 0xffff, shift), ctx);
149-
for (;shift < 48;) {
147+
emit(A64_MOVN(1, reg, ~tmp & 0xffff, shift), ctx);
148+
while (shift < 32) {
150149
tmp >>= 16;
151150
shift += 16;
152151
emit(A64_MOVK(1, reg, tmp & 0xffff, shift), ctx);
@@ -634,11 +633,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
634633
&func_addr, &func_addr_fixed);
635634
if (ret < 0)
636635
return ret;
637-
if (func_addr_fixed)
638-
/* We can use optimized emission here. */
639-
emit_a64_mov_i64(tmp, func_addr, ctx);
640-
else
641-
emit_addr_mov_i64(tmp, func_addr, ctx);
636+
emit_addr_mov_i64(tmp, func_addr, ctx);
642637
emit(A64_BLR(tmp), ctx);
643638
emit(A64_MOV(1, r0, A64_R(0)), ctx);
644639
break;
@@ -948,3 +943,16 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
948943
tmp : orig_prog);
949944
return prog;
950945
}
946+
947+
void *bpf_jit_alloc_exec(unsigned long size)
948+
{
949+
return __vmalloc_node_range(size, PAGE_SIZE, BPF_JIT_REGION_START,
950+
BPF_JIT_REGION_END, GFP_KERNEL,
951+
PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
952+
__builtin_return_address(0));
953+
}
954+
955+
void bpf_jit_free_exec(void *addr)
956+
{
957+
return vfree(addr);
958+
}

arch/mips/include/asm/uasm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Ip_u2u1s3(_slti);
157157
Ip_u2u1s3(_sltiu);
158158
Ip_u3u1u2(_sltu);
159159
Ip_u2u1u3(_sra);
160+
Ip_u3u2u1(_srav);
160161
Ip_u2u1u3(_srl);
161162
Ip_u3u2u1(_srlv);
162163
Ip_u3u1u2(_subu);

arch/mips/include/uapi/asm/inst.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,9 @@ enum mm_32a_minor_op {
369369
mm_ext_op = 0x02c,
370370
mm_pool32axf_op = 0x03c,
371371
mm_srl32_op = 0x040,
372+
mm_srlv32_op = 0x050,
372373
mm_sra_op = 0x080,
373-
mm_srlv32_op = 0x090,
374+
mm_srav_op = 0x090,
374375
mm_rotr_op = 0x0c0,
375376
mm_lwxs_op = 0x118,
376377
mm_addu32_op = 0x150,

arch/mips/mm/uasm-micromips.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ static const struct insn insn_table_MM[insn_invalid] = {
104104
[insn_sltiu] = {M(mm_sltiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM},
105105
[insn_sltu] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_sltu_op), RT | RS | RD},
106106
[insn_sra] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_sra_op), RT | RS | RD},
107+
[insn_srav] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_srav_op), RT | RS | RD},
107108
[insn_srl] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_srl32_op), RT | RS | RD},
108109
[insn_srlv] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_srlv32_op), RT | RS | RD},
109110
[insn_rotr] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_rotr_op), RT | RS | RD},

arch/mips/mm/uasm-mips.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static const struct insn insn_table[insn_invalid] = {
171171
[insn_sltiu] = {M(sltiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM},
172172
[insn_sltu] = {M(spec_op, 0, 0, 0, 0, sltu_op), RS | RT | RD},
173173
[insn_sra] = {M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE},
174+
[insn_srav] = {M(spec_op, 0, 0, 0, 0, srav_op), RS | RT | RD},
174175
[insn_srl] = {M(spec_op, 0, 0, 0, 0, srl_op), RT | RD | RE},
175176
[insn_srlv] = {M(spec_op, 0, 0, 0, 0, srlv_op), RS | RT | RD},
176177
[insn_subu] = {M(spec_op, 0, 0, 0, 0, subu_op), RS | RT | RD},

arch/mips/mm/uasm.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ enum opcode {
6161
insn_mthc0, insn_mthi, insn_mtlo, insn_mul, insn_multu, insn_nor,
6262
insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sb,
6363
insn_sc, insn_scd, insn_sd, insn_sh, insn_sll, insn_sllv,
64-
insn_slt, insn_slti, insn_sltiu, insn_sltu, insn_sra, insn_srl,
65-
insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall, insn_tlbp,
66-
insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh, insn_xor,
67-
insn_xori, insn_yield,
64+
insn_slt, insn_slti, insn_sltiu, insn_sltu, insn_sra, insn_srav,
65+
insn_srl, insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall,
66+
insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh,
67+
insn_xor, insn_xori, insn_yield,
6868
insn_invalid /* insn_invalid must be last */
6969
};
7070

@@ -353,6 +353,7 @@ I_u2u1s3(_slti)
353353
I_u2u1s3(_sltiu)
354354
I_u3u1u2(_sltu)
355355
I_u2u1u3(_sra)
356+
I_u3u2u1(_srav)
356357
I_u2u1u3(_srl)
357358
I_u3u2u1(_srlv)
358359
I_u2u1u3(_rotr)

arch/mips/net/ebpf_jit.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
854854
case BPF_ALU | BPF_MOD | BPF_X: /* ALU_REG */
855855
case BPF_ALU | BPF_LSH | BPF_X: /* ALU_REG */
856856
case BPF_ALU | BPF_RSH | BPF_X: /* ALU_REG */
857+
case BPF_ALU | BPF_ARSH | BPF_X: /* ALU_REG */
857858
src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp);
858859
dst = ebpf_to_mips_reg(ctx, insn, dst_reg);
859860
if (src < 0 || dst < 0)
@@ -913,6 +914,9 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
913914
case BPF_RSH:
914915
emit_instr(ctx, srlv, dst, dst, src);
915916
break;
917+
case BPF_ARSH:
918+
emit_instr(ctx, srav, dst, dst, src);
919+
break;
916920
default:
917921
pr_err("ALU_REG NOT HANDLED\n");
918922
return -EINVAL;

arch/powerpc/include/asm/ppc-opcode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@
342342
#define PPC_INST_SLW 0x7c000030
343343
#define PPC_INST_SLD 0x7c000036
344344
#define PPC_INST_SRW 0x7c000430
345+
#define PPC_INST_SRAW 0x7c000630
346+
#define PPC_INST_SRAWI 0x7c000670
345347
#define PPC_INST_SRD 0x7c000436
346348
#define PPC_INST_SRAD 0x7c000634
347349
#define PPC_INST_SRADI 0x7c000674

arch/powerpc/net/bpf_jit.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@
152152
___PPC_RS(a) | ___PPC_RB(s))
153153
#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | ___PPC_RA(d) | \
154154
___PPC_RS(a) | ___PPC_RB(s))
155+
#define PPC_SRAW(d, a, s) EMIT(PPC_INST_SRAW | ___PPC_RA(d) | \
156+
___PPC_RS(a) | ___PPC_RB(s))
157+
#define PPC_SRAWI(d, a, i) EMIT(PPC_INST_SRAWI | ___PPC_RA(d) | \
158+
___PPC_RS(a) | __PPC_SH(i))
155159
#define PPC_SRD(d, a, s) EMIT(PPC_INST_SRD | ___PPC_RA(d) | \
156160
___PPC_RS(a) | ___PPC_RB(s))
157161
#define PPC_SRAD(d, a, s) EMIT(PPC_INST_SRAD | ___PPC_RA(d) | \

arch/powerpc/net/bpf_jit_comp64.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,15 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
529529
if (imm != 0)
530530
PPC_SRDI(dst_reg, dst_reg, imm);
531531
break;
532+
case BPF_ALU | BPF_ARSH | BPF_X: /* (s32) dst >>= src */
533+
PPC_SRAW(dst_reg, dst_reg, src_reg);
534+
goto bpf_alu32_trunc;
532535
case BPF_ALU64 | BPF_ARSH | BPF_X: /* (s64) dst >>= src */
533536
PPC_SRAD(dst_reg, dst_reg, src_reg);
534537
break;
538+
case BPF_ALU | BPF_ARSH | BPF_K: /* (s32) dst >>= imm */
539+
PPC_SRAWI(dst_reg, dst_reg, imm);
540+
goto bpf_alu32_trunc;
535541
case BPF_ALU64 | BPF_ARSH | BPF_K: /* (s64) dst >>= imm */
536542
if (imm != 0)
537543
PPC_SRADI(dst_reg, dst_reg, imm);

arch/s390/net/bpf_jit_comp.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,22 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
821821
/*
822822
* BPF_ARSH
823823
*/
824+
case BPF_ALU | BPF_ARSH | BPF_X: /* ((s32) dst) >>= src */
825+
/* sra %dst,%dst,0(%src) */
826+
EMIT4_DISP(0x8a000000, dst_reg, src_reg, 0);
827+
EMIT_ZERO(dst_reg);
828+
break;
824829
case BPF_ALU64 | BPF_ARSH | BPF_X: /* ((s64) dst) >>= src */
825830
/* srag %dst,%dst,0(%src) */
826831
EMIT6_DISP_LH(0xeb000000, 0x000a, dst_reg, dst_reg, src_reg, 0);
827832
break;
833+
case BPF_ALU | BPF_ARSH | BPF_K: /* ((s32) dst >> imm */
834+
if (imm == 0)
835+
break;
836+
/* sra %dst,imm(%r0) */
837+
EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm);
838+
EMIT_ZERO(dst_reg);
839+
break;
828840
case BPF_ALU64 | BPF_ARSH | BPF_K: /* ((s64) dst) >>= imm */
829841
if (imm == 0)
830842
break;

arch/x86/net/bpf_jit_comp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
11811181
}
11821182

11831183
if (!image || !prog->is_func || extra_pass) {
1184+
if (image)
1185+
bpf_prog_fill_jited_linfo(prog, addrs);
11841186
out_addrs:
11851187
kfree(addrs);
11861188
kfree(jit_data);

drivers/media/rc/bpf-lirc.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@ static const struct bpf_func_proto rc_keydown_proto = {
5959
.arg4_type = ARG_ANYTHING,
6060
};
6161

62+
BPF_CALL_3(bpf_rc_pointer_rel, u32*, sample, s32, rel_x, s32, rel_y)
63+
{
64+
struct ir_raw_event_ctrl *ctrl;
65+
66+
ctrl = container_of(sample, struct ir_raw_event_ctrl, bpf_sample);
67+
68+
input_report_rel(ctrl->dev->input_dev, REL_X, rel_x);
69+
input_report_rel(ctrl->dev->input_dev, REL_Y, rel_y);
70+
input_sync(ctrl->dev->input_dev);
71+
72+
return 0;
73+
}
74+
75+
static const struct bpf_func_proto rc_pointer_rel_proto = {
76+
.func = bpf_rc_pointer_rel,
77+
.gpl_only = true,
78+
.ret_type = RET_INTEGER,
79+
.arg1_type = ARG_PTR_TO_CTX,
80+
.arg2_type = ARG_ANYTHING,
81+
.arg3_type = ARG_ANYTHING,
82+
};
83+
6284
static const struct bpf_func_proto *
6385
lirc_mode2_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
6486
{
@@ -67,6 +89,8 @@ lirc_mode2_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
6789
return &rc_repeat_proto;
6890
case BPF_FUNC_rc_keydown:
6991
return &rc_keydown_proto;
92+
case BPF_FUNC_rc_pointer_rel:
93+
return &rc_pointer_rel_proto;
7094
case BPF_FUNC_map_lookup_elem:
7195
return &bpf_map_lookup_elem_proto;
7296
case BPF_FUNC_map_update_elem:

drivers/net/ethernet/netronome/nfp/bpf/jit.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,6 +2382,49 @@ static int neg_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
23822382
return 0;
23832383
}
23842384

2385+
static int __ashr_imm(struct nfp_prog *nfp_prog, u8 dst, u8 shift_amt)
2386+
{
2387+
/* Set signedness bit (MSB of result). */
2388+
emit_alu(nfp_prog, reg_none(), reg_a(dst), ALU_OP_OR, reg_imm(0));
2389+
emit_shf(nfp_prog, reg_both(dst), reg_none(), SHF_OP_ASHR, reg_b(dst),
2390+
SHF_SC_R_SHF, shift_amt);
2391+
wrp_immed(nfp_prog, reg_both(dst + 1), 0);
2392+
2393+
return 0;
2394+
}
2395+
2396+
static int ashr_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
2397+
{
2398+
const struct bpf_insn *insn = &meta->insn;
2399+
u64 umin, umax;
2400+
u8 dst, src;
2401+
2402+
dst = insn->dst_reg * 2;
2403+
umin = meta->umin_src;
2404+
umax = meta->umax_src;
2405+
if (umin == umax)
2406+
return __ashr_imm(nfp_prog, dst, umin);
2407+
2408+
src = insn->src_reg * 2;
2409+
/* NOTE: the first insn will set both indirect shift amount (source A)
2410+
* and signedness bit (MSB of result).
2411+
*/
2412+
emit_alu(nfp_prog, reg_none(), reg_a(src), ALU_OP_OR, reg_b(dst));
2413+
emit_shf_indir(nfp_prog, reg_both(dst), reg_none(), SHF_OP_ASHR,
2414+
reg_b(dst), SHF_SC_R_SHF);
2415+
wrp_immed(nfp_prog, reg_both(dst + 1), 0);
2416+
2417+
return 0;
2418+
}
2419+
2420+
static int ashr_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
2421+
{
2422+
const struct bpf_insn *insn = &meta->insn;
2423+
u8 dst = insn->dst_reg * 2;
2424+
2425+
return __ashr_imm(nfp_prog, dst, insn->imm);
2426+
}
2427+
23852428
static int shl_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
23862429
{
23872430
const struct bpf_insn *insn = &meta->insn;
@@ -3286,6 +3329,8 @@ static const instr_cb_t instr_cb[256] = {
32863329
[BPF_ALU | BPF_DIV | BPF_K] = div_imm,
32873330
[BPF_ALU | BPF_NEG] = neg_reg,
32883331
[BPF_ALU | BPF_LSH | BPF_K] = shl_imm,
3332+
[BPF_ALU | BPF_ARSH | BPF_X] = ashr_reg,
3333+
[BPF_ALU | BPF_ARSH | BPF_K] = ashr_imm,
32893334
[BPF_ALU | BPF_END | BPF_X] = end_reg32,
32903335
[BPF_LD | BPF_IMM | BPF_DW] = imm_ld8,
32913336
[BPF_LD | BPF_ABS | BPF_B] = data_ld1,

include/linux/bpf.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,28 @@ struct bpf_prog_aux {
319319
struct bpf_prog_offload *offload;
320320
struct btf *btf;
321321
struct bpf_func_info *func_info;
322+
/* bpf_line_info loaded from userspace. linfo->insn_off
323+
* has the xlated insn offset.
324+
* Both the main and sub prog share the same linfo.
325+
* The subprog can access its first linfo by
326+
* using the linfo_idx.
327+
*/
328+
struct bpf_line_info *linfo;
329+
/* jited_linfo is the jited addr of the linfo. It has a
330+
* one to one mapping to linfo:
331+
* jited_linfo[i] is the jited addr for the linfo[i]->insn_off.
332+
* Both the main and sub prog share the same jited_linfo.
333+
* The subprog can access its first jited_linfo by
334+
* using the linfo_idx.
335+
*/
336+
void **jited_linfo;
322337
u32 func_info_cnt;
338+
u32 nr_linfo;
339+
/* subprog can use linfo_idx to access its first linfo and
340+
* jited_linfo.
341+
* main prog always has linfo_idx == 0
342+
*/
343+
u32 linfo_idx;
323344
union {
324345
struct work_struct work;
325346
struct rcu_head rcu;

include/linux/bpf_verifier.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log)
203203

204204
struct bpf_subprog_info {
205205
u32 start; /* insn idx of function entry point */
206+
u32 linfo_idx; /* The idx to the main_prog->aux->linfo */
206207
u16 stack_depth; /* max. stack depth used by this function */
207208
};
208209

include/linux/btf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
4646
struct seq_file *m);
4747
int btf_get_fd_by_id(u32 id);
4848
u32 btf_id(const struct btf *btf);
49+
bool btf_name_offset_valid(const struct btf *btf, u32 offset);
4950

5051
#ifdef CONFIG_BPF_SYSCALL
5152
const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id);

include/linux/filter.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,13 @@ void bpf_prog_free(struct bpf_prog *fp);
725725

726726
bool bpf_opcode_in_insntable(u8 code);
727727

728+
void bpf_prog_free_linfo(struct bpf_prog *prog);
729+
void bpf_prog_fill_jited_linfo(struct bpf_prog *prog,
730+
const u32 *insn_to_jit_off);
731+
int bpf_prog_alloc_jited_linfo(struct bpf_prog *prog);
732+
void bpf_prog_free_jited_linfo(struct bpf_prog *prog);
733+
void bpf_prog_free_unused_jited_linfo(struct bpf_prog *prog);
734+
728735
struct bpf_prog *bpf_prog_alloc(unsigned int size, gfp_t gfp_extra_flags);
729736
struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
730737
gfp_t gfp_extra_flags);

0 commit comments

Comments
 (0)