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 56b30480ca
commit 2d6844764c
2 changed files with 3 additions and 18 deletions

View File

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

View File

@ -102,7 +102,7 @@ SandboxFilterImpl::Build() {
* How are those syscalls found?
* 1) via strace -p <child pid> or/and
* 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:
* bionic/libc/kernel/arch-arm/asm/unistd.h
* or your libc's unistd.h/kernel headers.