Commit abc48df4 authored by Greg Kerr's avatar Greg Kerr Committed by Commit Bot

macOS V2 Sandbox: Report correct sandbox profile for nacl-loader.

The nacl loader process, used only on macOS, currently tries to load an
invalid profile type under the V2 sandbox. This loads the correct type.
This also adds necessary IOKit resource access to the nacl sandbox profile.

Bug: 892554
Change-Id: I3118c00a17502efdd88545ef35e81e3a480d2f15
Reviewed-on: https://chromium-review.googlesource.com/c/1289070Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarDerek Schuff <dschuff@chromium.org>
Commit-Queue: Greg Kerr <kerrnel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601244}
parent bae194e3
...@@ -9,6 +9,7 @@ include_rules = [ ...@@ -9,6 +9,7 @@ include_rules = [
"+sandbox/linux/services", "+sandbox/linux/services",
"+sandbox/linux/suid", "+sandbox/linux/suid",
"+sandbox/linux/system_headers", "+sandbox/linux/system_headers",
"+sandbox/mac",
"+sandbox/sandbox_buildflags.h", "+sandbox/sandbox_buildflags.h",
"+sandbox/win/src", "+sandbox/win/src",
"+services/service_manager/sandbox", "+services/service_manager/sandbox",
......
...@@ -6,13 +6,22 @@ ...@@ -6,13 +6,22 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "components/nacl/common/nacl_switches.h" #include "components/nacl/common/nacl_switches.h"
#include "content/public/common/sandbox_init.h" #include "content/public/common/sandbox_init.h"
#include "sandbox/mac/seatbelt.h"
#include "sandbox/mac/seatbelt_exec.h"
#include "services/service_manager/sandbox/sandbox_type.h" #include "services/service_manager/sandbox/sandbox_type.h"
void NaClMainPlatformDelegate::EnableSandbox( void NaClMainPlatformDelegate::EnableSandbox(
const content::MainFunctionParams& parameters) { const content::MainFunctionParams& parameters) {
CHECK(content::InitializeSandbox(service_manager::SANDBOX_TYPE_NACL_LOADER)) if (base::CommandLine::ForCurrentProcess()->HasSwitch(
<< "Error initializing sandbox for " << switches::kNaClLoaderProcess; sandbox::switches::kSeatbeltClientName)) {
// Make sure the sandbox is actually enabled if the V2 flag is present.
CHECK(sandbox::Seatbelt::IsSandboxed());
} else {
CHECK(content::InitializeSandbox(service_manager::SANDBOX_TYPE_NACL_LOADER))
<< "Error initializing sandbox for " << switches::kNaClLoaderProcess;
}
} }
...@@ -12,3 +12,10 @@ ...@@ -12,3 +12,10 @@
; Allow a Native Client application to use semaphores, specifically ; Allow a Native Client application to use semaphores, specifically
; sem_init(), et.al. ; sem_init(), et.al.
(allow ipc-posix-sem) (allow ipc-posix-sem)
(allow iokit-get-properties
(iokit-registry-entry-class "IORegisterForSystemPower"))
(allow iokit-open
(iokit-user-client-class "IOSurfaceSendRight")
(iokit-user-client-class "RootDomainUserClient"))
...@@ -126,6 +126,11 @@ SandboxType SandboxTypeFromCommandLine(const base::CommandLine& command_line) { ...@@ -126,6 +126,11 @@ SandboxType SandboxTypeFromCommandLine(const base::CommandLine& command_line) {
if (process_type == switches::kPpapiPluginProcess) if (process_type == switches::kPpapiPluginProcess)
return SANDBOX_TYPE_PPAPI; return SANDBOX_TYPE_PPAPI;
#if defined(OS_MACOSX)
if (process_type == switches::kNaClLoaderProcess)
return SANDBOX_TYPE_NACL_LOADER;
#endif
// This is a process which we don't know about. // This is a process which we don't know about.
return SANDBOX_TYPE_INVALID; return SANDBOX_TYPE_INVALID;
} }
......
...@@ -107,6 +107,7 @@ const char kEnableSandboxLogging[] = "enable-sandbox-logging"; ...@@ -107,6 +107,7 @@ const char kEnableSandboxLogging[] = "enable-sandbox-logging";
// Flags spied upon from other layers. // Flags spied upon from other layers.
const char kGpuProcess[] = "gpu-process"; const char kGpuProcess[] = "gpu-process";
const char kNaClLoaderProcess[] = "nacl-loader";
const char kPpapiBrokerProcess[] = "ppapi-broker"; const char kPpapiBrokerProcess[] = "ppapi-broker";
const char kPpapiPluginProcess[] = "ppapi"; const char kPpapiPluginProcess[] = "ppapi";
const char kRendererProcess[] = "renderer"; const char kRendererProcess[] = "renderer";
......
...@@ -59,6 +59,7 @@ SERVICE_MANAGER_SANDBOX_EXPORT extern const char kEnableSandboxLogging[]; ...@@ -59,6 +59,7 @@ SERVICE_MANAGER_SANDBOX_EXPORT extern const char kEnableSandboxLogging[];
// Flags spied upon from other layers. // Flags spied upon from other layers.
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kGpuProcess[]; SERVICE_MANAGER_SANDBOX_EXPORT extern const char kGpuProcess[];
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kNaClLoaderProcess[];
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kPpapiBrokerProcess[]; SERVICE_MANAGER_SANDBOX_EXPORT extern const char kPpapiBrokerProcess[];
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kPpapiPluginProcess[]; SERVICE_MANAGER_SANDBOX_EXPORT extern const char kPpapiPluginProcess[];
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kRendererProcess[]; SERVICE_MANAGER_SANDBOX_EXPORT extern const char kRendererProcess[];
......
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