On 8/21/23 1:34 PM, Dave Marchevsky wrote: > This patch adds kfuncs bpf_iter_task_vma_{new,next,destroy} which allow > creation and manipulation of struct bpf_iter_task_vma in open-coded > iterator style. BPF programs can use these kfuncs directly or through > bpf_for_each macro for natural-looking iteration of all task vmas. > > The implementation borrows heavily from bpf_find_vma helper's locking - > differing only in that it holds the mmap_read lock for all iterations > while the helper only executes its provided callback on a maximum of 1 > vma. Aside from locking, struct vma_iterator and vma_next do all the > heavy lifting. > > The newly-added struct bpf_iter_task_vma has a name collision with a > selftest for the seq_file task_vma iter's bpf skel, so the selftests/bpf/progs > file is renamed in order to avoid the collision. > > Signed-off-by: Dave Marchevsky <davemarchevsky@xxxxxx> > Cc: Nathan Slingerland <slinger@xxxxxxxx> > --- > include/uapi/linux/bpf.h | 4 + > kernel/bpf/helpers.c | 3 + > kernel/bpf/task_iter.c | 79 +++++++++++++++++++ > tools/include/uapi/linux/bpf.h | 5 ++ I forgot to update the tools bpf.h to match new changes in this respin. will send v3 shortly doing so