summaryrefslogtreecommitdiffstats
path: root/chrome/app/breakpad_linux.cc
diff options
context:
space:
mode:
authormarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 20:44:03 +0000
committermarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 20:44:03 +0000
commit15e857787595bdcb66875eb43ad6d12d059148e8 (patch)
tree4dd10ab93d1756305618fde35faa731c06320a76 /chrome/app/breakpad_linux.cc
parent3a86ca3f024896e8839e5b2a40f9dd770c0d765c (diff)
downloadchromium_src-15e857787595bdcb66875eb43ad6d12d059148e8.zip
chromium_src-15e857787595bdcb66875eb43ad6d12d059148e8.tar.gz
chromium_src-15e857787595bdcb66875eb43ad6d12d059148e8.tar.bz2
Pid computation for breakpad had a race condition that could cause the
dumper to fail. We now send two file descriptors from the crashing process to the dumper. One of these is used solely to identify the pid. We guarantee that this file descriptor is open in the crashing process by the time the dumper scans for it. And we also no longer play any tricks with guessing the inode number based on the inode of the other descriptor in the socket pair. BUG=none TEST=none Review URL: http://codereview.chromium.org/2856092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/breakpad_linux.cc')
-rw-r--r--chrome/app/breakpad_linux.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index 28b69ba..1624e6c 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -684,7 +684,7 @@ NonBrowserCrashHandler(const void* crash_context, size_t crash_context_size,
// browser to convert namespace tids.
// The length of the control message:
- static const unsigned kControlMsgSize = CMSG_SPACE(sizeof(int));
+ static const unsigned kControlMsgSize = CMSG_SPACE(2*sizeof(int));
struct kernel_msghdr msg;
my_memset(&msg, 0, sizeof(struct kernel_msghdr));
@@ -712,8 +712,9 @@ NonBrowserCrashHandler(const void* crash_context, size_t crash_context_size,
struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg);
hdr->cmsg_level = SOL_SOCKET;
hdr->cmsg_type = SCM_RIGHTS;
- hdr->cmsg_len = CMSG_LEN(sizeof(int));
- *((int*) CMSG_DATA(hdr)) = fds[1];
+ hdr->cmsg_len = CMSG_LEN(2*sizeof(int));
+ ((int*) CMSG_DATA(hdr))[0] = fds[0];
+ ((int*) CMSG_DATA(hdr))[1] = fds[1];
HANDLE_EINTR(sys_sendmsg(fd, &msg, 0));
sys_close(fds[1]);