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

_initialize_ebpf_object_native: only clean up locally-created objects #2125

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

mtfriesen
Copy link
Collaborator

@mtfriesen mtfriesen commented Feb 22, 2023

Description

_initialize_ebpf_object_native calls _clean_up_ebpf_object in its failure path, which releases all resources in the object. This leads to all kinds of errors, including double frees of memory and closures of OS handles.

This usage of _clean_up_ebpf_object is unlike the other _initialize_ebpf_object* routines, which release only locally-created resources. Fix this misbehavior by aligning with the clean-up-what-you-created pattern.

Resolves #2122

Testing

Tested in XDP stress test, plus any coverage in eBPF CI/CD.

Documentation

N/A.

@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Merging #2125 (e128e53) into main (cc9ba16) will increase coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #2125      +/-   ##
==========================================
+ Coverage   82.66%   82.68%   +0.01%     
==========================================
  Files         152      152              
  Lines       27873    27875       +2     
==========================================
+ Hits        23042    23049       +7     
+ Misses       4831     4826       -5     
Impacted Files Coverage Δ
libs/api/ebpf_api.cpp 87.10% <0.00%> (-0.09%) ⬇️
libs/platform/user/ebpf_platform_user.cpp 83.33% <0.00%> (-0.17%) ⬇️
tests/end_to_end/test_helper.cpp 86.83% <0.00%> (+2.24%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@saxena-anurag saxena-anurag added this pull request to the merge queue Feb 23, 2023
Merged via the queue into main with commit 179ec1b Feb 23, 2023
@saxena-anurag saxena-anurag deleted the mtfriesen/native_init_cleanup branch February 23, 2023 03:53
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.

double free in EbpfApi.dll
4 participants