third_party_libbpf/include/uapi/linux
Daniel Xu 1670e6100b bpf: Add bpf_task_pt_regs() helper
The motivation behind this helper is to access userspace pt_regs in a
kprobe handler.

uprobe's ctx is the userspace pt_regs. kprobe's ctx is the kernelspace
pt_regs. bpf_task_pt_regs() allows accessing userspace pt_regs in a
kprobe handler. The final case (kernelspace pt_regs in uprobe) is
pretty rare (usermode helper) so I think that can be solved later if
necessary.

More concretely, this helper is useful in doing BPF-based DWARF stack
unwinding. Currently the kernel can only do framepointer based stack
unwinds for userspace code. This is because the DWARF state machines are
too fragile to be computed in kernelspace [0]. The idea behind
DWARF-based stack unwinds w/ BPF is to copy a chunk of the userspace
stack (while in prog context) and send it up to userspace for unwinding
(probably with libunwind) [1]. This would effectively enable profiling
applications with -fomit-frame-pointer using kprobes and uprobes.

[0]: https://lkml.org/lkml/2012/2/10/356
[1]: https://github.com/danobi/bpf-dwarf-walk

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/e2718ced2d51ef4268590ab8562962438ab82815.1629772842.git.dxu@dxuuu.xyz
2021-08-31 14:21:44 -07:00
..
bpf_common.h mirror uapi/linux/bpf_common.h file (#2) 2018-10-12 12:57:55 -07:00
bpf.h bpf: Add bpf_task_pt_regs() helper 2021-08-31 14:21:44 -07:00
btf.h bpf: Add BTF_KIND_FLOAT to uapi 2021-03-05 14:15:26 -08:00
if_link.h bonding: add new option lacp_active 2021-08-17 08:18:57 -07:00
if_xdp.h xsk: Add new statistics 2020-07-28 14:03:17 -07:00
netlink.h sync with latest bpf-next (#6) 2019-01-03 12:44:33 -08:00
pkt_cls.h include: initial sync of pkt_cls.h and pkt_sched.h 2021-07-16 14:22:07 -07:00
pkt_sched.h include: initial sync of pkt_cls.h and pkt_sched.h 2021-07-16 14:22:07 -07:00