lizrice / learning-ebpf

Learning eBPF, published by O'Reilly - out now! Here's where you'll find a VM config for the examples, and more

Home Page:https://www.amazon.com/Learning-eBPF-Programming-Observability-Networking/dp/1098135121

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chapter 8 Make fails

sherwoodzern opened this issue · comments

I execute sudo make for the components in chapter 8. I get the following output. There are a number of failures in the process. I do not have a /sys/fs/bpf/hello.

bpftool net detach xdp dev lo
rm -f /sys/fs/bpf/hello
bpftool prog load hello.bpf.o /sys/fs/bpf/hello
libbpf: load bpf program failed: Invalid argument
libbpf: -- BEGIN DUMP LOG ---
libbpf:
0: (61) r2 = *(u32 *)(r1 +4)
1: (61) r1 = *(u32 *)(r1 +0)
2: (bf) r3 = r1
3: (07) r3 += 14
4: (2d) if r3 > r2 goto pc+11
R1_w=pkt(id=0,off=0,r=14,imm=0) R2_w=pkt_end(id=0,off=0,imm=0) R3_w=pkt(id=0,off=14,r=14,imm=0) R10=fp0
5: (69) r3 = *(u16 *)(r1 +12)
6: (55) if r3 != 0x8 goto pc+9
R1_w=pkt(id=0,off=0,r=14,imm=0) R2_w=pkt_end(id=0,off=0,imm=0) R3_w=inv8 R10=fp0
7: (bf) r3 = r1
8: (07) r3 += 34
9: (2d) if r3 > r2 goto pc+6
R1=pkt(id=0,off=0,r=34,imm=0) R2=pkt_end(id=0,off=0,imm=0) R3=pkt(id=0,off=34,r=34,imm=0) R10=fp0
10: (71) r1 = *(u8 *)(r1 +23)
11: (55) if r1 != 0x1 goto pc+4
R1_w=inv1 R2=pkt_end(id=0,off=0,imm=0) R3=pkt(id=0,off=34,r=34,imm=0) R10=fp0
12: (18) r1 = 0xffff9abb4035e000
14: (b7) r2 = 11
15: (85) call bpf_trace_printk#6
cannot call GPL-restricted function from non-GPL compatible program
processed 15 insns (limit 1000000) max_states_per_insn 0 total_states 1 peak_states 1 mark_read 1

libbpf: -- END LOG --
libbpf: failed to load program 'ping'
libbpf: failed to load object 'hello.bpf.o'
Error: failed to load object file
make: *** [Makefile:13: hello] Error 255

I think this was fixed by #6 which added the missing license string that the verifier is complaining about. Do you have the latest code including that update?