-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
uprobes: automatic resolution of library paths #1971
Conversation
Does this also work for libraries that are dlopened? |
The library paths are searched for in |
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.
Great feature!
docs/reference_guide.md
Outdated
When tracing libraries, it is sufficient to specify the library name instead of | ||
a full path. |
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.
Maybe also mention the lookup is done via ldcache? This may be important for systems that have multiple versions of a library installed.
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.
dont forget to mirror this to the manpage too
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.
Good points. Updated, please check.
tests/runtime/engine/parser.py
Outdated
@@ -115,7 +115,7 @@ def __read_test_struct(test, test_suite): | |||
elif item_name == 'ARCH': | |||
arch = [x.strip() for x in line.split("|")] | |||
elif item_name == 'REQUIRES_FEATURE': | |||
features = {"loop", "btf", "probe_read_kernel", "dpath", "uprobe_refcount", "signal", "iter:task", "iter:task_file"} | |||
features = {"loop", "btf", "probe_read_kernel", "dpath", "uprobe_refcount", "signal", "iter:task", "iter:task_file", "libpath_resolv"} |
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.
Could you break this up into multiple lines, please?
tests/runtime/probe
Outdated
RUN {{BPFTRACE}} -e 'uprobe:libc:write { printf("size: %d\n", arg0); exit(); }' | ||
EXPECT size: [0-9]+ | ||
TIMEOUT 5 | ||
AFTER cat /etc/passwd > /dev/null |
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.
Can you write a testprog for this instead? Don't want this test to flake out on us in the future if cat changes.
Uses BCC to resolve a library name into its full path. We require that the library XXX is specified in the form "libXXX". Example: "uprobe:libc:malloc".
Since automatic resolution depends on a BCC capability, a new feature had to be added to the runtime tests framework. Also, embedded Alpine builds do not have a shared libc so we must disable the new test for them.
4d8749d
to
737d6d9
Compare
This introduces an option to attach to library functions by specifying just the library name instead of a full path. For example:
One of the use-cases is a better portability of scripts that attach to library functions (as the full library paths may differ across systems). For example, the current
tools/gethostlatency.bt
doesn't work on Fedora.Unfortunately, our shipped tools cannot be updated right away since this feature relies on BCC's
bcc_procutils_which_so
which is not available on old BCC versions, especially not those used in the CI. If #1933 was resolved, it would be possible.Checklist
man/adoc/bpftrace.adoc
and if needed indocs/reference_guide.md
CHANGELOG.md