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

programs: Plug attach_btf_obj_fd leak #748

Merged
merged 1 commit into from
Aug 11, 2023
Merged

programs: Plug attach_btf_obj_fd leak #748

merged 1 commit into from
Aug 11, 2023

Conversation

tamird
Copy link
Member

@tamird tamird commented Aug 10, 2023

ProgramData::attach_btf_obj_fd is now owned. This means that
ProgramData now closes the file descriptor on drop.

Updates #612.

@netlify
Copy link

netlify bot commented Aug 10, 2023

Deploy Preview for aya-rs-docs ready!

Name Link
🔨 Latest commit d88ca62
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/64d6422bceb2570008ee7538
😎 Deploy Preview https://deploy-preview-748--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mergify mergify bot added the aya This is about aya (userspace) label Aug 10, 2023
@tamird
Copy link
Member Author

tamird commented Aug 10, 2023

cc @nrxus

@@ -604,7 +597,7 @@ fn load_program<T: Link>(
kernel_version: target_kernel_version,
expected_attach_type: *expected_attach_type,
prog_btf_fd: btf_fd.as_ref().map(|f| f.as_fd()),
attach_btf_obj_fd: *attach_btf_obj_fd,
attach_btf_obj_fd: attach_btf_obj_fd.as_ref().map(|fd| fd.as_raw_fd() as _),
Copy link
Contributor

Choose a reason for hiding this comment

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

why not make attach_btf_obj_fd be a Option<BorrowedFd<'a>>? We already do that for prog_btf_fd,

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call. Done.

`ProgramData::attach_btf_obj_fd` is now owned.  This means that
`ProgramData` now closes the file descriptor on drop.

Updates #612.
@tamird tamird merged commit 7f98e41 into main Aug 11, 2023
22 checks passed
@tamird tamird deleted the btf_obj_fd-owned branch August 11, 2023 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya This is about aya (userspace)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants