You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2019/11/22 23:41:28 UTC
[mesos] branch 1.9.x updated (c313168 -> 95d34e7)
This is an automated email from the ASF dual-hosted git repository.
grag pushed a change to branch 1.9.x
in repository https://gitbox.apache.org/repos/asf/mesos.git.
from c313168 Garbage-collected lost tasks which are reported as running again.
new a687e71 Fixed memory leak in openssl verification function.
new 95d34e7 Added MESOS-10041 to the 1.9.1 CHANGELOG.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
3rdparty/libprocess/src/openssl.cpp | 18 +++++-------------
CHANGELOG | 1 +
2 files changed, 6 insertions(+), 13 deletions(-)
[mesos] 01/02: Fixed memory leak in openssl verification function.
Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
grag pushed a commit to branch 1.9.x
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit a687e71790151b5b078322e825ade349cc6922dc
Author: Benno Evers <be...@mesosphere.com>
AuthorDate: Fri Nov 22 12:00:43 2019 -0800
Fixed memory leak in openssl verification function.
When the hostname validation scheme was set to 'openssl',
the `openssl::verify()` function would return without
freeing a previously allocated `X509*` object.
To fix the leak, a long-standing TODO to switch to
RAII-based memory management for the certificate was
resolved.
Review: https://reviews.apache.org/r/71805/
---
3rdparty/libprocess/src/openssl.cpp | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/3rdparty/libprocess/src/openssl.cpp b/3rdparty/libprocess/src/openssl.cpp
index a81d13f..7eb5822 100644
--- a/3rdparty/libprocess/src/openssl.cpp
+++ b/3rdparty/libprocess/src/openssl.cpp
@@ -841,8 +841,9 @@ Try<Nothing> verify(
}
// The X509 object must be freed if this call succeeds.
- // TODO(jmlvanre): handle this better. How about RAII?
- X509* cert = SSL_get_peer_certificate(ssl);
+ std::unique_ptr<X509, decltype(&X509_free)> cert(
+ SSL_get_peer_certificate(ssl),
+ X509_free);
// NOTE: Even without this check, the OpenSSL handshake will not complete
// when connecting to servers that do not present a certificate, unless an
@@ -852,7 +853,6 @@ Try<Nothing> verify(
}
if (SSL_get_verify_result(ssl) != X509_V_OK) {
- X509_free(cert);
return Error("Could not verify peer certificate");
}
@@ -896,7 +896,6 @@ Try<Nothing> verify(
}
if (!ssl_flags->verify_ipadd && peer_hostname.isNone()) {
- X509_free(cert);
return ssl_flags->require_client_cert
? Error("Cannot verify peer certificate: peer hostname unknown")
: Try<Nothing>(Nothing());
@@ -908,7 +907,7 @@ Try<Nothing> verify(
// physical host.
STACK_OF(GENERAL_NAME)* san_names =
reinterpret_cast<STACK_OF(GENERAL_NAME)*>(X509_get_ext_d2i(
- reinterpret_cast<X509*>(cert),
+ cert.get(),
NID_subject_alt_name,
nullptr,
nullptr));
@@ -931,7 +930,6 @@ Try<Nothing> verify(
const size_t length = ASN1_STRING_length(current_name->d.dNSName);
if (length != dns_name.length()) {
sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free);
- X509_free(cert);
return Error(
"X509 certificate malformed: "
"embedded NUL character in DNS name");
@@ -941,7 +939,6 @@ Try<Nothing> verify(
// Compare expected hostname with the DNS name.
if (peer_hostname.get() == dns_name) {
sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free);
- X509_free(cert);
VLOG(2) << "dNSName match found for " << peer_hostname.get();
@@ -966,7 +963,6 @@ Try<Nothing> verify(
if (ip.get() == ip_add) {
sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free);
- X509_free(cert);
VLOG(2) << "iPAddress match found for " << ip.get();
@@ -985,7 +981,7 @@ Try<Nothing> verify(
if (peer_hostname.isSome()) {
// If we still haven't verified the hostname, try doing it via
// the certificate subject name.
- X509_NAME* name = X509_get_subject_name(cert);
+ X509_NAME* name = X509_get_subject_name(cert.get());
if (name != nullptr) {
char text[MAXHOSTNAMELEN] {};
@@ -998,7 +994,6 @@ Try<Nothing> verify(
VLOG(2) << "Matching common name: " << text;
if (peer_hostname.get() != text) {
- X509_free(cert);
return Error(
"Presented Certificate Name: " + stringify(text) +
" does not match peer hostname name: " + peer_hostname.get());
@@ -1006,15 +1001,12 @@ Try<Nothing> verify(
VLOG(2) << "Common name match found for " << peer_hostname.get();
- X509_free(cert);
return Nothing();
}
}
}
// If we still haven't exited, we haven't verified it, and we give up.
- X509_free(cert);
-
std::vector<string> details;
if (peer_hostname.isSome()) {
[mesos] 02/02: Added MESOS-10041 to the 1.9.1 CHANGELOG.
Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
grag pushed a commit to branch 1.9.x
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 95d34e7f30c6ca8a074bd2af0359ed96310adee3
Author: Greg Mann <gr...@gmail.com>
AuthorDate: Fri Nov 22 15:19:30 2019 -0800
Added MESOS-10041 to the 1.9.1 CHANGELOG.
---
CHANGELOG | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG b/CHANGELOG
index 398f479..08e8944 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,6 +10,7 @@ Release Notes - Mesos - Version 1.9.1 (WIP)
* [MESOS-10007] - Command executor can miss exit status for short-lived commands due to double-reaping.
* [MESOS-10008] - Very large quota values can crash master.
* [MESOS-10015] - updateAllocation() can stall the allocator with a huge number of reservations on an agent.
+ * [MESOS-10041] - Libprocess SSL verification can leak memory.
** Improvement
* [MESOS-9889] - Master CPU high due to unexpected foreachkey behaviour in Master::__reregisterSlave.