New issue
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
Ensure symbols are exported for bpftrace executable #1438
Conversation
bpftrace executable needs to lookup `BEGIN_trigger` and `END_trigger` symbols. Since the bump of the minimal versin of CMake in 1a1a4a9, these symbols are stripped from bpftrace: the executable is built without the `-rdynamic` option and the symbol is not present anymore (tested with GCC 10). To restore this compile option, we can instruct CMake to export symbols for bpftrace executable. Also, see bpftrace#954.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me. Thanks for the fix!
i think this broke master for embedded builds, just looking at CI history, and also suspicious is linked by #1440 Maybe we need to back this out while we figure it out. Is this fix just needed for GCC 10?
I think we don't have this by default in the embedded builds, but i'll have to check the flags. |
Yeah, let's revert for now so we get CI back |
Revert in #1441 |
❦ 28 juillet 2020 11:20 -07, Dale Hamel:
Maybe we need to back this out while we figure it out. Is this fix just needed for GCC 10?
If useful, I can test with GCC 9.
|
As of today, to trigger BPF program from user space, the common practise is to create a uprobe on a special function and calls that function. For example, bpftrace uses BEGIN_trigger and END_trigger for the BEGIN and END programs. However, uprobe is not ideal for this use case. First, uprobe uses trap, which adds non-trivial overhead. Second, uprobe requires calculating function offset at runtime, which is not very reliable. bpftrace has seen issues with this: bpftrace/bpftrace#1438 bpftrace/bpftrace#1440 This patch introduces a new BPF program type BPF_PROG_TYPE_USER, or "user program". User program is triggered via sys_bpf(BPF_PROG_TEST_RUN), which is significant faster than a trap. To make user program more flexible, we enabled the following features: 1. The user can specify on which cpu the program should run. If the target cpu is not current cpu, the program is triggered via IPI. 2. User can pass optional argument to user program. Currently, the argument can only be 5x u64 numbers. User program has access to helper functions in bpf_tracing_func_proto() and bpf_get_stack|stackid(). Signed-off-by: Song Liu <songliubraving@fb.com>
bpftrace executable needs to lookup
BEGIN_trigger
andEND_trigger
symbols. Since the bump of the minimal versin of CMake in
1a1a4a9, these symbols are stripped
from bpftrace: the executable is built without the
-rdynamic
optionand the symbol is not present anymore (tested with GCC 10). To restore
this compile option, we can instruct CMake to export symbols for
bpftrace executable.
Also, see #954.