]> Git Repo - linux.git/blob - tools/testing/selftests/bpf/progs/atomic_bounds.c
Linux 6.14-rc3
[linux.git] / tools / testing / selftests / bpf / progs / atomic_bounds.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bpf.h>
3 #include <bpf/bpf_helpers.h>
4 #include <bpf/bpf_tracing.h>
5 #include <stdbool.h>
6
7 #ifdef ENABLE_ATOMICS_TESTS
8 bool skip_tests __attribute((__section__(".data"))) = false;
9 #else
10 bool skip_tests = true;
11 #endif
12
13 SEC("fentry/bpf_fentry_test1")
14 int BPF_PROG(sub, int x)
15 {
16 #ifdef ENABLE_ATOMICS_TESTS
17         int a = 0;
18         int b = __sync_fetch_and_add(&a, 1);
19         /* b is certainly 0 here. Can the verifier tell? */
20         while (b)
21                 continue;
22 #endif
23         return 0;
24 }
This page took 0.030758 seconds and 4 git commands to generate.