History log of /linux-master/tools/testing/selftests/bpf/progs/test_global_data.c
Revision Date Author Comments
# c22bdd28 28-Sep-2021 Andrii Nakryiko <andrii@kernel.org>

selftests/bpf: Switch SEC("classifier*") usage to a strict SEC("tc")

Convert all SEC("classifier*") uses to a new and strict SEC("tc")
section name. In reference_tracking selftests switch from ambiguous
searching by program title (section name) to non-ambiguous searching by
name in some selftests, getting closer to completely removing
bpf_object__find_program_by_title().

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210928161946.2512801-4-andrii@kernel.org


# e5fb60ee 29-Mar-2020 Toke Høiland-Jørgensen <toke@redhat.com>

selftests: Add test for overriding global data value before load

This adds a test to exercise the new bpf_map__set_initial_value() function.
The test simply overrides the global data section with all zeroes, and
checks that the new value makes it into the kernel map on load.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200329132253.232541-2-toke@redhat.com


# 3e689141 20-Jan-2020 Toke Høiland-Jørgensen <toke@redhat.com>

selftests: Use consistent include paths for libbpf

Fix all selftests to include libbpf header files with the bpf/ prefix, to
be consistent with external users of the library. Also ensure that all
includes of exported libbpf header files (those that are exported on 'make
install' of the library) use bracketed includes instead of quoted.

To not break the build, keep the old include path until everything has been
changed to the new one; a subsequent patch will remove that.

Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/157952560568.1683545.9649335788846513446.stgit@toke.dk


# bc7430cc 05-Jul-2019 Andrii Nakryiko <andriin@fb.com>

selftests/bpf: convert selftests using BTF-defined maps to new syntax

Convert all the existing selftests that are already using BTF-defined
maps to use new syntax (with no static data initialization).

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>


# df0b7792 17-Jun-2019 Andrii Nakryiko <andriin@fb.com>

selftests/bpf: convert tests w/ custom values to BTF-defined maps

Convert a bulk of selftests that have maps with custom (not integer) key
and/or value.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>


# b915ebe6 09-Apr-2019 Joe Stringer <joe@wand.net.nz>

bpf, selftest: test global data/bss/rodata sections

Add tests for libbpf relocation of static variable references
into the .data, .rodata and .bss sections of the ELF, also add
read-only test for .rodata. All passing:

# ./test_progs
[...]
test_global_data:PASS:load program 0 nsec
test_global_data:PASS:pass global data run 925 nsec
test_global_data_number:PASS:relocate .bss reference 925 nsec
test_global_data_number:PASS:relocate .data reference 925 nsec
test_global_data_number:PASS:relocate .rodata reference 925 nsec
test_global_data_number:PASS:relocate .bss reference 925 nsec
test_global_data_number:PASS:relocate .data reference 925 nsec
test_global_data_number:PASS:relocate .rodata reference 925 nsec
test_global_data_number:PASS:relocate .bss reference 925 nsec
test_global_data_number:PASS:relocate .bss reference 925 nsec
test_global_data_number:PASS:relocate .rodata reference 925 nsec
test_global_data_number:PASS:relocate .rodata reference 925 nsec
test_global_data_number:PASS:relocate .rodata reference 925 nsec
test_global_data_string:PASS:relocate .rodata reference 925 nsec
test_global_data_string:PASS:relocate .data reference 925 nsec
test_global_data_string:PASS:relocate .bss reference 925 nsec
test_global_data_string:PASS:relocate .data reference 925 nsec
test_global_data_string:PASS:relocate .bss reference 925 nsec
test_global_data_struct:PASS:relocate .rodata reference 925 nsec
test_global_data_struct:PASS:relocate .bss reference 925 nsec
test_global_data_struct:PASS:relocate .rodata reference 925 nsec
test_global_data_struct:PASS:relocate .data reference 925 nsec
test_global_data_rdonly:PASS:test .rodata read-only map 925 nsec
[...]
Summary: 229 PASSED, 0 FAILED

Note map helper signatures have been changed to avoid warnings
when passing in const data.

Joint work with Daniel Borkmann.

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>