Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/bpf.h>
0003 #include <bpf/bpf_helpers.h>
0004 #include <bpf/bpf_tracing.h>
0005 #include <stdbool.h>
0006 
0007 #ifdef ENABLE_ATOMICS_TESTS
0008 bool skip_tests __attribute((__section__(".data"))) = false;
0009 #else
0010 bool skip_tests = true;
0011 #endif
0012 
0013 SEC("fentry/bpf_fentry_test1")
0014 int BPF_PROG(sub, int x)
0015 {
0016 #ifdef ENABLE_ATOMICS_TESTS
0017     int a = 0;
0018     int b = __sync_fetch_and_add(&a, 1);
0019     /* b is certainly 0 here. Can the verifier tell? */
0020     while (b)
0021         continue;
0022 #endif
0023     return 0;
0024 }