Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 754648 - dev-util/bpftrace-0.11.2: Could not resolve symbol: /proc/self/exe:BEGIN_trigger
Summary: dev-util/bpftrace-0.11.2: Could not resolve symbol: /proc/self/exe:BEGIN_trigger
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrick McLean
URL: https://github.com/iovisor/bpftrace/i...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-15 00:43 UTC by WGH
Modified: 2021-04-25 17:33 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description WGH 2020-11-15 00:43:26 UTC
Built-in BEGIN bpftrace event is broken due to binary being stripped.

Reproducible: Always

Steps to Reproduce:
% sudo bpftrace -e 'BEGIN { @++ }'
Attaching 1 probe...
Could not resolve symbol: /proc/self/exe:BEGIN_trigger



This is because in order to use BEGIN, bpftrace installs a uprobe on itself, and if the binary is stripped, it can't find the symbol.

See upstream discussion: https://github.com/iovisor/bpftrace/issues/954
Comment 1 Patrick McLean gentoo-dev 2020-11-17 04:55:30 UTC
Does FEATURES=splitdebug help for you?

Otherwise, how about FEATURES=nostrip ?

I am a little reluctant to put a RESTRICT=strip on this, as that is a big hammer, but I suppose if it's necessary for basic functionality...
Comment 2 WGH 2020-11-17 18:49:45 UTC
splitdebug doesn't help, nostrip does.

The reason why splitdebug doesn't help is that bpftools uses /proc/self/exe as its own name, and the bcc library ends up searching for a wrong file:

openat(AT_FDCWD, "/proc/self/exe", O_RDONLY) = 29
stat("/proc/self/bpftrace.debug", 0x7fffa8b157e0) = -1 ENOENT (No such file or directory)
access("/proc/self/bpftrace.debug", F_OK) = -1 ENOENT (No such file or directory)
access("/proc/self/.debug/bpftrace.debug", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/debug/proc/self/bpftrace.debug", F_OK) = -1 ENOENT (No such file or directory)

This is certainly an upstream bug on its own.
Comment 3 Larry the Git Cow gentoo-dev 2021-03-24 23:59:28 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b502ccf32895dc1f9cbecc165221022553d28b0

commit 8b502ccf32895dc1f9cbecc165221022553d28b0
Author:     Patrick McLean <chutzpah@gentoo.org>
AuthorDate: 2021-03-24 23:59:01 +0000
Commit:     Patrick McLean <chutzpah@gentoo.org>
CommitDate: 2021-03-24 23:59:16 +0000

    dev-util/bpftrace-0.11.4-r1: revbump RESTRICT=strip (bug #754648)
    
    Closes: https://bugs.gentoo.org/754648
    Package-Manager: Portage-3.0.17, Repoman-3.0.2
    Signed-off-by: Patrick McLean <chutzpah@gentoo.org>

 dev-util/bpftrace/bpftrace-0.11.4-r1.ebuild | 89 +++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
Comment 4 Madhu 2021-04-25 17:33:39 UTC
Version 0.12.1 moves the symbol into libbpftrace.so, and so
the symbol will not be found (even if libbpftrace.so is installed)
I think the only solution is to use "-DBUILD_SHARED_LIBS:=OFF"
and turn off the flag that gentoo's config turns on