We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When load bpf object file which include libbpf_tristate logic, application will panic.
ebpf/internal/kconfig/kconfig.go
Line 160 in 3ae5b17
enum libbpf_tristate should be 32bit in c, so we should change to internal.NativeEndian.PutUint32(data, uint32(tri))
internal.NativeEndian.PutUint32(data, uint32(tri))
panic: runtime error: index out of range [7] with length 4 goroutine 1 [running]: encoding/binary.littleEndian.PutUint64({}, {0xc000012938?, 0x562a80?, 0xc000169a29?}, 0x700000000000013?) /usr/local/go/src/encoding/binary/binary.go:115 +0x29 github.com/cilium/ebpf/internal/kconfig.putValueTri({0xc000012938?, 0xc000166000?, 0x0?}, {0x5c6728?, 0xc000166000?}, {0x6a3ee8?, 0xc000136240?}) /root/project/ebpf/internal/kconfig/kconfig.go:160 +0xf5 github.com/cilium/ebpf/internal/kconfig.PutValue({0xc000012938, 0x4, 0x4}, {0x5c6728?, 0xc000166000?}, {0x6a3ee8, 0x1}) /root/project/ebpf/internal/kconfig/kconfig.go:105 +0x85 github.com/cilium/ebpf.resolveKconfig(0xc00012d980) /root/project/ebpf/collection.go:649 +0xa25 github.com/cilium/ebpf.resolveKconfigReferences({0xc0001002d0, 0x3, 0x3}) /root/project/ebpf/linker.go:427 +0x125 github.com/cilium/ebpf.newProgramWithOptions(0xc0001636d0, {0x10b2c0?, 0xc0?, 0x0?, 0x0?}) /root/project/ebpf/prog.go:334 +0x9c5 github.com/cilium/ebpf.(*collectionLoader).loadProgram(0xc00007a160, {0x54a8bb, 0xf}) /root/project/ebpf/collection.go:504 +0x3fc github.com/cilium/ebpf.(*CollectionSpec).LoadAndAssign.func1({0x5c7ee0, 0x579a80}, {0x54a8bb, 0xf}) /root/project/ebpf/collection.go:268 +0x1fa github.com/cilium/ebpf.assignValues({0x557e20, 0xc000014460}, 0xc000163c68) /root/project/ebpf/collection.go:884 +0x3f3 github.com/cilium/ebpf.(*CollectionSpec).LoadAndAssign(0xc00010b440, {0x557e20, 0xc000014460}, 0x40bf01?) /root/project/ebpf/collection.go:280 +0x196 main.loadBpfObjects({0x557e20, 0xc000014460}, 0x0) /root/project/ebpf/examples/test/bpf_bpfel.go:41 +0x4a main.main() /root/project/ebpf/examples/test/main.go:21 +0x45 exit status 2
ebpf code
#include "bpf_endian.h" #include "common.h" char __license[] SEC("license") = "Dual MIT/GPL"; extern enum libbpf_tristate CONFIG_VIRTIO_NET __kconfig; SEC("kprobe") int kprob_prog_func(struct xdp_md *ctx) { return CONFIG_VIRTIO_NET; }
v0.16.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
When load bpf object file which include libbpf_tristate logic, application will panic.
ebpf/internal/kconfig/kconfig.go
Line 160 in 3ae5b17
enum libbpf_tristate should be 32bit in c, so we should change to
internal.NativeEndian.PutUint32(data, uint32(tri))
How to reproduce
ebpf code
Version information
v0.16.0
The text was updated successfully, but these errors were encountered: