[Bug bpf/24528] stapbpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets

me at serhei dot io sourceware-bugzilla@sourceware.org
Thu Jun 20 17:30:00 GMT 2019


https://sourceware.org/bugzilla/show_bug.cgi?id=24528

--- Comment #1 from Serhei Makarov <me at serhei dot io> ---
Added a 'target' field to struct program.

Next step is to go through bpf-translate.cxx and spot all the places where we
should be checking that 'target' field and signalling an error (or possibly
generating different code) instead of crossing our fingers that the user knows
which stap language constructs are and aren't supported by kernel bpf.

That way, if we use the wrong construct in the wrong code, we won't be getting
this type of cryptic madness anymore:

$ sudo ~/stap-install/bin/stap --bpf -e 'global g probe
kernel.function("vfs_read") { g["foo"] = "bar" foreach(k in g) { println(k) }
}'
Error loading /tmp/stapoSgfxZ/stap_25366.bo: bpf program load failed: Invalid
argument
back-edge from insn 1051 to 92

WARNING: /home/serhei/stap-install/bin/stapbpf exited with status: 1
Pass 5: run failed.  [man error::pass5]

Once the error messages work well (exist), I'll close this PR. But in general,
this work should also allow the userspace interpreter's constraints to be
relaxed (e.g. stack size or hard-register file could be increased) if or when
that proves necessary down the line.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Systemtap mailing list