Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test PR #8668

Closed
Closed

Test PR #8668

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
fc3ab17
Merge branch 'selftests-bpf-implement-setting-global-variables-in-ver…
anakryiko Feb 26, 2025
bacac21
bpf/helpers: Refactor bpf_dynptr_read and bpf_dynptr_write
mykyta5 Feb 26, 2025
9d15404
bpf/helpers: Introduce bpf_dynptr_copy kfunc
mykyta5 Feb 26, 2025
8fc1834
selftests/bpf: Add tests for bpf_dynptr_copy
mykyta5 Feb 26, 2025
43d9d43
Merge branch 'introduce-bpf_dynptr_copy-kfunc'
anakryiko Feb 26, 2025
27e3162
selftests/bpf: Allow auto port binding for cgroup connect
mrpre Feb 27, 2025
dbe7d46
selftests/bpf: Allow auto port binding for bpf nf
mrpre Feb 27, 2025
09de329
selftests/bpf: Fixes for test_maps test
mrpre Feb 27, 2025
0ffa016
Merge branch 'optimize-bpf-selftest-to-increase-ci-success-rate'
Feb 27, 2025
78a8a85
bpf: Allow pre-ordering for bpf cgroup progs
Feb 24, 2025
42c5e6d
selftests/bpf: Add selftests allowing cgroup prog pre-ordering
Feb 24, 2025
0aaddfb
locking/local_lock: Introduce localtry_lock_t
Feb 22, 2025
97769a5
mm, bpf: Introduce try_alloc_pages() for opportunistic page allocation
Feb 22, 2025
8c57b68
mm, bpf: Introduce free_pages_nolock()
Feb 22, 2025
01d3722
memcg: Use trylock to access memcg stock_lock.
Feb 22, 2025
e8d78db
mm, bpf: Use memcg in try_alloc_pages().
Feb 22, 2025
c9eb810
bpf: Use try_alloc_pages() to allocate pages for bpf needs.
Feb 22, 2025
93ed6fc
Merge branch 'bpf-mm-introduce-try_alloc_pages'
Feb 27, 2025
e4d68c0
Merge branch 'bpf-next/try_alloc_pages' into bpf-next/master
Feb 27, 2025
0b93631
bpf/selftests: test_select_reuseport_kern: Remove unused header
Tropicao Feb 27, 2025
90d8c89
bpf: Summarize sleepable global subprogs
kkdwivedi Mar 1, 2025
6e2cc60
selftests/bpf: Test sleepable global subprogs in atomic contexts
kkdwivedi Mar 1, 2025
ce9add7
selftests/bpf: Add tests for extending sleepable global subprogs
kkdwivedi Mar 1, 2025
53415f6
Merge branch 'global-subprogs-in-rcu-preempt-irq-disabled-sections'
Mar 2, 2025
17a82ed
bpf: no longer acquire map_idr_lock in bpf_map_inc_not_zero()
Mar 1, 2025
b2d9ef7
bpf: Factor out atomic_ptr_type_ok()
peilin-ye Mar 3, 2025
d430c46
bpf: Factor out check_atomic_rmw()
peilin-ye Mar 3, 2025
d38ad24
bpf: Factor out check_load_mem() and check_store_reg()
peilin-ye Mar 3, 2025
128cd76
veristat: @files-list.txt notation for object files list
eddyz87 Mar 1, 2025
1649753
veristat: Strerror expects positive number (errno)
eddyz87 Mar 1, 2025
b127528
veristat: Report program type guess results to sdterr
eddyz87 Mar 1, 2025
0bf6c8a
Merge branch 'veristat-files-list-txt-notation-for-object-files-list'
anakryiko Mar 3, 2025
6829f3c
selftests/bpf: test_tunnel: Add generic_attach* helpers
bastien-curutchet Mar 3, 2025
7289e59
selftests/bpf: test_tunnel: Add ping helpers
bastien-curutchet Mar 3, 2025
08d20ea
selftests/bpf: test_tunnel: Move gre tunnel test to test_progs
bastien-curutchet Mar 3, 2025
1ea01a8
selftests/bpf: test_tunnel: Move ip6gre tunnel test to test_progs
bastien-curutchet Mar 3, 2025
0ecd1e9
selftests/bpf: test_tunnel: Move erspan tunnel tests to test_progs
bastien-curutchet Mar 3, 2025
cae41f7
selftests/bpf: test_tunnel: Move ip6erspan tunnel test to test_progs
bastien-curutchet Mar 3, 2025
d89542d
selftests/bpf: test_tunnel: Move geneve tunnel test to test_progs
bastien-curutchet Mar 3, 2025
8d86094
selftests/bpf: test_tunnel: Move ip6geneve tunnel test to test_progs
bastien-curutchet Mar 3, 2025
680a752
selftests/bpf: test_tunnel: Move ip6tnl tunnel tests to test_progs
bastien-curutchet Mar 3, 2025
c8d6d78
selftests/bpf: test_tunnel: Remove test_tunnel.sh
bastien-curutchet Mar 3, 2025
a36a835
Merge branch 'selftests-bpf-migrate-test_tunnel-sh-to-test_progs'
Mar 3, 2025
122f1fd
net: filter: Avoid shadowing variable in bpf_convert_ctx_access()
leitao Feb 28, 2025
7218ff1
libbpf: Use map_is_created helper in map setters
mykyta5 Mar 3, 2025
8ca8f6d
libbpf: Introduce more granular state for bpf_object
mykyta5 Mar 3, 2025
da75554
libbpf: Split bpf object load into prepare/load
mykyta5 Mar 3, 2025
68b61a8
selftests/bpf: Add tests for bpf_object__prepare
mykyta5 Mar 3, 2025
7586e21
Merge branch 'introduce-bpf_object__prepare'
anakryiko Mar 3, 2025
13a664f
bpf: Add verifier support for timed may_goto
kkdwivedi Mar 4, 2025
2cb0a52
bpf, x86: Add x86 JIT support for timed may_goto
kkdwivedi Mar 4, 2025
ad55432
Merge branch 'timed-may_goto'
Mar 4, 2025
e24bbad
bpf: Introduce load-acquire and store-release instructions
peilin-ye Mar 4, 2025
4170a60
arm64: insn: Add BIT(23) to {load,store}_ex's mask
peilin-ye Mar 4, 2025
248b190
arm64: insn: Add load-acquire and store-release instructions
peilin-ye Mar 4, 2025
1bfe7f6
bpf, arm64: Support load-acquire and store-release instructions
peilin-ye Mar 4, 2025
14c0427
bpf, x86: Support load-acquire and store-release instructions
peilin-ye Mar 4, 2025
953df09
selftests/bpf: Add selftests for load-acquire and store-release instr…
peilin-ye Mar 4, 2025
c6287f1
Merge branch 'introduce-load-acquire-and-store-release-bpf-instructions'
Mar 4, 2025
1c15257
bpf: jmp_offset() and verbose_insn() utility functions
eddyz87 Mar 4, 2025
0ae958e
bpf: get_call_summary() utility function
eddyz87 Mar 4, 2025
7dad036
bpf: simple DFA-based live registers analysis
eddyz87 Mar 4, 2025
994a876
bpf: use register liveness information for func_states_equal
eddyz87 Mar 4, 2025
8a3fc22
selftests/bpf: test cases for compute_live_registers()
eddyz87 Mar 4, 2025
42ba8a4
Merge branch 'bpf-simple-dfa-based-live-registers-analysis'
Mar 4, 2025
aae1add
bpf: correct use/def for may_goto instruction
eddyz87 Mar 5, 2025
7781fd0
bpf, docs: Fix broken link to renamed bpf_iter_task_vmas.c
Mar 4, 2025
994fd3e
selftests/bpf: Introduce cond_break_label
kkdwivedi Mar 6, 2025
0201027
selftests/bpf: Introduce arena spin lock
kkdwivedi Mar 6, 2025
313149f
selftests/bpf: Add tests for arena spin lock
kkdwivedi Mar 6, 2025
48b3be8
Merge branch 'arena-spin-lock'
Mar 6, 2025
88b1c42
selftests/bpf: Move test_lwt_ip_encap to test_progs
bastien-curutchet Mar 4, 2025
5cb4077
selftests/bpf: Clean up call sites of stdio_restore()
ameryhung Mar 5, 2025
6d54a02
selftests/bpf: Allow assigning traffic monitor print function
ameryhung Mar 5, 2025
15bfc10
selftests/bpf: Fix dangling stdout seen by traffic monitor thread
ameryhung Mar 5, 2025
7e437dc
selftests/bpf: Fix cap_enable_effective() return code
kknjh Mar 5, 2025
359d070
selftests/bpf: lwt_seg6local: Remove unused routes
bastien-curutchet Mar 7, 2025
3fb97a2
selftests/bpf: lwt_seg6local: Move test to test_progs
bastien-curutchet Mar 7, 2025
f282146
Merge branch 'selftests-bpf-move-test_lwt_seg6local-to-test_progs'
Mar 8, 2025
63f99cd
bpf: add kfunc for populating cpumask bits
etsal Mar 9, 2025
3524b15
selftests: bpf: add bpf_cpumask_populate selftests
etsal Mar 9, 2025
d70870e
bpf: fix missing kdoc string fields in cpumask.c
etsal Mar 9, 2025
93ececb
selftests: bpf: fix duplicate selftests in cpumask_success.
etsal Mar 9, 2025
79d93c8
Merge branch 'bpf-introduce-helper-for-populating-bpf_cpumask'
Mar 10, 2025
74f36a9
selftests/bpf: Fix selection of static vs. dynamic LLVM
aspsk Mar 10, 2025
26350a2
mm: Fix the flipped condition in gfpflags_allow_spinning()
tehcaster Mar 10, 2025
bf5af29
selftests/bpf: Convert comma to semicolon
Mar 10, 2025
a8cd035
security: Propagate caller information in bpf hooks
Mar 10, 2025
f563314
selftests/bpf: Add a kernel flag test for LSM bpf hook
Mar 10, 2025
a68894a
Merge branch 'security-propagate-caller-information-in-bpf-hooks'
Mar 11, 2025
a74a2a3
bpf: bpftool: Setting error code in do_loader()
nswon Mar 11, 2025
be741c7
bpf: preload: Add MODULE_DESCRIPTION
arndb Mar 10, 2025
46d38f4
selftests/bpf: Fix arena_spin_lock compilation on PowerPC
kkdwivedi Mar 11, 2025
00d1fd2
bpf: udp: Avoid socket skips during iteration
jrife Mar 10, 2025
dcde5d5
bpf: tcp: Avoid socket skips during iteration
jrife Mar 13, 2025
6a5bdf6
selftests/bpf: Add tests for socket skips and repeats
jrife Mar 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/bpf/bpf_iterators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ following steps:
The following are a few examples of selftest BPF iterator programs:

* `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>`_
* `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>`_
* `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>`_
* `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>`_

Let us look at ``bpf_iter_task_file.c``, which runs in kernel space:
Expand Down
12 changes: 10 additions & 2 deletions arch/arm64/include/asm/insn.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ enum aarch64_insn_ldst_type {
AARCH64_INSN_LDST_STORE_PAIR_PRE_INDEX,
AARCH64_INSN_LDST_LOAD_PAIR_POST_INDEX,
AARCH64_INSN_LDST_STORE_PAIR_POST_INDEX,
AARCH64_INSN_LDST_LOAD_ACQ,
AARCH64_INSN_LDST_LOAD_EX,
AARCH64_INSN_LDST_LOAD_ACQ_EX,
AARCH64_INSN_LDST_STORE_REL,
AARCH64_INSN_LDST_STORE_EX,
AARCH64_INSN_LDST_STORE_REL_EX,
AARCH64_INSN_LDST_SIGNED_LOAD_IMM_OFFSET,
Expand Down Expand Up @@ -351,8 +353,10 @@ __AARCH64_INSN_FUNCS(ldr_imm, 0x3FC00000, 0x39400000)
__AARCH64_INSN_FUNCS(ldr_lit, 0xBF000000, 0x18000000)
__AARCH64_INSN_FUNCS(ldrsw_lit, 0xFF000000, 0x98000000)
__AARCH64_INSN_FUNCS(exclusive, 0x3F800000, 0x08000000)
__AARCH64_INSN_FUNCS(load_ex, 0x3F400000, 0x08400000)
__AARCH64_INSN_FUNCS(store_ex, 0x3F400000, 0x08000000)
__AARCH64_INSN_FUNCS(load_acq, 0x3FDFFC00, 0x08DFFC00)
__AARCH64_INSN_FUNCS(store_rel, 0x3FDFFC00, 0x089FFC00)
__AARCH64_INSN_FUNCS(load_ex, 0x3FC00000, 0x08400000)
__AARCH64_INSN_FUNCS(store_ex, 0x3FC00000, 0x08000000)
__AARCH64_INSN_FUNCS(mops, 0x3B200C00, 0x19000400)
__AARCH64_INSN_FUNCS(stp, 0x7FC00000, 0x29000000)
__AARCH64_INSN_FUNCS(ldp, 0x7FC00000, 0x29400000)
Expand Down Expand Up @@ -602,6 +606,10 @@ u32 aarch64_insn_gen_load_store_pair(enum aarch64_insn_register reg1,
int offset,
enum aarch64_insn_variant variant,
enum aarch64_insn_ldst_type type);
u32 aarch64_insn_gen_load_acq_store_rel(enum aarch64_insn_register reg,
enum aarch64_insn_register base,
enum aarch64_insn_size_type size,
enum aarch64_insn_ldst_type type);
u32 aarch64_insn_gen_load_store_ex(enum aarch64_insn_register reg,
enum aarch64_insn_register base,
enum aarch64_insn_register state,
Expand Down
29 changes: 29 additions & 0 deletions arch/arm64/lib/insn.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,35 @@ u32 aarch64_insn_gen_load_store_pair(enum aarch64_insn_register reg1,
offset >> shift);
}

u32 aarch64_insn_gen_load_acq_store_rel(enum aarch64_insn_register reg,
enum aarch64_insn_register base,
enum aarch64_insn_size_type size,
enum aarch64_insn_ldst_type type)
{
u32 insn;

switch (type) {
case AARCH64_INSN_LDST_LOAD_ACQ:
insn = aarch64_insn_get_load_acq_value();
break;
case AARCH64_INSN_LDST_STORE_REL:
insn = aarch64_insn_get_store_rel_value();
break;
default:
pr_err("%s: unknown load-acquire/store-release encoding %d\n",
__func__, type);
return AARCH64_BREAK_FAULT;
}

insn = aarch64_insn_encode_ldst_size(size, insn);

insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RT, insn,
reg);

return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn,
base);
}

