bpf: Improve docstring for BPF_F_USER_BUILD_ID flag
authorDave Marchevsky <davemarchevsky@fb.com>
Mon, 8 Aug 2022 16:47:23 +0000 (09:47 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 8 Aug 2022 22:15:05 +0000 (15:15 -0700)
commitca34ce29fc4b0e929cc6aada40829d17ab50fee4
treea0889292b1eafd03077ffce348df2a212b25d2f1
parent9e32084ef1c33a87a736d6ce3fcb95b60dac9aa1
bpf: Improve docstring for BPF_F_USER_BUILD_ID flag

Most tools which use bpf_get_stack or bpf_get_stackid symbolicate the
stack - meaning the stack of addresses in the target process' address
space is transformed into meaningful symbol names. The
BPF_F_USER_BUILD_ID flag eases this process by finding the build_id of
the file-backed vma which the address falls in and translating the
address to an offset within the backing file.

To be more specific, the offset is a "file offset" from the beginning of
the backing file. The symbols in ET_DYN ELF objects have a st_value
which is also described as an "offset" - but an offset in the process
address space, relative to the base address of the object.

It's necessary to translate between the "file offset" and "virtual
address offset" during symbolication before they can be directly
compared. Failure to do so can lead to confusing bugs, so this patch
clarifies language in the documentation in an attempt to keep this from
happening.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220808164723.3107500-1-davemarchevsky@fb.com
include/uapi/linux/bpf.h
tools/include/uapi/linux/bpf.h