Skip to content
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

Merged
merged 1 commit into from Jul 24, 2020

Conversation

vincentbernat
Copy link
Contributor

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 #954.

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.
Copy link
Member

@danobi danobi left a 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!

@dalehamel
Copy link
Contributor

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?

from bpftrace: the executable is built without the -rdynamic

I think we don't have this by default in the embedded builds, but i'll have to check the flags.

@danobi
Copy link
Member

danobi commented Jul 28, 2020

Yeah, let's revert for now so we get CI back

@danobi
Copy link
Member

danobi commented Jul 28, 2020

Revert in #1441

@vincentbernat
Copy link
Contributor Author

vincentbernat commented Jul 31, 2020 via email

fengguang pushed a commit to 0day-ci/linux that referenced this pull request Aug 1, 2020
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants