-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
BIO_NOCLOSE leads to memory leaks while Cert processing #6603
Comments
BIO_set_close with BIO_NOCLOSE argument leads to memory leaks here
BIO_set_close with BIO_NOCLOSE argument leads to memory leaks here
BIO_set_close with BIO_NOCLOSE argument leads to memory leaks here Closes mumble-voip#6603
BIO_set_close with BIO_NOCLOSE argument leads to memory leaks here Closes mumble-voip#6603
Even seems like we don't need call BIO here Simple call |
I am trying to follow the cause of the issue here. So the warnings you posted here complain about memory allocated by But I struggle to see how If you remove the |
You're right. From OpenSSL's documentation:
|
Lines 35 to 38 in cb01bfa
Lines 40 to 44 in cb01bfa
There is attempt to free memory, but flag prevents it. |
If I understand correctly, It should not affect whether or not Looking at the bio_free documentation it clearly reads:
Maybe using |
Still leak with |
OKAY Core files is bss_mem.c and bio_lib.c We create a BIO struct with using Finally, we cannot deallocate the buf_mem_st here If this explanation is not enough, please just close the issue and PR.. |
After having tried to read through the OpenSSL documentation, I conclude that
From 2. I deduce that it would be pretty silly if these BIOs would, under any circumstances delete the buffer they are wrapping. By design, OpenSSL does not own the wrapped buffer and therefore (probably!) doesn't try to delete them, no matter what. If this is true, then we indeed don't need any special precautions, i.e. the The truthfulness of this assumption is supported by
While I don't claim to 100% understand the OpenSSL API (not even the little bit that we are using), I am confident enough with my observations to agree with @botanegg's proposed changes. |
BIO_set_close with BIO_NOCLOSE argument leads to OpenSSL not (fully) deleting the allocated BIO struct under the assumption that the user code has taken ownership of it. However, in our case, this is not the case and therefore OpenSSL should do the deletion as usual. The flag was probably introduced under the assumption that the component that either is or isn't deleted by OpenSSL was the externally provided buffer that is wrapped into a BIO object via BIO_new_mem_buf. However, this is not the case. OpenSSL doesn't take ownership of the provided buffer and therefore also doesn't delete it. Closes mumble-voip#6603
BIO_set_close with BIO_NOCLOSE argument leads to OpenSSL not (fully) deleting the allocated BIO struct under the assumption that the user code has taken ownership of it. However, in our case, this is not the case and therefore OpenSSL should do the deletion as usual. The flag was probably introduced under the assumption that the component that either is or isn't deleted by OpenSSL was the externally provided buffer that is wrapped into a BIO object via BIO_new_mem_buf. However, this is not the case. OpenSSL doesn't take ownership of the provided buffer and therefore also doesn't delete it. Closes mumble-voip#6603
Description
BIO_NOCLOSE leads to memory leaks while Cert processing
Steps to reproduce
asan
asan
logsMumble version
master (cb01bfa)
Mumble component
Both
OS
Linux
Reproducible?
Yes
Additional information
No response
Relevant log output
The text was updated successfully, but these errors were encountered: