Commit 58a487b7 authored by mdempsky@chromium.org's avatar mdempsky@chromium.org

Remove SandboxIPCProcess's dependency on chrome-sandbox

Now that we use RecvMsgWithPid to find the PIDs for zygote children,
we no longer need to plumb the chrome-sandbox path down into and
through the renderer host code.

BUG=357670
NOTRY=true

Review URL: https://codereview.chromium.org/276763002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269530 0039d316-1c4b-4281-b951-d872f2087c98
parent cd077070
...@@ -164,7 +164,7 @@ void SetupSandbox(const CommandLine& parsed_command_line) { ...@@ -164,7 +164,7 @@ void SetupSandbox(const CommandLine& parsed_command_line) {
} }
// Tickle the sandbox host and zygote host so they fork now. // Tickle the sandbox host and zygote host so they fork now.
RenderSandboxHostLinux::GetInstance()->Init(sandbox_binary.value()); RenderSandboxHostLinux::GetInstance()->Init();
ZygoteHostImpl::GetInstance()->Init(sandbox_binary.value()); ZygoteHostImpl::GetInstance()->Init(sandbox_binary.value());
} }
#endif #endif
......
...@@ -25,7 +25,7 @@ RenderSandboxHostLinux* RenderSandboxHostLinux::GetInstance() { ...@@ -25,7 +25,7 @@ RenderSandboxHostLinux* RenderSandboxHostLinux::GetInstance() {
return Singleton<RenderSandboxHostLinux>::get(); return Singleton<RenderSandboxHostLinux>::get();
} }
void RenderSandboxHostLinux::Init(const std::string& sandbox_path) { void RenderSandboxHostLinux::Init() {
DCHECK(!initialized_); DCHECK(!initialized_);
initialized_ = true; initialized_ = true;
...@@ -64,7 +64,7 @@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) { ...@@ -64,7 +64,7 @@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
if (IGNORE_EINTR(close(pipefds[1])) < 0) if (IGNORE_EINTR(close(pipefds[1])) < 0)
DPLOG(ERROR) << "close"; DPLOG(ERROR) << "close";
SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path); SandboxIPCProcess handler(child_lifeline_fd, browser_socket);
handler.Run(); handler.Run();
_exit(0); _exit(0);
} }
......
...@@ -31,7 +31,7 @@ class CONTENT_EXPORT RenderSandboxHostLinux { ...@@ -31,7 +31,7 @@ class CONTENT_EXPORT RenderSandboxHostLinux {
DCHECK(initialized_); DCHECK(initialized_);
return pid_; return pid_;
} }
void Init(const std::string& sandbox_path); void Init();
private: private:
friend struct DefaultSingletonTraits<RenderSandboxHostLinux>; friend struct DefaultSingletonTraits<RenderSandboxHostLinux>;
......
...@@ -129,15 +129,8 @@ static void MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) { ...@@ -129,15 +129,8 @@ static void MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) {
namespace content { namespace content {
SandboxIPCProcess::SandboxIPCProcess(int lifeline_fd, SandboxIPCProcess::SandboxIPCProcess(int lifeline_fd, int browser_socket)
int browser_socket,
std::string sandbox_cmd)
: lifeline_fd_(lifeline_fd), browser_socket_(browser_socket) { : lifeline_fd_(lifeline_fd), browser_socket_(browser_socket) {
if (!sandbox_cmd.empty()) {
sandbox_cmd_.push_back(sandbox_cmd);
sandbox_cmd_.push_back(base::kFindInodeSwitch);
}
// FontConfig doesn't provide a standard property to control subpixel // FontConfig doesn't provide a standard property to control subpixel
// positioning, so we pass the current setting through to WebKit. // positioning, so we pass the current setting through to WebKit.
WebFontInfo::setSubpixelPositioning( WebFontInfo::setSubpixelPositioning(
...@@ -220,8 +213,6 @@ void SandboxIPCProcess::HandleRequestFromRenderer(int fd) { ...@@ -220,8 +213,6 @@ void SandboxIPCProcess::HandleRequestFromRenderer(int fd) {
HandleGetFontFamilyForChar(fd, pickle, iter, fds.get()); HandleGetFontFamilyForChar(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_LOCALTIME) { } else if (kind == LinuxSandbox::METHOD_LOCALTIME) {
HandleLocaltime(fd, pickle, iter, fds.get()); HandleLocaltime(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_GET_CHILD_WITH_INODE) {
HandleGetChildWithInode(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE) { } else if (kind == LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE) {
HandleGetStyleForStrike(fd, pickle, iter, fds.get()); HandleGetStyleForStrike(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT) { } else if (kind == LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT) {
...@@ -403,41 +394,6 @@ void SandboxIPCProcess::HandleLocaltime( ...@@ -403,41 +394,6 @@ void SandboxIPCProcess::HandleLocaltime(
SendRendererReply(fds, reply, -1); SendRendererReply(fds, reply, -1);
} }
void SandboxIPCProcess::HandleGetChildWithInode(
int fd,
const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
// The other side of this call is in zygote_main_linux.cc
if (sandbox_cmd_.empty()) {
LOG(ERROR) << "Not in the sandbox, this should not be called";
return;
}
uint64_t inode;
if (!pickle.ReadUInt64(&iter, &inode))
return;
base::ProcessId pid = 0;
std::string inode_output;
std::vector<std::string> sandbox_cmd = sandbox_cmd_;
sandbox_cmd.push_back(base::Int64ToString(inode));
CommandLine get_inode_cmd(sandbox_cmd);
if (base::GetAppOutput(get_inode_cmd, &inode_output))
base::StringToInt(inode_output, &pid);
if (!pid) {
// Even though the pid is invalid, we still need to reply to the zygote
// and not just return here.
LOG(ERROR) << "Could not get pid";
}
Pickle reply;
reply.WriteInt(pid);
SendRendererReply(fds, reply, -1);
}
void SandboxIPCProcess::HandleMakeSharedMemorySegment( void SandboxIPCProcess::HandleMakeSharedMemorySegment(
int fd, int fd,
const Pickle& pickle, const Pickle& pickle,
......
...@@ -26,9 +26,7 @@ class SandboxIPCProcess { ...@@ -26,9 +26,7 @@ class SandboxIPCProcess {
// point of view of the renderer, it's talking to the browser but this // point of view of the renderer, it's talking to the browser but this
// object actually services the requests. // object actually services the requests.
// sandbox_cmd: the path of the sandbox executable. // sandbox_cmd: the path of the sandbox executable.
SandboxIPCProcess(int lifeline_fd, SandboxIPCProcess(int lifeline_fd, int browser_socket);
int browser_socket,
std::string sandbox_cmd);
~SandboxIPCProcess(); ~SandboxIPCProcess();
void Run(); void Run();
...@@ -65,11 +63,6 @@ class SandboxIPCProcess { ...@@ -65,11 +63,6 @@ class SandboxIPCProcess {
PickleIterator iter, PickleIterator iter,
const std::vector<base::ScopedFD*>& fds); const std::vector<base::ScopedFD*>& fds);
void HandleGetChildWithInode(int fd,
const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleMakeSharedMemorySegment(int fd, void HandleMakeSharedMemorySegment(int fd,
const Pickle& pickle, const Pickle& pickle,
PickleIterator iter, PickleIterator iter,
...@@ -86,7 +79,6 @@ class SandboxIPCProcess { ...@@ -86,7 +79,6 @@ class SandboxIPCProcess {
const int lifeline_fd_; const int lifeline_fd_;
const int browser_socket_; const int browser_socket_;
std::vector<std::string> sandbox_cmd_;
scoped_ptr<BlinkPlatformImpl> webkit_platform_support_; scoped_ptr<BlinkPlatformImpl> webkit_platform_support_;
SkTDArray<SkString*> paths_; SkTDArray<SkString*> paths_;
......
...@@ -30,7 +30,7 @@ class LinuxSandbox { ...@@ -30,7 +30,7 @@ class LinuxSandbox {
enum LinuxSandboxIPCMethods { enum LinuxSandboxIPCMethods {
METHOD_GET_FONT_FAMILY_FOR_CHAR = 32, METHOD_GET_FONT_FAMILY_FOR_CHAR = 32,
METHOD_LOCALTIME = 33, METHOD_LOCALTIME = 33,
METHOD_GET_CHILD_WITH_INODE = 34, DEPRECATED_METHOD_GET_CHILD_WITH_INODE = 34,
METHOD_GET_STYLE_FOR_STRIKE = 35, METHOD_GET_STYLE_FOR_STRIKE = 35,
METHOD_MAKE_SHARED_MEMORY_SEGMENT = 36, METHOD_MAKE_SHARED_MEMORY_SEGMENT = 36,
METHOD_MATCH_WITH_FALLBACK = 37, METHOD_MATCH_WITH_FALLBACK = 37,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment