Lines Matching +full:local +full:- +full:pid
1 // SPDX-License-Identifier: GPL-2.0
13 int err, pid; variable
24 /* The two-param bpf_task_acquire doesn't exist */
36 return pid == cur_pid; in is_test_kfunc_task()
54 asm volatile ("goto -1"); /* for (;;); */ in test_acquire_release()
147 struct __tasks_kfunc_map_value *v, *local; in BPF_PROG() local
166 kptr = bpf_kptr_xchg(&v->task, NULL); in BPF_PROG()
172 local = bpf_obj_new(typeof(*local)); in BPF_PROG()
173 if (!local) { in BPF_PROG()
179 kptr = bpf_kptr_xchg(&local->task, kptr); in BPF_PROG()
182 bpf_obj_drop(local); in BPF_PROG()
187 kptr = bpf_kptr_xchg(&local->task, NULL); in BPF_PROG()
190 bpf_obj_drop(local); in BPF_PROG()
194 /* Stash a copy into local kptr and check if it is released recursively */ in BPF_PROG()
198 bpf_obj_drop(local); in BPF_PROG()
202 bpf_probe_read_kernel(&refcnt, sizeof(refcnt), &acquired->rcu_users); in BPF_PROG()
204 acquired = bpf_kptr_xchg(&local->task, acquired); in BPF_PROG()
207 bpf_obj_drop(local); in BPF_PROG()
213 bpf_obj_drop(local); in BPF_PROG()
215 bpf_probe_read_kernel(&refcnt_after_drop, sizeof(refcnt_after_drop), &kptr->rcu_users); in BPF_PROG()
250 kptr = v->task; in BPF_PROG()
287 acquired = bpf_task_from_pid(p->pid); in lookup_compare_pid()
293 if (acquired->pid != p->pid) in lookup_compare_pid()
318 static int is_pid_lookup_valid(s32 pid) in is_pid_lookup_valid() argument
322 acquired = bpf_task_from_pid(pid); in is_pid_lookup_valid()
337 bpf_strncmp(task->comm, 12, "foo"); in BPF_PROG()
338 bpf_strncmp(task->comm, 16, "foo"); in BPF_PROG()
339 bpf_strncmp(&task->comm[8], 4, "foo"); in BPF_PROG()
341 if (is_pid_lookup_valid(-1)) { in BPF_PROG()
359 /* task->group_leader is listed as a trusted, non-NULL field of task struct. */ in BPF_PROG()
360 acquired = bpf_task_acquire(task->group_leader); in BPF_PROG()
383 /* The current process should be the init process (pid 1) in the new pid namespace. */ in test_task_from_vpid_current()
396 v_task = bpf_task_from_vpid(-1); in test_task_from_vpid_invalid()
402 /* There should be only one process (current process) in the new pid namespace. */ in test_task_from_vpid_invalid()