Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug: offset is outside of the packet. #136

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

weiyanhua100
Copy link

  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

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
Signed-off-by: weiyanhua <[email protected]>
@tohojo
Copy link
Member

tohojo commented Jun 25, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants