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

Fix cleanup of BPF unmount #107

Merged
merged 1 commit into from
May 8, 2023
Merged

Fix cleanup of BPF unmount #107

merged 1 commit into from
May 8, 2023

Conversation

mariomac
Copy link
Contributor

@mariomac mariomac commented May 8, 2023

This fixes some aspects of BPF map unmounting:

  • Often, the os.Exit function in the shutdown hook was invoked before the unmounting code, so the PID folders remained unmounted.
  • Removed the os.Exit invocation sometimes caused the system to panic with "internal error: exit hook invoked exit".
    • To avoid the process to be blocked if it did not found the target executable, we added a context to the InspectOffsets function that stops searching if the context is canceled.
  • The mount/unmount code has been moved from main.go to the eBPF package, as it is actually a functionality related to BPF.

@mariomac mariomac requested a review from grcevski as a code owner May 8, 2023 10:30
Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

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

LGTM! This looks great!

@mariomac mariomac merged commit d40922c into grafana:main May 8, 2023
3 checks passed
@mariomac mariomac deleted the fix-unmount branch May 8, 2023 14:46
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

2 participants