Bug 1046541 - Use stdio for non-Android Linux sandbox error messages. r=kang

--HG--
extra : rebase_source : e93a4a76f8188d715886e263a366d694c28b4525
This commit is contained in:
Jed Davis 2014-08-04 15:11:04 -07:00
parent 1d729bea82
commit 54f805e8b9
2 changed files with 3 additions and 18 deletions

View File

@ -26,6 +26,7 @@
#include "mozilla/dom/Exceptions.h" #include "mozilla/dom/Exceptions.h"
#include "nsString.h" #include "nsString.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "prenv.h"
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h" #include "nsExceptionHandler.h"
@ -41,23 +42,14 @@
#include "SandboxFilter.h" #include "SandboxFilter.h"
#endif #endif
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG 1
#endif
#include "prlog.h"
#include "prenv.h"
// See definition of SandboxDie, below. // See definition of SandboxDie, below.
#include "sandbox/linux/seccomp-bpf/die.h" #include "sandbox/linux/seccomp-bpf/die.h"
namespace mozilla { namespace mozilla {
#if defined(ANDROID) #if defined(ANDROID)
#define LOG_ERROR(args...) __android_log_print(ANDROID_LOG_ERROR, "Sandbox", ## args) #define LOG_ERROR(args...) __android_log_print(ANDROID_LOG_ERROR, "Sandbox", ## args)
#elif defined(PR_LOGGING)
static PRLogModuleInfo* gSeccompSandboxLog;
#define LOG_ERROR(args...) PR_LOG(mozilla::gSeccompSandboxLog, PR_LOG_ERROR, (args))
#else #else
#define LOG_ERROR(args...) #define LOG_ERROR(fmt, args...) fprintf(stderr, "Sandbox: " fmt, ## args)
#endif #endif
/** /**
@ -434,13 +426,6 @@ IsSandboxingSupported(void)
void void
SetCurrentProcessSandbox() SetCurrentProcessSandbox()
{ {
#if !defined(ANDROID) && defined(PR_LOGGING)
if (!gSeccompSandboxLog) {
gSeccompSandboxLog = PR_NewLogModule("SeccompSandbox");
}
PR_ASSERT(gSeccompSandboxLog);
#endif
if (InstallSyscallReporter()) { if (InstallSyscallReporter()) {
LOG_ERROR("install_syscall_reporter() failed\n"); LOG_ERROR("install_syscall_reporter() failed\n");
} }

View File

@ -102,7 +102,7 @@ SandboxFilterImpl::Build() {
* How are those syscalls found? * How are those syscalls found?
* 1) via strace -p <child pid> or/and * 1) via strace -p <child pid> or/and
* 2) the child will report which system call has been denied by seccomp-bpf, * 2) the child will report which system call has been denied by seccomp-bpf,
* just before exiting, via NSPR or Android logging. * just before exiting
* System call number to name mapping is found in: * System call number to name mapping is found in:
* bionic/libc/kernel/arch-arm/asm/unistd.h * bionic/libc/kernel/arch-arm/asm/unistd.h
* or your libc's unistd.h/kernel headers. * or your libc's unistd.h/kernel headers.