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

Memory leak detected by pytests invoking init_client_ssl() interface: memory leak of type 'key_message *', no destructor found. #181

Open
gapisback opened this issue Aug 19, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@gapisback
Copy link
Collaborator

While developing new pytests to invoke Python bindings to Certifier Framework interfaces, the following memory leak was detected and reported by the pytests machinery:

test_certifier_framework.py::test_run_app_as_a_client_init_client_ssl PublicKeyFromCert() error, line 432, Failed to retrieve HWID from VCEK extensions
 ... cctd.init_policy_key() succeeded.
 ... cctd.initialize_simulated_enclave_data() succeeded.
 ... cctd.cold_init() succeeded.
 ... cctd.warm_restart() succeeded.
certify_domain():1539: enclave_type_ = 'simulated-enclave', purpose_ = 'authentication'
 ... cctd.certify_me() succeeded.
 ... cctd.cc_all_initialized() succeeded.
 ... Secure channel client instantiated.
 ... cctd.trust data is initialized.
 ... cctd.primary admissions cert is valid.
asn1_to_x509() error, line: 3764, no x509 pointer
init_client_ssl() error, line 2409, init_client_ssl: root cert invalid
64756d6d792d73657269616c697a65642d706f6c6963792d63657274
swig/python detected a memory leak of type 'key_message *', no destructor found.

The test case itself is currently not working due to some Python arg-calling interface issues.
After correcting those manually (by patching generated SWIG wrapper code), the memory leak messages are still seen:

*swig/python detected a memory leak of type 'key_message ', no destructor found.

--
The suspected code is probably here in the destructor method of secure_authenticated_channel():

2362 certifier::framework::secure_authenticated_channel::
2363     ~secure_authenticated_channel() {
2364   role_.clear();
2365   channel_initialized_ = false;
2366
2367   // ? FIXME - Seems to cause a memory leak detected in pytests
2368   // delete private_key_
2369
2370   if (ssl_ctx_ != nullptr)

Investigate this code flow to see how to do a delete on protobuf-generated sub-objects hanging off of secure_authenticated_channel().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants