Introduce arena library and runtime
Subsystems (3)
Emil Tsalapatis
reviewerv9 cover Introduce arena library and runtime
Add a new subdirectory to tools/testing/selftests/bpf called libarena, along with programs useful for writing arena-based BPF code. This patchset adds the following:
1) libarena, a subdirectory where arena BPF code that is generally useful to BPF arena programs can be easily added and tested.
2) An ASAN runtime for BPF arena programs. BPF arenas allow for accessing memory after it has been freed or if it is out of bounds, making it more difficult to triage bugs combined to regular BPF. Use LLVM's recently added support for address-space based sanitization to selectively sanitize just the arena accesses.
3) A buddy memory allocator that can be reused by BPF programs to handle memory allocation/deletion. The allocator uses the ASAN runtime to add address sanitization if requested.
The patch includes testing for the new allocators and ASAN features that can be built from the top directory using "make libarena_test" and "make libarena_test_asan". The generated binaries reside in libarena/. The patch also adds test-progs-based selftests to the codebase for the libarena code, so the new tests are run by ./test_progs.
The patchset has the following stucture:
1-3: Create basic libarena scaffolding and refactor existing headers.
4-5: Add the ASAN runtime and associated scaffolding.
6-8: Add the new buddy memory allocator along with selftests.
HISTORY
=======
v8->v9 (https://lore.kernel.org/bpf/[email protected])
- Added Matt's Acked-by for Patch 1
- Replaced open coded fls with __builtin based calculation (Matt)
- Add comment explaining the reasoning behind the zero variable (Matt)
- Remove the self-contained runner and present selftests as examples (Kumar). The reasoning is that including selftests with the library is not effective because the library will be sync'ed outside the tree infrequently, so it would be ineffective in catching issues before they land.
- Adjust syscall API for clarity and forward compatibility (Matt)
- Reset asan_validate state after failed check (Sashiko)
- Fix printf format specifier (Sashiko)
- Rename syscall to be generic arena_info (Matt)
- Namespace libarena headers by moving them to their own directory
- Rename selftest_helpers to libarena/userspace.h to reflect it is not just for selftests.
v7->v8 (https://lore.kernel.org/bpf/[email protected])
- Duplicate READ_ONCE/WRITE_ONCE instead of moving it to bpf_experimental.h to keep libarena self-contained (Kumar)
- Add libarena_asan test to test_progs and conditionally compile it if suppported (Kumar)
- Add stderr parsing for buddy tests when run under test_progs (Kumar)
- Move all arena-related headers into libarena and add its include/ subdirectory in the standard include path (Kumar)
- Remove silent-by-default ASAN, add help message on test_libarena explaining that -v emits the messages (Kumar)
- Add run_prog_args as a libarena helper
- Add explanation on the use of __weak for the spinlock qnodes
v6->v7 (https://lore.kernel.org/bpf/[email protected])
- Modify patch 1 to allow operations between PTR_TO_ARENA src_reg and dst_reg of any type. Adjust selftests accordingly (Alexei)
- Remove unnecessary include in patch 5 (Song)
- Removed unused definitions/assignments in patches 8/9, update patch descriptions
v5->v6 (https://lore.kernel.org/bpf/[email protected])
- Fix subreg_def management for SCALAR += PTR_TO_ARENA operations (AI)
- Add more selftests for the SCALAR += PTR_TO_ARENA patch (Sashiko)
- Adjust fls() operation to be in line with the kernel version (Sashiko)
- Address Sashiko selftests and debugging nits
- Add ASAN loadN and storeN _noabort variants and associated BTF anchor
- Remove unnecessary bit freeing of buddies during block splitting
v4->v5 (https://lore.kernel.org/bpf/[email protected])
Omitting various nits and fixups.
- Properly adjust subreg_def for scalar += ptr_to_arena calls (Sashiko)
- Remove extraneous definition from prog_tests/arena_spin_lock.c (Song)
- Trim extraneous comments from ASAN and buddy (Alexei)
- Remove asan_dummy call and replace with function pointer array (Alexei)
- Remove usersapi.h header and merge it into common.h (Alexei)
- Replace ASAN macros with function calls (Alexei)
- Embed buddy lock into the struct and move the buddy allocator to __arena_global (Alexei)
- Add commenting for buddy allocator constants (Alexei)
- Add default buddy allocator directly in common.bpf.c, so that the user does not need to define it.
- Expand test harnesses to dynamically find individual selftests. Now the selftests also reports each test individually (e.g., 5 entries for the buddy allocator instead of 1). This brings them to par with the rest of the test_progs.
v3->v4 (https://lore.kernel.org/bpf/[email protected])
- Add Acks by Song to patches 1-4.
- Expand the verifier's handling of scalar/arena operations to include all 3-operand operations in Patch 1 (Alexei)
- Add additional tests for arena/arena (allowed) and arena/pointer (not allowed) operations in Patch 2
- Remove ASAN version of the library from default compilation since it requires LLVM 22 and up (CI)
- Rework buddy allocator locking for clarity and add comments
- Fix From: email to be consistent with SOB
- Address (most) Sashiko comments
v2->v3 (https://lore.kernel.org/bpf/[email protected])
Nonexhaustive due to significant patch rework.
- Do not duplicate WRITE_ONCE macro (Mykyta, Kumar)
- Add SPDX headers (Alexei)
- Remove bump/stack allocators (Alexei)
- Integrate testing with test_progs (Kumar)
- Add short description of ASAN algorithm at the top of the file (Alexei)
v1->v2 (https://lore.kernel.org/bpf/[email protected]/)
- Added missing format string argument (AI)
- Fix outdated selftests prog name check (AI)
- Fixed stack allocation check for segment creation (AI)
- Fix errors in non-ASAN bump allocator selftests (AI)
- Propagate error value from individual selftests in selftest.c
- Removed embedded metadata from bump allocator as it was needlessly complicating its behavior
Emil Tsalapatis (8):
selftests/bpf: Add ifdef guard for WRITE_ONCE macro in bpf_atomic.h selftests/bpf: Add basic libarena scaffolding selftests/bpf: Move arena-related headers into libarena selftests/bpf: Add arena ASAN runtime to libarena selftests/bpf: Add ASAN support for libarena selftests selftests/bpf: Add buddy allocator for libarena selftests/bpf: Add selftests for libarena buddy allocator selftests/bpf: Reuse stderr parsing for libarena ASAN tests
tools/testing/selftests/bpf/Makefile | 53 +-
tools/testing/selftests/bpf/bpf_arena_alloc.h | 2 +-
tools/testing/selftests/bpf/bpf_arena_list.h | 2 +-
.../selftests/bpf/bpf_arena_strsearch.h | 2 +-
.../testing/selftests/bpf/bpf_experimental.h | 84 +-
tools/testing/selftests/bpf/default.profraw | Bin 0 -> 160 bytes
tools/testing/selftests/bpf/libarena/Makefile | 94 ++
.../{ => libarena/include}/bpf_arena_common.h | 0
.../include}/bpf_arena_spin_lock.h | 11 +-
.../bpf/{ => libarena/include}/bpf_atomic.h | 4 +-
.../bpf/libarena/include/bpf_may_goto.h | 84 ++
.../bpf/libarena/include/libarena/asan.h | 103 ++
.../bpf/libarena/include/libarena/buddy.h | 92 ++
.../bpf/libarena/include/libarena/common.h | 94 ++
.../bpf/libarena/include/libarena/userspace.h | 132 +++
.../libarena/selftests/st_asan_buddy.bpf.c | 258 +++++
.../bpf/libarena/selftests/st_asan_common.h | 52 +
.../bpf/libarena/selftests/st_buddy.bpf.c | 209 ++++
.../libarena/selftests/test_progs_compat.h | 15 +
.../selftests/bpf/libarena/src/asan.bpf.c | 553 +++++++++++
.../selftests/bpf/libarena/src/buddy.bpf.c | 903 ++++++++++++++++++
.../selftests/bpf/libarena/src/common.bpf.c | 52 +
.../bpf/prog_tests/arena_spin_lock.c | 7 -
.../selftests/bpf/prog_tests/libarena.c | 66 ++
.../selftests/bpf/prog_tests/libarena_asan.c | 93 ++
.../selftests/bpf/progs/arena_atomics.c | 2 +-
.../selftests/bpf/progs/arena_spin_lock.c | 2 +-
.../bpf/progs/compute_live_registers.c | 2 +-
.../selftests/bpf/progs/lpm_trie_bench.c | 2 +-
tools/testing/selftests/bpf/progs/stream.c | 2 +-
.../selftests/bpf/progs/verifier_arena.c | 2 +-
.../bpf/progs/verifier_arena_globals1.c | 2 +-
.../bpf/progs/verifier_arena_globals2.c | 2 +-
.../bpf/progs/verifier_arena_large.c | 2 +-
.../selftests/bpf/progs/verifier_ldsx.c | 2 +-
tools/testing/selftests/bpf/test_loader.c | 51 +-
tools/testing/selftests/bpf/test_progs.h | 2 +
37 files changed, 2917 insertions(+), 121 deletions(-)
create mode 100644 tools/testing/selftests/bpf/default.profraw
create mode 100644 tools/testing/selftests/bpf/libarena/Makefile
rename tools/testing/selftests/bpf/{ => libarena/include}/bpf_arena_common.h (100%)
rename tools/testing/selftests/bpf/{progs => libarena/include}/bpf_arena_spin_lock.h (98%)
rename tools/testing/selftests/bpf/{ => libarena/include}/bpf_atomic.h (98%)
create mode 100644 tools/testing/selftests/bpf/libarena/include/bpf_may_goto.h
create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/asan.h
create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/buddy.h
create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/common.h
create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/userspace.h
create mode 100644 tools/testing/selftests/bpf/libarena/selftests/st_asan_buddy.bpf.c
create mode 100644 tools/testing/selftests/bpf/libarena/selftests/st_asan_common.h
create mode 100644 tools/testing/selftests/bpf/libarena/selftests/st_buddy.bpf.c
create mode 100644 tools/testing/selftests/bpf/libarena/selftests/test_progs_compat.h
create mode 100644 tools/testing/selftests/bpf/libarena/src/asan.bpf.c
create mode 100644 tools/testing/selftests/bpf/libarena/src/buddy.bpf.c
create mode 100644 tools/testing/selftests/bpf/libarena/src/common.bpf.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/libarena.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/libarena_asan.cSignature · 1 line
2.53.0
Emil Tsalapatis
reviewerPATCH v9 1/8 selftests/bpf: Add ifdef guard for WRITE_ONCE macro in bpf_atomic.h
The WRITE_ONCE macro is identically defined both in bpf_atomic.h and in bpf_arena_common.h. However, the bpf_atomic.h definition has no ifdef guard. If bpf_atomic.h is included after bpf_arena.common.h, compilation fails because of the duplicate definition.
Guard the definiton in bpf_atomic.h with and ifdef to let programs include the two headers in any order. Duplicating the definition is the simplest solution out of all the alternatives:
- Keeping one of the two existing definitions is not possible because both BPF atomics and arena programs need the macro, and the two features are independent. Using one should not require the header for the other.
- Factoring out the definition into a new header that only includes it is more churn than just duplicating it.
- Factoring out the definition into bpf_experimental.h requires all users of WRITE_ONCE to include the header. However, the arena library introduced in subsequent commits must be self-contained, while bpf_experimental.h is in the base selftests/bpf directory.
Both headers are moved to the arena library in a subsequent patch.
--- tools/testing/selftests/bpf/bpf_atomic.h | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/bpf_atomic.h +2 -0
@@ -42,7 +42,9 @@ extern bool CONFIG_X86_64 __kconfig __weak;#define READ_ONCE (x) (*(volatile typeof(x) *)&(x)) +#ifndef WRITE_ONCE #define WRITE_ONCE (x, val) ((*(volatile typeof(x) *)&(x)) = (val)) +#endif #define cmpxchg (p, old, new) __sync_val_compare_and_swap((p), old, new)
Signature · 1 line
2.53.0
Emil Tsalapatis
reviewerPATCH v9 2/8 selftests/bpf: Add basic libarena scaffolding
In reply to Emil TsalapatisAdd initial code and a Makefile for an arena-based BPF library. Modules can be added just by including the source file in the library's src/ subdirectory. Future commits will introduce the library code itself.
The code includes workarounds that are removed in subsequent patches that ensure bisectability.
--- tools/testing/selftests/bpf/Makefile | 27 +++++ tools/testing/selftests/bpf/libarena/Makefile | 69 +++++++++++++ .../bpf/libarena/include/libarena/common.h | 79 +++++++++++++++ .../bpf/libarena/include/libarena/userspace.h | 99 +++++++++++++++++++ .../selftests/bpf/libarena/src/common.bpf.c | 29 ++++++ 5 files changed, 303 insertions(+) create mode 100644 tools/testing/selftests/bpf/libarena/Makefile create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/common.h create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/userspace.h create mode 100644 tools/testing/selftests/bpf/libarena/src/common.bpf.c
tools/testing/selftests/bpf/Makefile +27 -0
@@ -153,6 +153,7 @@ override define CLEAN $(Q)$(RM) -r $(TEST_KMODS) $(Q)$(RM) -r $(EXTRA_CLEAN) $(Q)$(MAKE) -C test_kmods clean + $(Q)$(MAKE) -C libarena clean $(Q)$(MAKE) docs-clean endef
@@ -525,6 +526,7 @@ LINKED_BPF_OBJS := $(foreach skel,$(LINKED_SKELS),$($(skel)-deps)) LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.c,$(LINKED_BPF_OBJS)) HEADERS_FOR_BPF_OBJS := $(wildcard $(BPFDIR)/*.bpf.h) \ + $(wildcard $(CURDIR)/libarena/include/*.[ch]) \ $(addprefix $(BPFDIR)/, bpf_core_read.h \ bpf_endian.h \ bpf_helpers.h \
@@ -740,6 +742,29 @@ $(VERIFY_SIG_HDR): $(VERIFICATION_CERT) echo "};"; \ echo "unsigned int test_progs_verification_cert_len = $$(wc -c < $<);") > $@ +LIBARENA_MAKE_ARGS = \ + BPFTOOL="$(BPFTOOL)" \ + INCLUDE_DIR="$(INCLUDE_DIR)" \ + LIBBPF_INCLUDE="$(HOST_INCLUDE_DIR)" \ + BPFOBJ="$(BPFOBJ)" \ + LDLIBS="$(LDLIBS) -lzstd" \ + CLANG="$(CLANG)" \ + BPF_CFLAGS="$(BPF_CFLAGS) $(CLANG_CFLAGS)" \ + BPF_TARGET_ENDIAN="$(BPF_TARGET_ENDIAN)" \ + Q="$(Q)" + +LIBARENA_BPF_DEPS := $(wildcard libarena/Makefile \ + libarena/include/* \ + libarena/include/libarena/* \ + libarena/src/* \ + libarena/selftests/* \ + libarena/*.bpf.o) + +LIBARENA_SKEL := libarena/libarena.skel.h + +$(LIBARENA_SKEL): $(INCLUDE_DIR)/vmlinux.h $(BPFOBJ) $(LIBARENA_BPF_DEPS) + +$(MAKE) -C libarena libarena.skel.h $(LIBARENA_MAKE_ARGS) + # Define test_progs test runner. TRUNNER_TESTS_DIR := prog_tests TRUNNER_BPF_PROGS_DIR := progs
@@ -933,3 +958,5 @@ override define INSTALL_RULE rsync -a $(OUTPUT)/$$DIR/*.bpf.o $(INSTALL_PATH)/$$DIR;\ done endef + +libarena: $(LIBARENA_SKEL)
tools/testing/selftests/bpf/libarena/Makefile new file +69 -0
69 lines not on this page · raw message
tools/testing/selftests/bpf/libarena/include/libarena/common.h new file +79 -0
79 lines not on this page · raw message
tools/testing/selftests/bpf/libarena/include/libarena/userspace.h new file +99 -0
99 lines not on this page · raw message
tools/testing/selftests/bpf/libarena/src/common.bpf.c new file +29 -0
@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause +/* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */ +#include <libarena/common.h> + +const volatile u32 zero =0 ; + +int arena_fls (__u64 word) +{ +if (!word) +return 0 ; + +return 64 -__builtin_clzll (word); +} + +SEC("syscall") +__weak int arena_get_info (struct arena_get_info_args *args) +{ + args->arena_base =arena_base (&arena); + +return 0 ; +} + +SEC("syscall") +__weak int arena_alloc_reserve (struct arena_alloc_reserve_args *args) +{ +return bpf_arena_reserve_pages (&arena,NULL , args->nr_pages); +} + +char _license[] SEC("license") = "GPL";
Signature · 1 line
2.53.0
Emil Tsalapatis
reviewerPATCH v9 3/8 selftests/bpf: Move arena-related headers into libarena
In reply to Emil TsalapatisThe BPF selftest headers include functionality that is specific to arenas and is required by libarena. Keep libarena self-contained by moving all functionality into its include/ directory. Also add libarena/include to the standard include paths for the selftests to make the moved headers easy to access by existing selftests.
Some functionality is required by libarena but not strictly arena-related. We still move it to the libarena/include path, which is an upgrade from directly accessing them from the selftests/bpf directory using relative paths.
A new bpf_may_goto.h file is split off of bpf_experimental.h. bpf_arena_spin_lock.h and bpf_arena_common.h are moved to libarena/include. bpf_atomic.h is also moved to libarena because it is necessary for arena spinlocks.
For bpf_arena_spin_lock.h, mark the spinlock state array as __weak to define the spinlock state array in the header while also being compatible with multi-compilation unit programs. While we're at it, we remove unnecessary definitions from existing test programs.
---
tools/testing/selftests/bpf/Makefile | 4 +-
tools/testing/selftests/bpf/bpf_arena_alloc.h | 2 +-
tools/testing/selftests/bpf/bpf_arena_list.h | 2 +-
.../selftests/bpf/bpf_arena_strsearch.h | 2 +-
.../testing/selftests/bpf/bpf_experimental.h | 84 +------------------
.../{ => libarena/include}/bpf_arena_common.h | 0
.../include}/bpf_arena_spin_lock.h | 11 ++-
.../bpf/{ => libarena/include}/bpf_atomic.h | 2 +-
.../bpf/libarena/include/bpf_may_goto.h | 84 +++++++++++++++++++
.../bpf/libarena/include/libarena/common.h | 4 +-
.../bpf/prog_tests/arena_spin_lock.c | 7 --
.../selftests/bpf/progs/arena_atomics.c | 2 +-
.../selftests/bpf/progs/arena_spin_lock.c | 2 +-
.../bpf/progs/compute_live_registers.c | 2 +-
.../selftests/bpf/progs/lpm_trie_bench.c | 2 +-
tools/testing/selftests/bpf/progs/stream.c | 2 +-
.../selftests/bpf/progs/verifier_arena.c | 2 +-
.../bpf/progs/verifier_arena_globals1.c | 2 +-
.../bpf/progs/verifier_arena_globals2.c | 2 +-
.../bpf/progs/verifier_arena_large.c | 2 +-
.../selftests/bpf/progs/verifier_ldsx.c | 2 +-
21 files changed, 112 insertions(+), 110 deletions(-)
rename tools/testing/selftests/bpf/{ => libarena/include}/bpf_arena_common.h (100%)
rename tools/testing/selftests/bpf/{progs => libarena/include}/bpf_arena_spin_lock.h (98%)
rename tools/testing/selftests/bpf/{ => libarena/include}/bpf_atomic.h (99%)
create mode 100644 tools/testing/selftests/bpf/libarena/include/bpf_may_goto.htools/testing/selftests/bpf/Makefile +3 -1
@@ -56,7 +56,8 @@ CFLAGS += -g $(OPT_FLAGS) -rdynamic -std=gnu11 \ -Wno-unused-but-set-variable \ $(GENFLAGS) $(SAN_CFLAGS) $(LIBELF_CFLAGS) \ -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ - -I$(TOOLSINCDIR) -I$(TOOLSARCHINCDIR) -I$(APIDIR) -I$(OUTPUT) + -I$(TOOLSINCDIR) -I$(TOOLSARCHINCDIR) -I$(APIDIR) -I$(OUTPUT) \ + -I$(CURDIR)/libarena/include LDFLAGS += $(SAN_LDFLAGS) LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread
@@ -447,6 +448,7 @@ endif CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) BPF_CFLAGS = -g -Wall -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \ -I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \ + -I$(CURDIR)/libarena/include \ -I$(abspath $(OUTPUT)/../usr/include) \ -std=gnu11 \ -fno-strict-aliasing \
tools/testing/selftests/bpf/bpf_arena_alloc.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #pragma once -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> #ifndef __round_mask#define __round_mask (x, y) ((__typeof__(x))((y)-1))
tools/testing/selftests/bpf/bpf_arena_list.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #pragma once -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> struct arena_list_node ;
tools/testing/selftests/bpf/bpf_arena_strsearch.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ #pragma once -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> __noinline int bpf_arena_strlen(const char __arena *s __arg_arena) {
tools/testing/selftests/bpf/bpf_experimental.h +1 -83
96 lines not on this page · raw message
tools/testing/selftests/bpf/libarena/include/bpf_arena_common.h renamed from tools/testing/selftests/bpf/bpf_arena_common.h +0 -0
tools/testing/selftests/bpf/libarena/include/bpf_arena_spin_lock.h renamed from tools/testing/selftests/bpf/progs/bpf_arena_spin_lock.h +8 -3
@@ -5,7 +5,7 @@#include <vmlinux.h> #include <bpf/bpf_helpers.h> -#include "bpf_atomic.h" +#include <bpf_atomic.h> #define arch_mcs_spin_lock_contended_label (l, label) smp_cond_load_acquire_label(l, VAL, label)#define arch_mcs_spin_unlock_contended (l) smp_store_release((l), 1)
@@ -107,7 +107,12 @@ struct arena_qnode {#define _Q_LOCKED_VAL (1U << _Q_LOCKED_OFFSET)#define _Q_PENDING_VAL (1U << _Q_PENDING_OFFSET) -struct arena_qnode __arena qnodes[_Q_MAX_CPUS][_Q_MAX_NODES]; +/* +* The qnodes are marked __weak so we can define them in the header +* while still ensuring all compilation units use the same struct +* instance. +*/ +struct arena_qnode __weak __arena __hidden qnodes[_Q_MAX_CPUS][_Q_MAX_NODES];static inline u32 encode_tail (int cpu,int idx) {
@@ -240,7 +245,7 @@ static __always_inline int arena_spin_trylock(arena_spinlock_t __arena *lock)return likely (atomic_try_cmpxchg_acquire (&lock->val, &val, _Q_LOCKED_VAL)); } -__noinline +__noinline __weak int arena_spin_lock_slowpath(arena_spinlock_t __arena __arg_arena *lock, u32 val) { struct arena_mcs_spinlock __arena *prev, *next, *node0, *node;
tools/testing/selftests/bpf/libarena/include/bpf_atomic.h renamed from tools/testing/selftests/bpf/bpf_atomic.h +1 -1
@@ -5,7 +5,7 @@#include <vmlinux.h> #include <bpf/bpf_helpers.h> -#include "bpf_experimental.h" +#include <bpf_may_goto.h> extern bool CONFIG_X86_64 __kconfig __weak;
tools/testing/selftests/bpf/libarena/include/bpf_may_goto.h new file +84 -0
84 lines not on this page · raw message
tools/testing/selftests/bpf/libarena/include/libarena/common.h +2 -2
@@ -6,8 +6,8 @@#include <vmlinux.h> -#include "../../bpf_arena_common.h" -#include "../../progs/bpf_arena_spin_lock.h" +#include <bpf_arena_common.h> +#include <bpf_arena_spin_lock.h> #include <asm-generic/errno.h>
tools/testing/selftests/bpf/prog_tests/arena_spin_lock.c +0 -7
@@ -5,13 +5,6 @@#include <sys/sysinfo.h> struct __qspinlock {int val; }; -typedef struct __qspinlock arena_spinlock_t ; - -struct arena_qnode { -unsigned long next; -int count; -int locked; -};#include "arena_spin_lock.skel.h"
tools/testing/selftests/bpf/progs/arena_atomics.c +1 -1
@@ -5,7 +5,7 @@#include <bpf/bpf_tracing.h> #include <stdbool.h> #include <stdatomic.h> -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h"
tools/testing/selftests/bpf/progs/arena_spin_lock.c +1 -1
@@ -4,7 +4,7 @@#include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" -#include "bpf_arena_spin_lock.h" +#include <bpf_arena_spin_lock.h> struct { __uint(type, BPF_MAP_TYPE_ARENA);
tools/testing/selftests/bpf/progs/compute_live_registers.c +1 -1
@@ -3,7 +3,7 @@#include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> #include "bpf_misc.h" struct {
tools/testing/selftests/bpf/progs/lpm_trie_bench.c +1 -1
@@ -7,7 +7,7 @@#include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" -#include "bpf_atomic.h" +#include <bpf_atomic.h> #include "progs/lpm_trie.h" #define BPF_OBJ_NAME_LEN 16U
tools/testing/selftests/bpf/progs/stream.c +1 -1
@@ -5,7 +5,7 @@#include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_experimental.h" -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> struct arr_elem {struct bpf_res_spin_lock lock;
tools/testing/selftests/bpf/progs/verifier_arena.c +1 -1
@@ -8,7 +8,7 @@#include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> #define private (name) SEC(".bss." #name) __hidden __attribute__((aligned(8)))
tools/testing/selftests/bpf/progs/verifier_arena_globals1.c +1 -1
@@ -6,7 +6,7 @@#include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_experimental.h" -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> #include "bpf_misc.h" #define ARENA_PAGES (1UL<< (32 - __builtin_ffs(__PAGE_SIZE) + 1))
tools/testing/selftests/bpf/progs/verifier_arena_globals2.c +1 -1
@@ -7,7 +7,7 @@#include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> #define ARENA_PAGES (32)
tools/testing/selftests/bpf/progs/verifier_arena_large.c +1 -1
@@ -7,7 +7,7 @@#include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> #define ARENA_SIZE (1ull << 32)
tools/testing/selftests/bpf/progs/verifier_ldsx.c +1 -1
@@ -3,7 +3,7 @@#include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" -#include "bpf_arena_common.h" +#include <bpf_arena_common.h> #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \
Signature · 1 line
2.53.0
Emil Tsalapatis
reviewerI typo'ed Matt's email in the CC list, resent after fixing - please disregard this one.