| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_COMMON_SECCOMP_SANDBOX_H_ | 5 #ifndef CONTENT_COMMON_SECCOMP_SANDBOX_H_ |
| 6 #define CONTENT_COMMON_SECCOMP_SANDBOX_H_ | 6 #define CONTENT_COMMON_SECCOMP_SANDBOX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // Seccomp enable/disable logic is centralized here. | 9 // Seccomp enable/disable logic is centralized here. |
| 10 // - We define SECCOMP_SANDBOX if seccomp is compiled in at all: currently, | 10 // - We define SECCOMP_SANDBOX if seccomp is compiled in at all: currently, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #define SECCOMP_SANDBOX | 22 #define SECCOMP_SANDBOX |
| 23 #include "seccompsandbox/sandbox.h" | 23 #include "seccompsandbox/sandbox.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 #if defined(SECCOMP_SANDBOX) | 26 #if defined(SECCOMP_SANDBOX) |
| 27 // Return true if seccomp is enabled. | 27 // Return true if seccomp is enabled. |
| 28 static bool SeccompSandboxEnabled() { | 28 static bool SeccompSandboxEnabled() { |
| 29 // TODO(evan): turn on for release too once we've flushed out all the bugs, | 29 // TODO(evan): turn on for release too once we've flushed out all the bugs, |
| 30 // allowing us to delete this file entirely and just rely on the "disabled" | 30 // allowing us to delete this file entirely and just rely on the "disabled" |
| 31 // switch. | 31 // switch. |
| 32 #ifdef NDEBUG |
| 33 // Off by default; allow turning on with a switch. |
| 32 return CommandLine::ForCurrentProcess()->HasSwitch( | 34 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 33 switches::kEnableSeccompSandbox) && | 35 switches::kEnableSeccompSandbox); |
| 34 !CommandLine::ForCurrentProcess()->HasSwitch( | 36 #else |
| 35 switches::kDisableSeccompSandbox); | 37 // On by default; allow turning off with a switch. |
| 38 return !CommandLine::ForCurrentProcess()->HasSwitch( |
| 39 switches::kDisableSeccompSandbox); |
| 40 #endif // NDEBUG |
| 36 } | 41 } |
| 37 #endif | 42 #endif // SECCOMP_SANDBOX |
| 38 | 43 |
| 39 #endif // CONTENT_COMMON_SECCOMP_SANDBOX_H_ | 44 #endif // CONTENT_COMMON_SECCOMP_SANDBOX_H_ |
| OLD | NEW |