Commit fdadd6a8 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Migrate to OS_MAC and OS_APPLE in sandbox

Bug: 1105907
Change-Id: Ic29ebc9a008b0ef4ac64a639150ed99b62222988
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2325094Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792718}
parent 1dd9c248
......@@ -10,12 +10,12 @@ namespace sandbox {
namespace policy {
namespace features {
#if !defined(OS_MACOSX)
#if !defined(OS_MAC)
// Enables network service sandbox.
// (Only causes an effect when feature kNetworkService is enabled.)
const base::Feature kNetworkServiceSandbox{"NetworkServiceSandbox",
base::FEATURE_DISABLED_BY_DEFAULT};
#endif // !defined(OS_MACOSX)
#endif // !defined(OS_MAC)
#if defined(OS_WIN)
// Emergency "off switch" for new Windows sandbox security mitigation,
......
......@@ -16,7 +16,7 @@ namespace sandbox {
namespace policy {
namespace features {
#if !defined(OS_MACOSX)
#if !defined(OS_MAC)
SANDBOX_POLICY_EXPORT extern const base::Feature kNetworkServiceSandbox;
#endif
......
......@@ -16,10 +16,10 @@
#include "sandbox/policy/linux/sandbox_linux.h"
#endif // defined(OS_LINUX)
#if defined(OS_MACOSX)
#if defined(OS_MAC)
#include "sandbox/mac/seatbelt.h"
#include "sandbox/policy/mac/sandbox_mac.h"
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
#if defined(OS_WIN)
#include "base/process/process_info.h"
......@@ -39,7 +39,7 @@ bool Sandbox::Initialize(SandboxType sandbox_type,
}
#endif // defined(OS_LINUX)
#if defined(OS_MACOSX)
#if defined(OS_MAC)
bool Sandbox::Initialize(SandboxType sandbox_type, base::OnceClosure hook) {
// Warm up APIs before turning on the sandbox.
SandboxMac::Warmup(sandbox_type);
......@@ -51,7 +51,7 @@ bool Sandbox::Initialize(SandboxType sandbox_type, base::OnceClosure hook) {
// Actually sandbox the process.
return SandboxMac::Enable(sandbox_type);
}
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
#if defined(OS_WIN)
bool Sandbox::Initialize(SandboxType sandbox_type,
......@@ -115,7 +115,7 @@ bool Sandbox::IsProcessSandboxed() {
constexpr int kLayer2Flags =
SandboxLinux::Status::kSeccompBPF | SandboxLinux::Status::kSeccompTSYNC;
return (status & kLayer1Flags) != 0 && (status & kLayer2Flags) != 0;
#elif defined(OS_MACOSX)
#elif defined(OS_MAC)
return Seatbelt::IsSandboxed();
#elif defined(OS_WIN)
return base::GetCurrentProcessIntegrityLevel() < base::MEDIUM_INTEGRITY;
......
......@@ -13,9 +13,9 @@
#include "sandbox/policy/linux/sandbox_linux.h"
#endif
#if defined(OS_MACOSX)
#if defined(OS_MAC)
#include "base/callback.h"
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
namespace sandbox {
struct SandboxInterfaceInfo;
......@@ -40,13 +40,13 @@ class SANDBOX_POLICY_EXPORT Sandbox {
const SandboxLinux::Options& options);
#endif // defined(OS_LINUX)
#if defined(OS_MACOSX)
#if defined(OS_MAC)
// Initialize the sandbox of |sandbox_type|. Runs |post_warmup_hook| if
// non-empty after performing any sandbox warmup but immediately before
// engaging the sandbox. Return true on success, false otherwise.
static bool Initialize(SandboxType sandbox_type,
base::OnceClosure post_warmup_hook);
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
#if defined(OS_WIN)
static bool Initialize(SandboxType sandbox_type,
......
......@@ -39,11 +39,11 @@ bool IsUnsandboxedSandboxType(SandboxType sandbox_type) {
return true;
#endif
case SandboxType::kNetwork:
#if defined(OS_MACOSX)
#if defined(OS_MAC)
return false;
#else
return !base::FeatureList::IsEnabled(features::kNetworkServiceSandbox);
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
case SandboxType::kRenderer:
case SandboxType::kUtility:
case SandboxType::kGpu:
......@@ -53,14 +53,14 @@ bool IsUnsandboxedSandboxType(SandboxType sandbox_type) {
#if defined(OS_FUCHSIA)
case SandboxType::kWebContext:
#endif
#if defined(OS_MACOSX)
#if defined(OS_MAC)
case SandboxType::kNaClLoader:
#endif
#if defined(OS_CHROMEOS)
case SandboxType::kIme:
case SandboxType::kTts:
#endif
#if !defined(OS_MACOSX)
#if !defined(OS_MAC)
case SandboxType::kSharingService:
#endif
#if defined(OS_LINUX)
......@@ -129,7 +129,7 @@ void SetCommandLineFlagsForSandboxType(base::CommandLine* command_line,
case SandboxType::kIme:
case SandboxType::kTts:
#endif // defined(OS_CHROMEOS)
#if !defined(OS_MACOSX)
#if !defined(OS_MAC)
case SandboxType::kSharingService:
#endif
case SandboxType::kSpeechRecognition:
......@@ -145,10 +145,10 @@ void SetCommandLineFlagsForSandboxType(base::CommandLine* command_line,
case SandboxType::kWebContext:
break;
#endif // defined(OS_FUCHSIA)
#if defined(OS_MACOSX)
#if defined(OS_MAC)
case SandboxType::kNaClLoader:
break;
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
#if defined(OS_LINUX)
case SandboxType::kZygoteIntermediateSandbox:
break;
......@@ -190,7 +190,7 @@ SandboxType SandboxTypeFromCommandLine(const base::CommandLine& command_line) {
// NaCl tests on all platforms use the loader process.
if (process_type == switches::kNaClLoaderProcess) {
#if defined(OS_MACOSX)
#if defined(OS_MAC)
return SandboxType::kNaClLoader;
#else
return SandboxType::kUtility;
......@@ -234,7 +234,7 @@ std::string StringFromUtilitySandboxType(SandboxType sandbox_type) {
return switches::kAudioSandbox;
case SandboxType::kVideoCapture:
return switches::kVideoCaptureSandbox;
#if !defined(OS_MACOSX)
#if !defined(OS_MAC)
case SandboxType::kSharingService:
return switches::kSharingServiceSandbox;
#endif
......@@ -262,9 +262,9 @@ std::string StringFromUtilitySandboxType(SandboxType sandbox_type) {
#if defined(OS_WIN)
case SandboxType::kNoSandboxAndElevatedPrivileges:
#endif // defined(OS_WIN)
#if defined(OS_MACOSX)
#if defined(OS_MAC)
case SandboxType::kNaClLoader:
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
#if defined(OS_FUCHSIA)
case SandboxType::kWebContext:
#endif // defined(OS_FUCHSIA)
......
......@@ -60,10 +60,10 @@ enum class SandboxType {
// The CDM service process.
kCdm,
#if defined(OS_MACOSX)
#if defined(OS_MAC)
// The NaCl loader process.
kNaClLoader,
#endif // defined(OS_MACOSX)
#endif // defined(OS_MAC)
// The print compositor service process.
kPrintCompositor,
......@@ -82,7 +82,7 @@ enum class SandboxType {
kZygoteIntermediateSandbox,
#endif
#if !defined(OS_MACOSX)
#if !defined(OS_MAC)
// Hosts WebRTC for Sharing Service, uses kUtility on OS_MACOSX.
kSharingService,
#endif
......
......@@ -102,7 +102,7 @@ const char kNoSandboxAndElevatedPrivileges[] = "no-sandbox-and-elevated";
const char kAddXrAppContainerCaps[] = "add-xr-appcontainer-caps";
#endif
#if defined(OS_MACOSX)
#if defined(OS_MAC)
// Cause the OS X sandbox write to syslog every time an access to a resource
// is denied by the sandbox.
const char kEnableSandboxLogging[] = "enable-sandbox-logging";
......
......@@ -62,7 +62,7 @@ SANDBOX_POLICY_EXPORT extern const char kAddGpuAppContainerCaps[];
SANDBOX_POLICY_EXPORT extern const char kNoSandboxAndElevatedPrivileges[];
SANDBOX_POLICY_EXPORT extern const char kAddXrAppContainerCaps[];
#endif
#if defined(OS_MACOSX)
#if defined(OS_MAC)
SANDBOX_POLICY_EXPORT extern const char kEnableSandboxLogging[];
#endif
......
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