diff options
author | Eugene Zemtsov <ezemtsov@google.com> | 2017-09-25 17:41:16 +0000 |
---|---|---|
committer | Eugene Zemtsov <ezemtsov@google.com> | 2017-09-25 17:41:16 +0000 |
commit | 3015341d45d80663db6b38f238c435418dd98343 (patch) | |
tree | 4cb2507a2071b24463e86c6d6e6342f5a367be26 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | |
parent | 761f0b660dd72addf67e1eb1e82f62abaafc9112 (diff) | |
download | bcm5719-llvm-3015341d45d80663db6b38f238c435418dd98343.tar.gz bcm5719-llvm-3015341d45d80663db6b38f238c435418dd98343.zip |
Use socketpair on all Unix platforms
Using TCP sockets is insecure against local attackers, and possibly
against remote attackers too (some vulnerabilities may allow tricking a
browser to make a request to localhost). Use socketpair (which is immune
to such attacks) on all Unix platforms.
Patch by Demi Marie Obenour < demiobenour@gmail.com >
Differential Revision: https://reviews.llvm.org/D33213
llvm-svn: 314127
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 383cffbaac7..5b4c1c5747e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -3289,7 +3289,7 @@ ProcessGDBRemote::EstablishConnectionIfNeeded(const ProcessInfo &process_info) { } return error; } -#if defined(__APPLE__) +#if !defined(_WIN32) #define USE_SOCKETPAIR_FOR_LOCAL_CONNECTION 1 #endif @@ -3333,8 +3333,8 @@ Status ProcessGDBRemote::LaunchAndConnectToDebugserver( lldb_utility::CleanUp<int, int> our_socket(-1, -1, close); lldb_utility::CleanUp<int, int> gdb_socket(-1, -1, close); - // Use a socketpair on Apple for now until other platforms can verify it - // works and is fast enough + // Use a socketpair on non-Windows systems for security and performance + // reasons. { int sockets[2]; /* the pair of socket descriptors */ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) == -1) { |