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

Side by Side Diff: components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h" 5 #include "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <sys/prctl.h> 10 #include <sys/prctl.h>
11 #include <sys/stat.h> 11 #include <sys/stat.h>
12 #include <sys/types.h> 12 #include <sys/types.h>
13 #include <unistd.h> 13 #include <unistd.h>
14
15 #include <limits> 14 #include <limits>
15 #include <utility>
16 16
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/compiler_specific.h" 19 #include "base/compiler_specific.h"
20 #include "base/files/scoped_file.h" 20 #include "base/files/scoped_file.h"
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
23 #include "base/posix/eintr_wrapper.h" 23 #include "base/posix/eintr_wrapper.h"
24 #include "build/build_config.h" 24 #include "build/build_config.h"
25 #include "components/nacl/common/nacl_switches.h" 25 #include "components/nacl/common/nacl_switches.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 // Pass proc_fd_ ownership to the BPF sandbox, which guarantees it will 185 // Pass proc_fd_ ownership to the BPF sandbox, which guarantees it will
186 // be closed. There is no point in keeping it around since the BPF policy 186 // be closed. There is no point in keeping it around since the BPF policy
187 // will prevent its usage. 187 // will prevent its usage.
188 #if defined(OS_NACL_NONSFI) 188 #if defined(OS_NACL_NONSFI)
189 CHECK(uses_nonsfi_mode); 189 CHECK(uses_nonsfi_mode);
190 layer_two_enabled_ = nacl::nonsfi::InitializeBPFSandbox(std::move(proc_fd_)); 190 layer_two_enabled_ = nacl::nonsfi::InitializeBPFSandbox(std::move(proc_fd_));
191 layer_two_is_nonsfi_ = true; 191 layer_two_is_nonsfi_ = true;
192 #else 192 #else
193 CHECK(!uses_nonsfi_mode); 193 CHECK(!uses_nonsfi_mode);
194 layer_two_enabled_ = nacl::InitializeBPFSandbox(proc_fd_.Pass()); 194 layer_two_enabled_ = nacl::InitializeBPFSandbox(std::move(proc_fd_));
195 #endif 195 #endif
196 } 196 }
197 197
198 void NaClSandbox::SealLayerOneSandbox() { 198 void NaClSandbox::SealLayerOneSandbox() {
199 if (proc_fd_.is_valid() && !layer_two_enabled_) { 199 if (proc_fd_.is_valid() && !layer_two_enabled_) {
200 // If nothing prevents us, check that there is no superfluous directory 200 // If nothing prevents us, check that there is no superfluous directory
201 // open. 201 // open.
202 CHECK(!HasOpenDirectory()); 202 CHECK(!HasOpenDirectory());
203 } 203 }
204 proc_fd_.reset(); 204 proc_fd_.reset();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 static const char kNoBpfMsg[] = 237 static const char kNoBpfMsg[] =
238 "The seccomp-bpf sandbox is not engaged for NaCl:"; 238 "The seccomp-bpf sandbox is not engaged for NaCl:";
239 if (can_be_no_sandbox) 239 if (can_be_no_sandbox)
240 LOG(ERROR) << kNoBpfMsg << kItIsDangerousMsg; 240 LOG(ERROR) << kNoBpfMsg << kItIsDangerousMsg;
241 else 241 else
242 LOG(FATAL) << kNoBpfMsg << kItIsNotAllowedMsg; 242 LOG(FATAL) << kNoBpfMsg << kItIsNotAllowedMsg;
243 } 243 }
244 } 244 }
245 245
246 } // namespace nacl 246 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc ('k') | components/nacl/renderer/file_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698