On Mon, Feb 12, 2024 at 12:48 PM Matt Bobrowski <mattbobrowski@xxxxxxxxxx> wrote: > [...] > > Now having said this, I'm wondering whether anyone here has considered > possibly solving this iterator based problem a little more > generically? That is, by exposing a set of kfuncs that allow you to > iterate over a list_head, hlist_head, rbtree, etc, independent of an > underlying in-kernel type and similar to your *list_for_each*() based > helpers that you'd typically find for each of these in-kernel generic > data structures. If so, what were your findings when exploring this > problem space? Here are my 2 cents on this: BPF iterators are designed to be really safe. So it is necessary to handle locking/refcounting accurately in the helpers. AFAICT, it is hard to do something universal, like list_for_each(), and still be safe. If we can accept failures (user space core dump, etc.), we can use kcore based solutions, such as crash and drgn. Thanks, Song