On Fri, 21 Jan 2022 at 02:09, Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > How would bpf prog know the pid of the python interpreter? > Then how would it know the pids of the threads? > I'm not against exposing find_get_task_by_vpid(), but > we need to understand the real usage first. > If we do end up exposing find_get_task_by_vpid(), it's probably > best to do via refcnt-ed kfunc approach (unstable helpers). > For example: https://lore.kernel.org/all/20220114163953.1455836-7-memxor@xxxxxxxxx/ This is a simple but somewhat unrealistic example but hopefully it will give the idea. Suppose we are tracing sys_kill on entry and that we have an application that uses it to check if a process exists by sending the 0 signal to its PID. During the handling of this event, we might want to read a certain area of the VM (which we would have identified a priori from user-space) of the process identified by the PID passed to the syscall.