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

Clean up unnecessary symbol existence checks #2370

Merged
merged 15 commits into from
Nov 2, 2022

Conversation

BurntBrunch
Copy link

@BurntBrunch BurntBrunch commented Sep 26, 2022

(This is based on top of #2369, look at the libbpf: and libbcc: commits only in this PR)
(Part of #2334 work)

Now that we have strict requirements for minimum library versions, this PR removes unnecessary libbpf and bcc symbol checks in the bpftrace codebase. Now that these are cleaned up, we may even be able to set up libbpf and bcc as ExternalProjects, if we so desired (though I'd personally prefer to keep them as git submodules).

@BurntBrunch BurntBrunch mentioned this pull request Sep 27, 2022
@BurntBrunch BurntBrunch force-pushed the vendor-libbpf branch 4 times, most recently from 794b9af to a83b0d1 Compare September 29, 2022 22:13
@BurntBrunch BurntBrunch force-pushed the vendor-libbpf branch 2 times, most recently from 9a3de98 to ad05431 Compare October 14, 2022 23:27
@BurntBrunch BurntBrunch force-pushed the vendor-libbpf branch 7 times, most recently from 5fc8cee to 456d08e Compare October 28, 2022 22:51
Currently, the test runner can use variables in the `except` branch
before they're initialized. Hoist all the local state variables to
before the try: to fix that.

Also, make BEFORE_PID logic run only if the test uses `{{BEFORE_PID}}`.
@BurntBrunch
Copy link
Author

BurntBrunch commented Nov 1, 2022

Alright, I think I found a fix for the flaky usdt test (or at least made it better?). For reasons I don't understand, I was only able to fix it by writing a new C binary that forks and execs the necessary two instances. Doing so from bash made the BEFORE phase time out (wtf GH Actions; I suspect some layer of security hooks or auditing slowing things down). Doing so from a bash script doesn't work because pidof will see bash as the name.

Delyan Kratunov added 10 commits November 1, 2022 15:21
The way the test runner determines that the BEFORE clause has started is
by splitting the string by whitespace and calling `pidof` with the last
substring. In this test, we launch the same program twice, so
there exists a time between the two invocations where `pidof` will
return the pid for the first process but we wouldn't have launched the
second one yet. bpftrace would then launch and only attach to the first
process and the test will time out.

The fix is somewhat hacky - we build a small C binary which runs one
instance as a child and one instance as the parent process.
(I tried bash-based fixes in previous iterations to no avail; there is
something going on inside GH Actions but I can't figure out what.)
Copy link
Contributor

@viktormalik viktormalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one thing comes to mind: are we documenting the minimum required libbpf and bcc versions somewhere?

@BurntBrunch
Copy link
Author

are we documenting the minimum required libbpf and bcc versions somewhere

I'll document it in INSTALL.md and README.md and send a separate PR

@BurntBrunch BurntBrunch merged commit 7341526 into bpftrace:master Nov 2, 2022
@viktormalik viktormalik mentioned this pull request Nov 3, 2022
@viktormalik viktormalik mentioned this pull request Nov 25, 2022
3 tasks
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.

2 participants