u32 aarch64_insn_gen_load_store_ex(enum aarch64_insn_register reg,
enum aarch64_insn_register base,
enum aarch64_insn_register state,
Expand Down
20 changes: 20 additions & 0 deletions arch/arm64/net/bpf_jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@
aarch64_insn_gen_load_store_ex(Rt, Rn, Rs, A64_SIZE(sf), \
AARCH64_INSN_LDST_STORE_REL_EX)

/* Load-acquire & store-release */
#define A64_LDAR(Rt, Rn, size) \
aarch64_insn_gen_load_acq_store_rel(Rt, Rn, AARCH64_INSN_SIZE_##size, \
AARCH64_INSN_LDST_LOAD_ACQ)
#define A64_STLR(Rt, Rn, size) \
aarch64_insn_gen_load_acq_store_rel(Rt, Rn, AARCH64_INSN_SIZE_##size, \
AARCH64_INSN_LDST_STORE_REL)

/* Rt = [Rn] (load acquire) */
#define A64_LDARB(Wt, Xn) A64_LDAR(Wt, Xn, 8)
#define A64_LDARH(Wt, Xn) A64_LDAR(Wt, Xn, 16)
#define A64_LDAR32(Wt, Xn) A64_LDAR(Wt, Xn, 32)
#define A64_LDAR64(Xt, Xn) A64_LDAR(Xt, Xn, 64)

/* [Rn] = Rt (store release) */
#define A64_STLRB(Wt, Xn) A64_STLR(Wt, Xn, 8)
#define A64_STLRH(Wt, Xn) A64_STLR(Wt, Xn, 16)
#define A64_STLR32(Wt, Xn) A64_STLR(Wt, Xn, 32)
#define A64_STLR64(Xt, Xn) A64_STLR(Xt, Xn, 64)

/*
* LSE atomics
*
Expand Down
86 changes: 84 additions & 2 deletions arch/arm64/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,81 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)
return 0;
}

static int emit_atomic_ld_st(const struct bpf_insn *insn, struct jit_ctx *ctx)
{
const s32 imm = insn->imm;
const s16 off = insn->off;
const u8 code = insn->code;
const bool arena = BPF_MODE(code) == BPF_PROBE_ATOMIC;
const u8 arena_vm_base = bpf2a64[ARENA_VM_START];
const u8 dst = bpf2a64[insn->dst_reg];
const u8 src = bpf2a64[insn->src_reg];
const u8 tmp = bpf2a64[TMP_REG_1];
u8 reg;

switch (imm) {
case BPF_LOAD_ACQ:
reg = src;
break;
case BPF_STORE_REL:
reg = dst;
break;
default:
pr_err_once("unknown atomic load/store op code %02x\n", imm);
return -EINVAL;
}

if (off) {
emit_a64_add_i(1, tmp, reg, tmp, off, ctx);
reg = tmp;
}
if (arena) {
emit(A64_ADD(1, tmp, reg, arena_vm_base), ctx);
reg = tmp;
}

switch (imm) {
case BPF_LOAD_ACQ:
switch (BPF_SIZE(code)) {
case BPF_B:
emit(A64_LDARB(dst, reg), ctx);
break;
case BPF_H:
emit(A64_LDARH(dst, reg), ctx);
break;
case BPF_W:
emit(A64_LDAR32(dst, reg), ctx);
break;
case BPF_DW:
emit(A64_LDAR64(dst, reg), ctx);
break;
}
break;
case BPF_STORE_REL:
switch (BPF_SIZE(code)) {
case BPF_B:
emit(A64_STLRB(src, reg), ctx);
break;
case BPF_H:
emit(A64_STLRH(src, reg), ctx);
break;
case BPF_W:
emit(A64_STLR32(src, reg), ctx);
break;
case BPF_DW:
emit(A64_STLR64(src, reg), ctx);
break;
}
break;
default:
pr_err_once("unexpected atomic load/store op code %02x\n",
imm);
return -EINVAL;
}

return 0;
}

#ifdef CONFIG_ARM64_LSE_ATOMICS
static int emit_lse_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
{
Expand Down Expand Up @@ -1641,11 +1716,17 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
return ret;
break;

case BPF_STX | BPF_ATOMIC | BPF_B:
case BPF_STX | BPF_ATOMIC | BPF_H:
case BPF_STX | BPF_ATOMIC | BPF_W:
case BPF_STX | BPF_ATOMIC | BPF_DW:
case BPF_STX | BPF_PROBE_ATOMIC | BPF_B:
case BPF_STX | BPF_PROBE_ATOMIC | BPF_H:
case BPF_STX | BPF_PROBE_ATOMIC | BPF_W:
case BPF_STX | BPF_PROBE_ATOMIC | BPF_DW:
if (cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
if (bpf_atomic_is_load_store(insn))
ret = emit_atomic_ld_st(insn, ctx);
else if (cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
ret = emit_lse_atomic(insn, ctx);
else
ret = emit_ll_sc_atomic(insn, ctx);
Expand Down Expand Up @@ -2669,7 +2750,8 @@ bool bpf_jit_supports_insn(struct bpf_insn *insn, bool in_arena)
switch (insn->code) {
case BPF_STX | BPF_ATOMIC | BPF_W:
case BPF_STX | BPF_ATOMIC | BPF_DW:
if (!cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
if (!bpf_atomic_is_load_store(insn) &&
!cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
return false;
}
return true;
Expand Down
14 changes: 10 additions & 4 deletions arch/s390/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2919,10 +2919,16 @@ bool bpf_jit_supports_arena(void)

bool bpf_jit_supports_insn(struct bpf_insn *insn, bool in_arena)
{
/*
* Currently the verifier uses this function only to check which
* atomic stores to arena are supported, and they all are.
*/
if (!in_arena)
return true;
switch (insn->code) {
case BPF_STX | BPF_ATOMIC | BPF_B:
case BPF_STX | BPF_ATOMIC | BPF_H:
case BPF_STX | BPF_ATOMIC | BPF_W:
case BPF_STX | BPF_ATOMIC | BPF_DW:
if (bpf_atomic_is_load_store(insn))
return false;
}
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
ifeq ($(CONFIG_X86_32),y)
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp32.o
else
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o bpf_timed_may_goto.o
endif
Loading
Loading