@@ -397,6 +397,31 @@ static void test_session_cookie_skel_api(void)
397
397
kprobe_multi_session_cookie__destroy (skel );
398
398
}
399
399
400
+ static void test_unique_match (void )
401
+ {
402
+ LIBBPF_OPTS (bpf_kprobe_multi_opts , opts );
403
+ struct kprobe_multi * skel = NULL ;
404
+ struct bpf_link * link = NULL ;
405
+
406
+ skel = kprobe_multi__open_and_load ();
407
+ if (!ASSERT_OK_PTR (skel , "kprobe_multi__open_and_load" ))
408
+ return ;
409
+
410
+ opts .unique_match = true;
411
+ skel -> bss -> pid = getpid ();
412
+ link = bpf_program__attach_kprobe_multi_opts (skel -> progs .test_kprobe_manual ,
413
+ "bpf_fentry_test*" , & opts );
414
+ if (!ASSERT_ERR_PTR (link , "bpf_program__attach_kprobe_multi_opts" ))
415
+ bpf_link__destroy (link );
416
+
417
+ link = bpf_program__attach_kprobe_multi_opts (skel -> progs .test_kprobe_manual ,
418
+ "bpf_fentry_test8*" , & opts );
419
+ if (ASSERT_OK_PTR (link , "bpf_program__attach_kprobe_multi_opts" ))
420
+ bpf_link__destroy (link );
421
+
422
+ kprobe_multi__destroy (skel );
423
+ }
424
+
400
425
static size_t symbol_hash (long key , void * ctx __maybe_unused )
401
426
{
402
427
return str_hash ((const char * ) key );
@@ -765,5 +790,7 @@ void test_kprobe_multi_test(void)
765
790
test_session_skel_api ();
766
791
if (test__start_subtest ("session_cookie" ))
767
792
test_session_cookie_skel_api ();
793
+ if (test__start_subtest ("unique_match" ))
794
+ test_unique_match ();
768
795
RUN_TESTS (kprobe_multi_verifier );
769
796
}
0 commit comments