On Thu, Jun 12, 2025 at 2:29 PM Andrii Nakryiko <[email protected]> wrote: > > On Wed, Jun 11, 2025 at 8:49 AM Tao Chen <[email protected]> wrote: > > > > The bpf_d_path() function may fail. If it does, > > clear the user buf, like bpf_probe_read etc. > > > > But that doesn't mean we *have to* do memset(0) for bpf_d_path(), > though. Especially given that path buffer can be pretty large (4KB). > > Is there an issue you are trying to address with this, or is it more > of a consistency clean up? Note, that more or less recently we made > this zero filling behavior an option with an extra flag > (BPF_F_PAD_ZEROS) for newer APIs. And if anything, bpf_d_path() is > more akin to variable-sized string probing APIs rather than > fixed-sized bpf_probe_read* family.
All old helpers had this BPF_F_PAD_ZEROS behavior (or rather should have had). So it makes sense to zero in this helper too for consistency. I don't share performance concerns. This is an error path.
