Open azharivs opened 3 years ago
That is indeed very strange. The first thing that sticks out for me is of course the version on that kernel :eyes: ! So I guess Redhat has back-ported most of the known universe in order to make that work?
When you hit a bug with ply's code generator you will typically get lots of output from the kernel verifier. So my guess would be that you are hitting some guard before that is even invoked.
Could it be the case that they have not backported the log buffer stuff? What happens if you always keep attr.log_size
and attr.log_level
set to 0 in bpf_prog_load
?
I am assuming that the BPF kernel verifier is enabled given the same set of BPF kernel config options. Does it require any special option?
This is on a Redhat Enterprise 64 bit system. It is strange that I can run my ply scripts but when specifying the -d option it fails to run the script and the syscall to bpf returns -1 with errno set to 22.
The error message and bpf instructions:
Despite the error, the ply script runs when -d is not provided!!
I have attached a debugger and see that in syscall.c:int bpf_prog_load() the syscall to return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); returns -1 with errno = 22. According to man of bpf this is EINVAL which is due to bad bpf program:
"EINVAL For BPF_PROG_LOAD, indicates an attempt to load an invalid program. eBPF programs can be deemed invalid due to unrecognized instructions, the use of reserved fields, jumps out of range, infinite loops or calls of unknown functions." I could not find such a problem in the dumped bpf program.
Any ideas? Is there a way to get more details form the kernel? The contents of vlog where an empty string despite log_level = 1.
Also for reference here is the output of the following basic kprobe: