Skip to content

Commit fe2a474

Browse files
chendotjsgregkh
authored andcommitted
samples/bpf: Fix broken tracex1 due to kprobe argument change
[ Upstream commit 137733d ] >From commit c0bbbdc ("__netif_receive_skb_core: pass skb by reference"), the first argument passed into __netif_receive_skb_core has changed to reference of a skb pointer. This commit fixes by using bpf_probe_read_kernel. Signed-off-by: Yaqi Chen <chendotjs@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20210416154803.37157-1-chendotjs@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2e8ffd9 commit fe2a474

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎samples/bpf/tracex1_kern.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
SEC("kprobe/__netif_receive_skb_core")
2727
int bpf_prog1(struct pt_regs *ctx)
2828
{
29-
/* attaches to kprobe netif_receive_skb,
29+
/* attaches to kprobe __netif_receive_skb_core,
3030
* looks for packets on loobpack device and prints them
3131
*/
3232
char devname[IFNAMSIZ];
@@ -35,7 +35,7 @@ int bpf_prog1(struct pt_regs *ctx)
3535
int len;
3636

3737
/* non-portable! works for the given kernel only */
38-
skb = (struct sk_buff *) PT_REGS_PARM1(ctx);
38+
bpf_probe_read_kernel(&skb, sizeof(skb), (void *)PT_REGS_PARM1(ctx));
3939
dev = _(skb->dev);
4040
len = _(skb->len);
4141

0 commit comments

Comments
 (0)