On Sun, 25 Apr 2021 at 20:18, Y Song <ys114321@...> wrote:
This is a good question. In earlier bpf days, the key MUST be from stack. Otherwise, the verifier will fail. Nowadays, things become better and keys can be from verifier recognizable memory regions (stack, key, value, allocated_mem, etc.). I think rewriter can be made smart to check if the first argument of the increment is actually a variable (instead of an expression), we can directly take the address of it since the variable can be allocated on stack. The relevant code is at b_frontend_action.cc. Do you want to take a look to see whether you could help improve the bcc rewriter for this particular issue?
I am happy to take a look at the code and see if I can improve it at all.