File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
tools/testing/selftests/bpf/progs Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ int err, pid;
17
17
* TP_PROTO(struct task_struct *p, u64 clone_flags)
18
18
*/
19
19
20
+ struct task_struct * bpf_task_acquire (struct task_struct * p ) __ksym __weak ;
21
+ void invalid_kfunc (void ) __ksym __weak ;
22
+ void bpf_testmod_test_mod_kfunc (int i ) __ksym __weak ;
23
+
20
24
static bool is_test_kfunc_task (void )
21
25
{
22
26
int cur_pid = bpf_get_current_pid_tgid () >> 32 ;
@@ -26,7 +30,21 @@ static bool is_test_kfunc_task(void)
26
30
27
31
static int test_acquire_release (struct task_struct * task )
28
32
{
29
- struct task_struct * acquired ;
33
+ struct task_struct * acquired = NULL ;
34
+
35
+ if (!bpf_ksym_exists (bpf_task_acquire )) {
36
+ err = 3 ;
37
+ return 0 ;
38
+ }
39
+ if (!bpf_ksym_exists (bpf_testmod_test_mod_kfunc )) {
40
+ err = 4 ;
41
+ return 0 ;
42
+ }
43
+ if (bpf_ksym_exists (invalid_kfunc )) {
44
+ /* the verifier's dead code elimination should remove this */
45
+ err = 5 ;
46
+ asm volatile ("goto -1" ); /* for (;;); */
47
+ }
30
48
31
49
acquired = bpf_task_acquire (task );
32
50
bpf_task_release (acquired );
You can’t perform that action at this time.
0 commit comments