xdp-tutorial icon indicating copy to clipboard operation
xdp-tutorial copied to clipboard

fix bug: offset is outside of the packet.

Open weiyanhua100 opened this issue 4 years ago • 1 comments

  1. xdp_loader: ./xdp_loader --dev lo -S --progsec xdp_packet_parser verb

  2. Problem Description:

libbpf: load bpf program failed: Permission denied libbpf: -- BEGIN DUMP LOG --- libbpf: 0: (bf) r6 = r1 1: (b7) r1 = 2 2: (61) r2 = *(u32 *)(r6 +0) 3: (07) r2 += 12 4: (61) r3 = *(u32 *)(r6 +4) 5: (2d) if r2 > r3 goto pc+7 R1=inv2 R2=pkt(id=0,off=12,r=12,imm=0) R3=pkt_end(id=0,off=0,imm=0) R6=ctx(id=0,off=0,imm=0) R10=fp0,call_-1 6: (71) r1 = *(u8 *)(r2 +0) invalid access to packet, off=12 size=1, R2(id=0,off=12,r=12) R2 offset is outside of the packet

libbpf: -- END LOG -- libbpf: failed to load program 'xdp_packet_parser' libbpf: failed to load object 'xdp_prog_kern.o' ERR: loading BPF-OBJ file(xdp_prog_kern.o) (-22): Invalid argument

weiyanhua100 avatar Jun 25 '20 08:06 weiyanhua100

It's a tutorial; you're not supposed to send pull requests to fix the bugs that makes up the assignment ;)

tohojo avatar Jun 25 '20 09:06 tohojo