| Index: components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc
|
| diff --git a/components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc b/components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc
|
| index 869658f9f8b4eddec6efdd545b89c966626b0440..2e002184d16142c8fdce8620fcd9937ce9170f5a 100644
|
| --- a/components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc
|
| +++ b/components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc
|
| @@ -148,18 +148,24 @@ void NaClSandbox::InitializeLayerOneSandbox() {
|
| }
|
| }
|
|
|
| -void NaClSandbox::CheckForExpectedNumberOfOpenFds() {
|
| +void NaClSandbox::CheckForExpectedNumberOfOpenFds(bool uses_nonsfi_mode) {
|
| // We expect to have the following FDs open:
|
| // 1-3) stdin, stdout, stderr.
|
| // 4) The /dev/urandom FD used by base::GetUrandomFD().
|
| // 5) A dummy pipe FD used to overwrite kSandboxIPCChannel.
|
| // 6) The socket for the Chrome IPC channel that's connected to the
|
| // browser process, kPrimaryIPCChannel.
|
| + //
|
| + // In addition, in Non-SFI mode,
|
| + // 7-8) The socketpair dedicated for FD passing over 6)'s Chrome IPC
|
| + // channel. CLIENT_MODE IPC channel needs to open them. One for the NaCl
|
| + // loader side. The other will be sent to the browser process, after the
|
| + // sandbox is engaged.
|
| // We also have an fd for /proc (proc_fd_), but CountOpenFds excludes this.
|
| //
|
| // This sanity check ensures that dynamically loaded libraries don't
|
| // leave any FDs open before we enable the sandbox.
|
| - int expected_num_fds = 6;
|
| + int expected_num_fds = uses_nonsfi_mode ? 8 : 6;
|
| if (setuid_sandbox_client_->IsSuidSandboxChild()) {
|
| // When using the setuid sandbox, there is one additional socket used for
|
| // ChrootMe(). After ChrootMe(), it is no longer connected to anything.
|
| @@ -174,7 +180,7 @@ void NaClSandbox::InitializeLayerTwoSandbox(bool uses_nonsfi_mode) {
|
| // have a single thread running here.
|
| DCHECK(!layer_one_sealed_);
|
| CHECK(IsSingleThreaded());
|
| - CheckForExpectedNumberOfOpenFds();
|
| + CheckForExpectedNumberOfOpenFds(uses_nonsfi_mode);
|
|
|
| RestrictAddressSpaceUsage();
|
|
|
|
|