void test_core_retro(void)
 {
-       int err, zero = 0, res, duration = 0;
+       int err, zero = 0, res, duration = 0, my_pid = getpid();
        struct test_core_retro *skel;
 
        /* load program */
        if (CHECK(!skel, "skel_load", "skeleton open/load failed\n"))
                goto out_close;
 
+       err = bpf_map_update_elem(bpf_map__fd(skel->maps.exp_tgid_map), &zero, &my_pid, 0);
+       if (CHECK(err, "map_update", "failed to set expected PID: %d\n", errno))
+               goto out_close;
+
        /* attach probe */
        err = test_core_retro__attach(skel);
        if (CHECK(err, "attach_kprobe", "err %d\n", err))
        if (CHECK(err, "map_lookup", "failed to lookup result: %d\n", errno))
                goto out_close;
 
-       CHECK(res != getpid(), "pid_check", "got %d != exp %d\n", res, getpid());
+       CHECK(res != my_pid, "pid_check", "got %d != exp %d\n", res, my_pid);
 
 out_close:
        test_core_retro__destroy(skel);
 
        int tgid;
 } __attribute__((preserve_access_index));
 
+struct {
+       __uint(type, BPF_MAP_TYPE_ARRAY);
+       __uint(max_entries, 1);
+       __type(key, int);
+       __type(value, int);
+} exp_tgid_map SEC(".maps");
+
 struct {
        __uint(type, BPF_MAP_TYPE_ARRAY);
        __uint(max_entries, 1);
        struct task_struct *task = (void *)bpf_get_current_task();
        int tgid = BPF_CORE_READ(task, tgid);
        int zero = 0;
+       int real_tgid = bpf_get_current_pid_tgid() >> 32;
+       int *exp_tgid = bpf_map_lookup_elem(&exp_tgid_map, &zero);
+
+       /* only pass through sys_enters from test process */
+       if (!exp_tgid || *exp_tgid != real_tgid)
+               return 0;
 
        bpf_map_update_elem(&results, &zero, &tgid, 0);