]> www.infradead.org Git - users/hch/dma-mapping.git/commit
bpf: fix unpopulated name_len field in perf_event link info
authorTyrone Wu <wudevelops@gmail.com>
Tue, 8 Oct 2024 16:43:11 +0000 (16:43 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 10 Oct 2024 01:17:16 +0000 (18:17 -0700)
commit4deecdd29cf29844c7bd164d72dc38d2e672f64e
tree7ce39a7641a75ded12da89b7d8275d3a0796c2f5
parent434247637c66e1be2bc71a9987d4c3f0d8672387
bpf: fix unpopulated name_len field in perf_event link info

Previously when retrieving `bpf_link_info.perf_event` for
kprobe/uprobe/tracepoint, the `name_len` field was not populated by the
kernel, leaving it to reflect the value initially set by the user. This
behavior was inconsistent with how other input/output string buffer
fields function (e.g. `raw_tracepoint.tp_name_len`).

This patch fills `name_len` with the actual size of the string name.

Fixes: 1b715e1b0ec5 ("bpf: Support ->fill_link_info for perf_event")
Signed-off-by: Tyrone Wu <wudevelops@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Yafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/r/20241008164312.46269-1-wudevelops@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/syscall.c