BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/2] Add kernel symbol for struct_ops trampoline
@ 2024-11-11 12:16 Xu Kuohai
  2024-11-11 12:16 ` [PATCH bpf-next v3 1/2] bpf: Use function pointers count as struct_ops links count Xu Kuohai
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Xu Kuohai @ 2024-11-11 12:16 UTC (permalink / raw)
  To: bpf, netdev
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Eduard Zingerman, Yonghong Song, Kui-Feng Lee

From: Xu Kuohai <xukuohai@huawei.com>

Add kernel symbol for struct_ops trampoline.

Without kernel symbol for struct_ops trampoline, the unwinder may
produce unexpected stacktraces. For example, the x86 ORC and FP
unwinder stops stacktrace on a struct_ops trampoline address since
there is no kernel symbol for the address.

v3:
- Add a separate cleanup patch to replace links_cnt with funcs_cnt
- Allocate ksyms on-demand in update_elem() to stay with the links
  allocation way
- Set ksym name to prog__<struct_ops_name>_<member_name>

v2: https://lore.kernel.org/bpf/20241101111948.1570547-1-xukuohai@huaweicloud.com/
- Refine the commit message for clarity and fix a test bot warning

v1: https://lore.kernel.org/bpf/20241030111533.907289-1-xukuohai@huaweicloud.com/

Xu Kuohai (2):
  bpf: Use function pointers count as struct_ops links count
  bpf: Add kernel symbol for struct_ops trampoline

 include/linux/bpf.h         |   3 +-
 kernel/bpf/bpf_struct_ops.c | 114 ++++++++++++++++++++++++++++++++----
 kernel/bpf/dispatcher.c     |   3 +-
 kernel/bpf/trampoline.c     |   9 ++-
 4 files changed, 114 insertions(+), 15 deletions(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-12 12:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 12:16 [PATCH bpf-next v3 0/2] Add kernel symbol for struct_ops trampoline Xu Kuohai
2024-11-11 12:16 ` [PATCH bpf-next v3 1/2] bpf: Use function pointers count as struct_ops links count Xu Kuohai
2024-11-11 12:16 ` [PATCH bpf-next v3 2/2] bpf: Add kernel symbol for struct_ops trampoline Xu Kuohai
2024-11-11 23:04   ` Martin KaFai Lau
2024-11-12 12:06     ` Xu Kuohai
2024-11-11 12:54 ` [PATCH bpf-next v3 0/2] " Xu Kuohai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox