Open shartse opened 6 years ago
The reason is the string "a"
as in bpf_trace_printk("name: %s", "a")
is put into the string table and the bpf program has a relocation record for it. This is not allowed. BPF program does not allow global variable yet.
In 4.17 kernel, I got
BPF_LDX uses reserved fields
Actually, bcc can be improved to catch this. BCC can examine the relocation records and if it found anything there against the text, it should signal the error and goes out, does not even need to go to kernel.
@yonghong-song we also saw the uses reserved fields
error when the program was slightly different (on 4.15 kernel).
Great to hear that it's possible to improve the error message to make it easier to understand how to work around this. Perhaps we can leave this issue open as a request to improve the error message.
Yes. Make sense. Let us leave it open until we do generate better error messages.
Discovered when trying to use to print a string literal:
Fails with:
But replacing
"a"
with achar[]
variable reference allows it to compile and print the value as expected: