Skip to content

Commit

Permalink
samples/bpf: tracex4: Fix failed to create kretprobe 'kmem_cache_allo…
Browse files Browse the repository at this point in the history
…c_node+0x0'

commit 7bd230a ("mm/slab: enable slab allocation tagging for kmalloc
and friends") [1] swap kmem_cache_alloc_node() to
kmem_cache_alloc_node_noprof().

    linux/samples/bpf$ sudo ./tracex4
    libbpf: prog 'bpf_prog2': failed to create kretprobe
    'kmem_cache_alloc_node+0x0' perf event: No such file or directory
    ERROR: bpf_program__attach failed

Signed-off-by: Rong Tao <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: torvalds/linux@7bd230a
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
Rtoax authored and anakryiko committed Aug 27, 2024
1 parent ddc3d98 commit d205d4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/bpf/tracex4.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ int bpf_prog1(struct pt_regs *ctx)
return 0;
}

SEC("kretprobe/kmem_cache_alloc_node")
SEC("kretprobe/kmem_cache_alloc_node_noprof")
int bpf_prog2(struct pt_regs *ctx)
{
long ptr = PT_REGS_RC(ctx);
long ip = 0;

/* get ip address of kmem_cache_alloc_node() caller */
/* get ip address of kmem_cache_alloc_node_noprof() caller */
BPF_KRETPROBE_READ_RET_IP(ip, ctx);

struct pair v = {
Expand Down

0 comments on commit d205d4a

Please sign in to comment.