We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5128164 commit 87091ddCopy full SHA for 87091dd
tools/testing/selftests/bpf/progs/verifier_spin_lock.c
@@ -530,4 +530,30 @@ l1_%=: exit; \
530
: __clobber_all);
531
}
532
533
+SEC("tc")
534
+__description("spin_lock: loop within a locked region")
535
+__success __failure_unpriv __msg_unpriv("")
536
+__retval(0)
537
+int bpf_loop_inside_locked_region(void)
538
+{
539
+ const int zero = 0;
540
+ struct val *val;
541
+ int i, j = 0;
542
+
543
+ val = bpf_map_lookup_elem(&map_spin_lock, &zero);
544
+ if (!val)
545
+ return -1;
546
547
+ bpf_spin_lock(&val->l);
548
+ bpf_for(i, 0, 10) {
549
+ j++;
550
+ /* Silence "unused variable" warnings. */
551
+ if (j == 10)
552
+ break;
553
+ }
554
+ bpf_spin_unlock(&val->l);
555
556
+ return 0;
557
+}
558
559
char _license[] SEC("license") = "GPL";
0 commit comments