summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 06:50:53 +0000
committerhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 06:50:53 +0000
commitc4ba2a08baa6cf85dafc3c8dc613e7a961cbe34d (patch)
tree6862f4e19a9b9d701572a1b189622384ebc879ff
parentd550cb07beb93fdaf8ba9cee02dc81fa72df8d0f (diff)
downloadchromium_src-c4ba2a08baa6cf85dafc3c8dc613e7a961cbe34d.zip
chromium_src-c4ba2a08baa6cf85dafc3c8dc613e7a961cbe34d.tar.gz
chromium_src-c4ba2a08baa6cf85dafc3c8dc613e7a961cbe34d.tar.bz2
Quick fix of namespace syntax error for compile without USE_SECCOMP_BPF.
nacl_bpf_sandbox_linux.cc has a syntax error if USE_SECCOMP_BPF is not defined. This CL fixes it. BUG=n/a TEST=Compile the file without defining USE_SECCOMP_BPF Review URL: https://codereview.chromium.org/343193004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279642 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc33
1 files changed, 18 insertions, 15 deletions
diff --git a/components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc b/components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc
index 73adfd3..af3b3f1 100644
--- a/components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc
+++ b/components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc
@@ -4,6 +4,10 @@
#include "components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.h"
+#include "build/build_config.h"
+
+#if defined(USE_SECCOMP_BPF)
+
#include <errno.h>
#include <signal.h>
#include <sys/ptrace.h>
@@ -12,37 +16,36 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
-#include "build/build_config.h"
-#if defined(USE_SECCOMP_BPF)
#include "content/public/common/sandbox_init.h"
#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
#include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h"
#include "sandbox/linux/services/linux_syscalls.h"
-using sandbox::ErrorCode;
-using sandbox::SandboxBPF;
-using sandbox::SandboxBPFPolicy;
+#endif // defined(USE_SECCOMP_BPF)
namespace nacl {
+#if defined(USE_SECCOMP_BPF)
+
namespace {
-class NaClBPFSandboxPolicy : public SandboxBPFPolicy {
+class NaClBPFSandboxPolicy : public sandbox::SandboxBPFPolicy {
public:
NaClBPFSandboxPolicy()
: baseline_policy_(content::GetBPFSandboxBaselinePolicy()) {}
virtual ~NaClBPFSandboxPolicy() {}
- virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox_compiler,
- int system_call_number) const OVERRIDE;
+ virtual sandbox::ErrorCode EvaluateSyscall(
+ sandbox::SandboxBPF* sandbox_compiler,
+ int system_call_number) const OVERRIDE;
private:
- scoped_ptr<SandboxBPFPolicy> baseline_policy_;
+ scoped_ptr<sandbox::SandboxBPFPolicy> baseline_policy_;
DISALLOW_COPY_AND_ASSIGN(NaClBPFSandboxPolicy);
};
-ErrorCode NaClBPFSandboxPolicy::EvaluateSyscall(
+sandbox::ErrorCode NaClBPFSandboxPolicy::EvaluateSyscall(
sandbox::SandboxBPF* sb, int sysno) const {
DCHECK(baseline_policy_);
switch (sysno) {
@@ -92,16 +95,16 @@ ErrorCode NaClBPFSandboxPolicy::EvaluateSyscall(
// See crbug.com/264856 for details.
case __NR_times:
case __NR_uname:
- return ErrorCode(ErrorCode::ERR_ALLOWED);
+ return sandbox::ErrorCode(sandbox::ErrorCode::ERR_ALLOWED);
case __NR_ioctl:
case __NR_ptrace:
- return ErrorCode(EPERM);
+ return sandbox::ErrorCode(EPERM);
default:
return baseline_policy_->EvaluateSyscall(sb, sysno);
}
NOTREACHED();
// GCC wants this.
- return ErrorCode(EPERM);
+ return sandbox::ErrorCode(EPERM);
}
void RunSandboxSanityChecks() {
@@ -119,14 +122,14 @@ void RunSandboxSanityChecks() {
#if !defined(ARCH_CPU_MIPS_FAMILY)
#error "Seccomp-bpf disabled on supported architecture!"
-#endif
+#endif // !defined(ARCH_CPU_MIPS_FAMILY)
#endif // defined(USE_SECCOMP_BPF)
bool InitializeBPFSandbox() {
#if defined(USE_SECCOMP_BPF)
bool sandbox_is_initialized = content::InitializeSandbox(
- scoped_ptr<SandboxBPFPolicy>(new NaClBPFSandboxPolicy()));
+ scoped_ptr<sandbox::SandboxBPFPolicy>(new NaClBPFSandboxPolicy));
if (sandbox_is_initialized) {
RunSandboxSanityChecks();
return true;