You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/08/10 00:07:34 UTC
[1/2] mesos git commit: Fixed a use-after-close bug in PollSocketImpl.
Repository: mesos
Updated Branches:
refs/heads/1.0.x 925c857b8 -> 4d76bb145
Fixed a use-after-close bug in PollSocketImpl.
Currently, the poll socket implementation doesn't keep
the socket alive after `PollSocketImpl.send(data, length)`
passes execution off to a continuation and so it may send
on a stale file descriptor!
Review: https://reviews.apache.org/r/50936/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6423d6de
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6423d6de
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6423d6de
Branch: refs/heads/1.0.x
Commit: 6423d6de914cfa58c8504b934dabbfd05a93d22d
Parents: 925c857
Author: Greg Mann <gr...@mesosphere.io>
Authored: Tue Aug 9 17:04:27 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Tue Aug 9 17:05:58 2016 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/poll_socket.cpp | 39 +++++++++++++++++++++-------
1 file changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6423d6de/3rdparty/libprocess/src/poll_socket.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/poll_socket.cpp b/3rdparty/libprocess/src/poll_socket.cpp
index d14dd1a..a45cc20 100644
--- a/3rdparty/libprocess/src/poll_socket.cpp
+++ b/3rdparty/libprocess/src/poll_socket.cpp
@@ -162,12 +162,12 @@ Future<size_t> PollSocketImpl::recv(char* data, size_t size)
namespace internal {
-Future<size_t> socket_send_data(int s, const char* data, size_t size)
+Future<size_t> socket_send_data(Socket socket, const char* data, size_t size)
{
CHECK(size > 0);
while (true) {
- ssize_t length = send(s, data, size, MSG_NOSIGNAL);
+ ssize_t length = send(socket.get(), data, size, MSG_NOSIGNAL);
#ifdef __WINDOWS__
int error = WSAGetLastError();
@@ -180,8 +180,8 @@ Future<size_t> socket_send_data(int s, const char* data, size_t size)
continue;
} else if (length < 0 && net::is_retryable_error(error)) {
// Might block, try again later.
- return io::poll(s, io::WRITE)
- .then(lambda::bind(&internal::socket_send_data, s, data, size));
+ return io::poll(socket.get(), io::WRITE)
+ .then(lambda::bind(&internal::socket_send_data, socket, data, size));
} else if (length <= 0) {
// Socket error or closed.
if (length < 0) {
@@ -204,12 +204,17 @@ Future<size_t> socket_send_data(int s, const char* data, size_t size)
}
-Future<size_t> socket_send_file(int s, int fd, off_t offset, size_t size)
+Future<size_t> socket_send_file(
+ Socket socket,
+ int fd,
+ off_t offset,
+ size_t size)
{
CHECK(size > 0);
while (true) {
- Try<ssize_t, SocketError> length = os::sendfile(s, fd, offset, size);
+ Try<ssize_t, SocketError> length =
+ os::sendfile(socket.get(), fd, offset, size);
if (length.isSome()) {
CHECK(length.get() >= 0);
@@ -225,8 +230,13 @@ Future<size_t> socket_send_file(int s, int fd, off_t offset, size_t size)
continue;
} else if (net::is_retryable_error(length.error().code)) {
// Might block, try again later.
- return io::poll(s, io::WRITE)
- .then(lambda::bind(&internal::socket_send_file, s, fd, offset, size));
+ return io::poll(socket.get(), io::WRITE)
+ .then(lambda::bind(
+ &internal::socket_send_file,
+ socket,
+ fd,
+ offset,
+ size));
} else {
// Socket error or closed.
VLOG(1) << length.error().message;
@@ -241,14 +251,23 @@ Future<size_t> socket_send_file(int s, int fd, off_t offset, size_t size)
Future<size_t> PollSocketImpl::send(const char* data, size_t size)
{
return io::poll(get(), io::WRITE)
- .then(lambda::bind(&internal::socket_send_data, get(), data, size));
+ .then(lambda::bind(
+ &internal::socket_send_data,
+ socket(),
+ data,
+ size));
}
Future<size_t> PollSocketImpl::sendfile(int fd, off_t offset, size_t size)
{
return io::poll(get(), io::WRITE)
- .then(lambda::bind(&internal::socket_send_file, get(), fd, offset, size));
+ .then(lambda::bind(
+ &internal::socket_send_file,
+ socket(),
+ fd,
+ offset,
+ size));
}
} // namespace network {
[2/2] mesos git commit: Added MESOS-5988 to the 1.0.1 CHANGELOG.
Posted by bm...@apache.org.
Added MESOS-5988 to the 1.0.1 CHANGELOG.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4d76bb14
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4d76bb14
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4d76bb14
Branch: refs/heads/1.0.x
Commit: 4d76bb145278259cf5a4f7a67d2a7caf58ab6292
Parents: 6423d6d
Author: Benjamin Mahler <bm...@apache.org>
Authored: Tue Aug 9 17:07:24 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Tue Aug 9 17:07:24 2016 -0700
----------------------------------------------------------------------
CHANGELOG | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/4d76bb14/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 0bba509..e612c4e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -18,6 +18,7 @@ All Issues:
* [MESOS-5969] - Linux 'MountInfoTable' entries not sorted as expected
* [MESOS-5982] - NvidiaVolume errors out if any Nvidia binary is missing.
* [MESOS-5986] - SSL Socket CHECK can fail after socket receives EOF.
+ * [MESOS-5988] - PollSocketImpl can write to a stale file descriptor.
Release Notes - Mesos - Version 1.0.0