Skip to content

Commit fa593d0

Browse files
committed
Merge tag 'bpf-next-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Pull bpf updates from Alexei Starovoitov: "For this merge window we're splitting BPF pull request into three for higher visibility: main changes, res_spin_lock, try_alloc_pages. These are the main BPF changes: - Add DFA-based live registers analysis to improve verification of programs with loops (Eduard Zingerman) - Introduce load_acquire and store_release BPF instructions and add x86, arm64 JIT support (Peilin Ye) - Fix loop detection logic in the verifier (Eduard Zingerman) - Drop unnecesary lock in bpf_map_inc_not_zero() (Eric Dumazet) - Add kfunc for populating cpumask bits (Emil Tsalapatis) - Convert various shell based tests to selftests/bpf/test_progs format (Bastien Curutchet) - Allow passing referenced kptrs into struct_ops callbacks (Amery Hung) - Add a flag to LSM bpf hook to facilitate bpf program signing (Blaise Boscaccy) - Track arena arguments in kfuncs (Ihor Solodrai) - Add copy_remote_vm_str() helper for reading strings from remote VM and bpf_copy_from_user_task_str() kfunc (Jordan Rome) - Add support for timed may_goto instruction (Kumar Kartikeya Dwivedi) - Allow bpf_get_netns_cookie() int cgroup_skb programs (Mahe Tardy) - Reduce bpf_cgrp_storage_busy false positives when accessing cgroup local storage (Martin KaFai Lau) - Introduce bpf_dynptr_copy() kfunc (Mykyta Yatsenko) - Allow retrieving BTF data with BTF token (Mykyta Yatsenko) - Add BPF kfuncs to set and get xattrs with 'security.bpf.' prefix (Song Liu) - Reject attaching programs to noreturn functions (Yafang Shao) - Introduce pre-order traversal of cgroup bpf programs (Yonghong Song)" * tag 'bpf-next-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (186 commits) selftests/bpf: Add selftests for load-acquire/store-release when register number is invalid bpf: Fix out-of-bounds read in check_atomic_load/store() libbpf: Add namespace for errstr making it libbpf_errstr bpf: Add struct_ops context information to struct bpf_prog_aux selftests/bpf: Sanitize pointer prior fclose() selftests/bpf: Migrate test_xdp_vlan.sh into test_progs selftests/bpf: test_xdp_vlan: Rename BPF sections bpf: clarify a misleading verifier error message selftests/bpf: Add selftest for attaching fexit to __noreturn functions bpf: Reject attaching fexit/fmod_ret to __noreturn functions bpf: Only fails the busy counter check in bpf_cgrp_storage_get if it creates storage bpf: Make perf_event_read_output accessible in all program types. bpftool: Using the right format specifiers bpftool: Add -Wformat-signedness flag to detect format errors selftests/bpf: Test freplace from user namespace libbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID bpf: Return prog btf_id without capable check bpf: BPF token support for BPF_BTF_GET_FD_BY_ID bpf, x86: Fix objtool warning for timed may_goto bpf: Check map->record at the beginning of check_and_free_fields() ...
2 parents 7f2ff7b + 9aa8fe2 commit fa593d0

File tree

213 files changed

+10643
-3497
lines changed

Some content is hidden

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

213 files changed

+10643
-3497
lines changed

Documentation/bpf/bpf_iterators.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ following steps:
8686
The following are a few examples of selftest BPF iterator programs:
8787

8888
* `bpf_iter_tcp4.c <https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c>`_
89-
* `bpf_iter_task_vma.c <https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf/progs/bpf_iter_task_vma.c>`_
89+
* `bpf_iter_task_vmas.c <https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf/progs/bpf_iter_task_vmas.c>`_
9090
* `bpf_iter_task_file.c <https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf/progs/bpf_iter_task_file.c>`_
9191

9292
Let us look at ``bpf_iter_task_file.c``, which runs in kernel space:

Documentation/bpf/btf.rst

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ Each type contains the following common data::
102102
* bits 24-28: kind (e.g. int, ptr, array...etc)
103103
* bits 29-30: unused
104104
* bit 31: kind_flag, currently used by
105-
* struct, union, fwd, enum and enum64.
105+
* struct, union, enum, fwd, enum64,
106+
* decl_tag and type_tag
106107
*/
107108
__u32 info;
108109
/* "size" is used by INT, ENUM, STRUCT, UNION and ENUM64.
@@ -478,7 +479,7 @@ No additional type data follow ``btf_type``.
478479

479480
``struct btf_type`` encoding requirement:
480481
* ``name_off``: offset to a non-empty string
481-
* ``info.kind_flag``: 0
482+
* ``info.kind_flag``: 0 or 1
482483
* ``info.kind``: BTF_KIND_DECL_TAG
483484
* ``info.vlen``: 0
484485
* ``type``: ``struct``, ``union``, ``func``, ``var`` or ``typedef``
@@ -489,7 +490,6 @@ No additional type data follow ``btf_type``.
489490
__u32 component_idx;
490491
};
491492

492-
The ``name_off`` encodes btf_decl_tag attribute string.
493493
The ``type`` should be ``struct``, ``union``, ``func``, ``var`` or ``typedef``.
494494
For ``var`` or ``typedef`` type, ``btf_decl_tag.component_idx`` must be ``-1``.
495495
For the other three types, if the btf_decl_tag attribute is
@@ -499,12 +499,21 @@ the attribute is applied to a ``struct``/``union`` member or
499499
a ``func`` argument, and ``btf_decl_tag.component_idx`` should be a
500500
valid index (starting from 0) pointing to a member or an argument.
501501

502+
If ``info.kind_flag`` is 0, then this is a normal decl tag, and the
503+
``name_off`` encodes btf_decl_tag attribute string.
504+
505+
If ``info.kind_flag`` is 1, then the decl tag represents an arbitrary
506+
__attribute__. In this case, ``name_off`` encodes a string
507+
representing the attribute-list of the attribute specifier. For
508+
example, for an ``__attribute__((aligned(4)))`` the string's contents
509+
is ``aligned(4)``.
510+
502511
2.2.18 BTF_KIND_TYPE_TAG
503512
~~~~~~~~~~~~~~~~~~~~~~~~
504513

505514
``struct btf_type`` encoding requirement:
506515
* ``name_off``: offset to a non-empty string
507-
* ``info.kind_flag``: 0
516+
* ``info.kind_flag``: 0 or 1
508517
* ``info.kind``: BTF_KIND_TYPE_TAG
509518
* ``info.vlen``: 0
510519
* ``type``: the type with ``btf_type_tag`` attribute
@@ -522,6 +531,14 @@ type_tag, then zero or more const/volatile/restrict/typedef
522531
and finally the base type. The base type is one of
523532
int, ptr, array, struct, union, enum, func_proto and float types.
524533

534+
Similarly to decl tags, if the ``info.kind_flag`` is 0, then this is a
535+
normal type tag, and the ``name_off`` encodes btf_type_tag attribute
536+
string.
537+
538+
If ``info.kind_flag`` is 1, then the type tag represents an arbitrary
539+
__attribute__, and the ``name_off`` encodes a string representing the
540+
attribute-list of the attribute specifier.
541+
525542
2.2.19 BTF_KIND_ENUM64
526543
~~~~~~~~~~~~~~~~~~~~~~
527544

Documentation/bpf/standardization/instruction-set.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,34 +324,42 @@ register.
324324

325325
.. table:: Arithmetic instructions
326326

327-
===== ===== ======= ==========================================================
327+
===== ===== ======= ===================================================================================
328328
name code offset description
329-
===== ===== ======= ==========================================================
329+
===== ===== ======= ===================================================================================
330330
ADD 0x0 0 dst += src
331331
SUB 0x1 0 dst -= src
332332
MUL 0x2 0 dst \*= src
333333
DIV 0x3 0 dst = (src != 0) ? (dst / src) : 0
334-
SDIV 0x3 1 dst = (src != 0) ? (dst s/ src) : 0
334+
SDIV 0x3 1 dst = (src == 0) ? 0 : ((src == -1 && dst == LLONG_MIN) ? LLONG_MIN : (dst s/ src))
335335
OR 0x4 0 dst \|= src
336336
AND 0x5 0 dst &= src
337337
LSH 0x6 0 dst <<= (src & mask)
338338
RSH 0x7 0 dst >>= (src & mask)
339339
NEG 0x8 0 dst = -dst
340340
MOD 0x9 0 dst = (src != 0) ? (dst % src) : dst
341-
SMOD 0x9 1 dst = (src != 0) ? (dst s% src) : dst
341+
SMOD 0x9 1 dst = (src == 0) ? dst : ((src == -1 && dst == LLONG_MIN) ? 0: (dst s% src))
342342
XOR 0xa 0 dst ^= src
343343
MOV 0xb 0 dst = src
344344
MOVSX 0xb 8/16/32 dst = (s8,s16,s32)src
345345
ARSH 0xc 0 :term:`sign extending<Sign Extend>` dst >>= (src & mask)
346346
END 0xd 0 byte swap operations (see `Byte swap instructions`_ below)
347-
===== ===== ======= ==========================================================
347+
===== ===== ======= ===================================================================================
348348

349349
Underflow and overflow are allowed during arithmetic operations, meaning
350350
the 64-bit or 32-bit value will wrap. If BPF program execution would
351351
result in division by zero, the destination register is instead set to zero.
352+
Otherwise, for ``ALU64``, if execution would result in ``LLONG_MIN``
353+
dividing -1, the desination register is instead set to ``LLONG_MIN``. For
354+
``ALU``, if execution would result in ``INT_MIN`` dividing -1, the
355+
desination register is instead set to ``INT_MIN``.
356+
352357
If execution would result in modulo by zero, for ``ALU64`` the value of
353358
the destination register is unchanged whereas for ``ALU`` the upper
354-
32 bits of the destination register are zeroed.
359+
32 bits of the destination register are zeroed. Otherwise, for ``ALU64``,
360+
if execution would resuslt in ``LLONG_MIN`` modulo -1, the destination
361+
register is instead set to 0. For ``ALU``, if execution would result in
362+
``INT_MIN`` modulo -1, the destination register is instead set to 0.
355363

356364
``{ADD, X, ALU}``, where 'code' = ``ADD``, 'source' = ``X``, and 'class' = ``ALU``, means::
357365

arch/arm64/include/asm/insn.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,10 @@ enum aarch64_insn_ldst_type {
188188
AARCH64_INSN_LDST_STORE_PAIR_PRE_INDEX,
189189
AARCH64_INSN_LDST_LOAD_PAIR_POST_INDEX,
190190
AARCH64_INSN_LDST_STORE_PAIR_POST_INDEX,
191+
AARCH64_INSN_LDST_LOAD_ACQ,
191192
AARCH64_INSN_LDST_LOAD_EX,
192193
AARCH64_INSN_LDST_LOAD_ACQ_EX,
194+
AARCH64_INSN_LDST_STORE_REL,
193195
AARCH64_INSN_LDST_STORE_EX,
194196
AARCH64_INSN_LDST_STORE_REL_EX,
195197
AARCH64_INSN_LDST_SIGNED_LOAD_IMM_OFFSET,
@@ -351,8 +353,10 @@ __AARCH64_INSN_FUNCS(ldr_imm, 0x3FC00000, 0x39400000)
351353
__AARCH64_INSN_FUNCS(ldr_lit, 0xBF000000, 0x18000000)
352354
__AARCH64_INSN_FUNCS(ldrsw_lit, 0xFF000000, 0x98000000)
353355
__AARCH64_INSN_FUNCS(exclusive, 0x3F800000, 0x08000000)
354-
__AARCH64_INSN_FUNCS(load_ex, 0x3F400000, 0x08400000)
355-
__AARCH64_INSN_FUNCS(store_ex, 0x3F400000, 0x08000000)
356+
__AARCH64_INSN_FUNCS(load_acq, 0x3FDFFC00, 0x08DFFC00)
357+
__AARCH64_INSN_FUNCS(store_rel, 0x3FDFFC00, 0x089FFC00)
358+
__AARCH64_INSN_FUNCS(load_ex, 0x3FC00000, 0x08400000)
359+
__AARCH64_INSN_FUNCS(store_ex, 0x3FC00000, 0x08000000)
356360
__AARCH64_INSN_FUNCS(mops, 0x3B200C00, 0x19000400)
357361
__AARCH64_INSN_FUNCS(stp, 0x7FC00000, 0x29000000)
358362
__AARCH64_INSN_FUNCS(ldp, 0x7FC00000, 0x29400000)
@@ -602,6 +606,10 @@ u32 aarch64_insn_gen_load_store_pair(enum aarch64_insn_register reg1,
602606
int offset,
603607
enum aarch64_insn_variant variant,
604608
enum aarch64_insn_ldst_type type);
609+
u32 aarch64_insn_gen_load_acq_store_rel(enum aarch64_insn_register reg,
610+
enum aarch64_insn_register base,
611+
enum aarch64_insn_size_type size,
612+
enum aarch64_insn_ldst_type type);
605613
u32 aarch64_insn_gen_load_store_ex(enum aarch64_insn_register reg,
606614
enum aarch64_insn_register base,
607615
enum aarch64_insn_register state,

arch/arm64/lib/insn.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,35 @@ u32 aarch64_insn_gen_load_store_pair(enum aarch64_insn_register reg1,
540540
offset >> shift);
541541
}
542542

543+
u32 aarch64_insn_gen_load_acq_store_rel(enum aarch64_insn_register reg,
544+
enum aarch64_insn_register base,
545+
enum aarch64_insn_size_type size,
546+
enum aarch64_insn_ldst_type type)
547+
{
548+
u32 insn;
549+
550+
switch (type) {
551+
case AARCH64_INSN_LDST_LOAD_ACQ:
552+
insn = aarch64_insn_get_load_acq_value();
553+
break;
554+
case AARCH64_INSN_LDST_STORE_REL:
555+
insn = aarch64_insn_get_store_rel_value();
556+
break;
557+
default:
558+
pr_err("%s: unknown load-acquire/store-release encoding %d\n",
559+
__func__, type);
560+
return AARCH64_BREAK_FAULT;
561+
}
562+
563+
insn = aarch64_insn_encode_ldst_size(size, insn);
564+
565+
insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RT, insn,
566+
reg);
567+
568+
return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn,
569+
base);
570+
}
571+
543572
u32 aarch64_insn_gen_load_store_ex(enum aarch64_insn_register reg,
544573
enum aarch64_insn_register base,
545574
enum aarch64_insn_register state,

arch/arm64/net/bpf_jit.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,26 @@
119119
aarch64_insn_gen_load_store_ex(Rt, Rn, Rs, A64_SIZE(sf), \
120120
AARCH64_INSN_LDST_STORE_REL_EX)
121121

122+
/* Load-acquire & store-release */
123+
#define A64_LDAR(Rt, Rn, size) \
124+
aarch64_insn_gen_load_acq_store_rel(Rt, Rn, AARCH64_INSN_SIZE_##size, \
125+
AARCH64_INSN_LDST_LOAD_ACQ)
126+
#define A64_STLR(Rt, Rn, size) \
127+
aarch64_insn_gen_load_acq_store_rel(Rt, Rn, AARCH64_INSN_SIZE_##size, \
128+
AARCH64_INSN_LDST_STORE_REL)
129+
130+
/* Rt = [Rn] (load acquire) */
131+
#define A64_LDARB(Wt, Xn) A64_LDAR(Wt, Xn, 8)
132+
#define A64_LDARH(Wt, Xn) A64_LDAR(Wt, Xn, 16)
133+
#define A64_LDAR32(Wt, Xn) A64_LDAR(Wt, Xn, 32)
134+
#define A64_LDAR64(Xt, Xn) A64_LDAR(Xt, Xn, 64)
135+
136+
/* [Rn] = Rt (store release) */
137+
#define A64_STLRB(Wt, Xn) A64_STLR(Wt, Xn, 8)
138+
#define A64_STLRH(Wt, Xn) A64_STLR(Wt, Xn, 16)
139+
#define A64_STLR32(Wt, Xn) A64_STLR(Wt, Xn, 32)
140+
#define A64_STLR64(Xt, Xn) A64_STLR(Xt, Xn, 64)
141+
122142
/*
123143
* LSE atomics
124144
*

arch/arm64/net/bpf_jit_comp.c

Lines changed: 87 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static inline void emit_a64_add_i(const bool is64, const int dst, const int src,
272272
{
273273
if (is_addsub_imm(imm)) {
274274
emit(A64_ADD_I(is64, dst, src, imm), ctx);
275-
} else if (is_addsub_imm(-imm)) {
275+
} else if (is_addsub_imm(-(u32)imm)) {
276276
emit(A64_SUB_I(is64, dst, src, -imm), ctx);
277277
} else {
278278
emit_a64_mov_i(is64, tmp, imm, ctx);
@@ -647,6 +647,81 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)
647647
return 0;
648648
}
649649

650+
static int emit_atomic_ld_st(const struct bpf_insn *insn, struct jit_ctx *ctx)
651+
{
652+
const s32 imm = insn->imm;
653+
const s16 off = insn->off;
654+
const u8 code = insn->code;
655+
const bool arena = BPF_MODE(code) == BPF_PROBE_ATOMIC;
656+
const u8 arena_vm_base = bpf2a64[ARENA_VM_START];
657+
const u8 dst = bpf2a64[insn->dst_reg];
658+
const u8 src = bpf2a64[insn->src_reg];
659+
const u8 tmp = bpf2a64[TMP_REG_1];
660+
u8 reg;
661+
662+
switch (imm) {
663+
case BPF_LOAD_ACQ:
664+
reg = src;
665+
break;
666+
case BPF_STORE_REL:
667+
reg = dst;
668+
break;
669+
default:
670+
pr_err_once("unknown atomic load/store op code %02x\n", imm);
671+
return -EINVAL;
672+
}
673+
674+
if (off) {
675+
emit_a64_add_i(1, tmp, reg, tmp, off, ctx);
676+
reg = tmp;
677+
}
678+
if (arena) {
679+
emit(A64_ADD(1, tmp, reg, arena_vm_base), ctx);
680+
reg = tmp;
681+
}
682+
683+
switch (imm) {
684+
case BPF_LOAD_ACQ:
685+
switch (BPF_SIZE(code)) {
686+
case BPF_B:
687+
emit(A64_LDARB(dst, reg), ctx);
688+
break;
689+
case BPF_H:
690+
emit(A64_LDARH(dst, reg), ctx);
691+
break;
692+
case BPF_W:
693+
emit(A64_LDAR32(dst, reg), ctx);
694+
break;
695+
case BPF_DW:
696+
emit(A64_LDAR64(dst, reg), ctx);
697+
break;
698+
}
699+
break;
700+
case BPF_STORE_REL:
701+
switch (BPF_SIZE(code)) {
702+
case BPF_B:
703+
emit(A64_STLRB(src, reg), ctx);
704+
break;
705+
case BPF_H:
706+
emit(A64_STLRH(src, reg), ctx);
707+
break;
708+
case BPF_W:
709+
emit(A64_STLR32(src, reg), ctx);
710+
break;
711+
case BPF_DW:
712+
emit(A64_STLR64(src, reg), ctx);
713+
break;
714+
}
715+
break;
716+
default:
717+
pr_err_once("unexpected atomic load/store op code %02x\n",
718+
imm);
719+
return -EINVAL;
720+
}
721+
722+
return 0;
723+
}
724+
650725
#ifdef CONFIG_ARM64_LSE_ATOMICS
651726
static int emit_lse_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
652727
{
@@ -1159,7 +1234,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
11591234
case BPF_ALU64 | BPF_SUB | BPF_K:
11601235
if (is_addsub_imm(imm)) {
11611236
emit(A64_SUB_I(is64, dst, dst, imm), ctx);
1162-
} else if (is_addsub_imm(-imm)) {
1237+
} else if (is_addsub_imm(-(u32)imm)) {
11631238
emit(A64_ADD_I(is64, dst, dst, -imm), ctx);
11641239
} else {
11651240
emit_a64_mov_i(is64, tmp, imm, ctx);
@@ -1330,7 +1405,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
13301405
case BPF_JMP32 | BPF_JSLE | BPF_K:
13311406
if (is_addsub_imm(imm)) {
13321407
emit(A64_CMP_I(is64, dst, imm), ctx);
1333-
} else if (is_addsub_imm(-imm)) {
1408+
} else if (is_addsub_imm(-(u32)imm)) {
13341409
emit(A64_CMN_I(is64, dst, -imm), ctx);
13351410
} else {
13361411
emit_a64_mov_i(is64, tmp, imm, ctx);
@@ -1641,11 +1716,17 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
16411716
return ret;
16421717
break;
16431718

1719+
case BPF_STX | BPF_ATOMIC | BPF_B:
1720+
case BPF_STX | BPF_ATOMIC | BPF_H:
16441721
case BPF_STX | BPF_ATOMIC | BPF_W:
16451722
case BPF_STX | BPF_ATOMIC | BPF_DW:
1723+
case BPF_STX | BPF_PROBE_ATOMIC | BPF_B:
1724+
case BPF_STX | BPF_PROBE_ATOMIC | BPF_H:
16461725
case BPF_STX | BPF_PROBE_ATOMIC | BPF_W:
16471726
case BPF_STX | BPF_PROBE_ATOMIC | BPF_DW:
1648-
if (cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
1727+
if (bpf_atomic_is_load_store(insn))
1728+
ret = emit_atomic_ld_st(insn, ctx);
1729+
else if (cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
16491730
ret = emit_lse_atomic(insn, ctx);
16501731
else
16511732
ret = emit_ll_sc_atomic(insn, ctx);
@@ -2669,7 +2750,8 @@ bool bpf_jit_supports_insn(struct bpf_insn *insn, bool in_arena)
26692750
switch (insn->code) {
26702751
case BPF_STX | BPF_ATOMIC | BPF_W:
26712752
case BPF_STX | BPF_ATOMIC | BPF_DW:
2672-
if (!cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
2753+
if (!bpf_atomic_is_load_store(insn) &&
2754+
!cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
26732755
return false;
26742756
}
26752757
return true;

arch/s390/net/bpf_jit_comp.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,10 +2919,16 @@ bool bpf_jit_supports_arena(void)
29192919

29202920
bool bpf_jit_supports_insn(struct bpf_insn *insn, bool in_arena)
29212921
{
2922-
/*
2923-
* Currently the verifier uses this function only to check which
2924-
* atomic stores to arena are supported, and they all are.
2925-
*/
2922+
if (!in_arena)
2923+
return true;
2924+
switch (insn->code) {
2925+
case BPF_STX | BPF_ATOMIC | BPF_B:
2926+
case BPF_STX | BPF_ATOMIC | BPF_H:
2927+
case BPF_STX | BPF_ATOMIC | BPF_W:
2928+
case BPF_STX | BPF_ATOMIC | BPF_DW:
2929+
if (bpf_atomic_is_load_store(insn))
2930+
return false;
2931+
}
29262932
return true;
29272933
}
29282934

arch/x86/net/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
ifeq ($(CONFIG_X86_32),y)
77
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp32.o
88
else
9-
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o
9+
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o bpf_timed_may_goto.o
1010
endif

0 commit comments

Comments
 (0)