fix bug: offset is outside of the packet. #136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
xdp_loader:
./xdp_loader --dev lo -S --progsec xdp_packet_parser verb
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