Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: content/zygote/zygote_linux.cc

Issue 11108019: linux: Crash browser on too-big messages to zygote. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update CHECKs Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/zygote_commands_linux.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/zygote/zygote_linux.h" 5 #include "content/zygote/zygote_linux.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <string.h> 8 #include <string.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 return true; 121 return true;
122 } 122 }
123 } 123 }
124 124
125 bool Zygote::UsingSUIDSandbox() const { 125 bool Zygote::UsingSUIDSandbox() const {
126 return sandbox_flags_ & kSandboxLinuxSUID; 126 return sandbox_flags_ & kSandboxLinuxSUID;
127 } 127 }
128 128
129 bool Zygote::HandleRequestFromBrowser(int fd) { 129 bool Zygote::HandleRequestFromBrowser(int fd) {
130 std::vector<int> fds; 130 std::vector<int> fds;
131 static const unsigned kMaxMessageLength = 2048; 131 char buf[kZygoteMaxMessageLength];
132 char buf[kMaxMessageLength];
133 const ssize_t len = UnixDomainSocket::RecvMsg(fd, buf, sizeof(buf), &fds); 132 const ssize_t len = UnixDomainSocket::RecvMsg(fd, buf, sizeof(buf), &fds);
134 133
135 if (len == 0 || (len == -1 && errno == ECONNRESET)) { 134 if (len == 0 || (len == -1 && errno == ECONNRESET)) {
136 // EOF from the browser. We should die. 135 // EOF from the browser. We should die.
137 _exit(0); 136 _exit(0);
138 return false; 137 return false;
139 } 138 }
140 139
141 if (len == -1) { 140 if (len == -1) {
142 PLOG(ERROR) << "Error reading message from browser"; 141 PLOG(ERROR) << "Error reading message from browser";
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 PickleIterator iter) { 490 PickleIterator iter) {
492 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != 491 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) !=
493 sizeof(sandbox_flags_)) { 492 sizeof(sandbox_flags_)) {
494 PLOG(ERROR) << "write"; 493 PLOG(ERROR) << "write";
495 } 494 }
496 495
497 return false; 496 return false;
498 } 497 }
499 498
500 } // namespace content 499 } // namespace content
OLDNEW
« no previous file with comments | « content/common/zygote_commands_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698