| Index: sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
|
| diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
|
| index 4cefa4cca236d2d6e584b44dc35f147e9347db1a..47c99892996bd755904efd262232f3a393bf1ddb 100644
|
| --- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
|
| +++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
|
| @@ -13,6 +13,11 @@
|
| #include "build/build_config.h"
|
| #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
|
|
|
| +#define SECCOMP_MESSAGE_COMMON_CONTENT "seccomp-bpf failure"
|
| +#define SECCOMP_MESSAGE_CLONE_CONTENT "clone() failure"
|
| +#define SECCOMP_MESSAGE_PRCTL_CONTENT "prctl() failure"
|
| +#define SECCOMP_MESSAGE_IOCTL_CONTENT "ioctl() failure"
|
| +
|
| namespace {
|
|
|
| inline bool IsArchitectureX86_64() {
|
| @@ -54,7 +59,7 @@ void PrintSyscallError(uint32_t sysno) {
|
| sysno_base10[i] = '0' + mod;
|
| }
|
| static const char kSeccompErrorPrefix[] =
|
| - __FILE__":**CRASHING**:seccomp-bpf failure in syscall ";
|
| + __FILE__":**CRASHING**:" SECCOMP_MESSAGE_COMMON_CONTENT " in syscall ";
|
| static const char kSeccompErrorPostfix[] = "\n";
|
| WriteToStdErr(kSeccompErrorPrefix, sizeof(kSeccompErrorPrefix) - 1);
|
| WriteToStdErr(sysno_base10, sizeof(sysno_base10));
|
| @@ -95,7 +100,7 @@ intptr_t CrashSIGSYS_Handler(const struct arch_seccomp_data& args, void* aux) {
|
|
|
| intptr_t SIGSYSCloneFailure(const struct arch_seccomp_data& args, void* aux) {
|
| static const char kSeccompCloneError[] =
|
| - __FILE__":**CRASHING**:clone() failure\n";
|
| + __FILE__":**CRASHING**:" SECCOMP_MESSAGE_CLONE_CONTENT "\n";
|
| WriteToStdErr(kSeccompCloneError, sizeof(kSeccompCloneError) - 1);
|
| // "flags" is the first argument in the kernel's clone().
|
| // Mark as volatile to be able to find the value on the stack in a minidump.
|
| @@ -115,7 +120,7 @@ intptr_t SIGSYSCloneFailure(const struct arch_seccomp_data& args, void* aux) {
|
| intptr_t SIGSYSPrctlFailure(const struct arch_seccomp_data& args,
|
| void* /* aux */) {
|
| static const char kSeccompPrctlError[] =
|
| - __FILE__":**CRASHING**:prctl() failure\n";
|
| + __FILE__":**CRASHING**:" SECCOMP_MESSAGE_PRCTL_CONTENT "\n";
|
| WriteToStdErr(kSeccompPrctlError, sizeof(kSeccompPrctlError) - 1);
|
| // Mark as volatile to be able to find the value on the stack in a minidump.
|
| volatile uint64_t option = args.args[0];
|
| @@ -129,7 +134,7 @@ intptr_t SIGSYSPrctlFailure(const struct arch_seccomp_data& args,
|
| intptr_t SIGSYSIoctlFailure(const struct arch_seccomp_data& args,
|
| void* /* aux */) {
|
| static const char kSeccompIoctlError[] =
|
| - __FILE__":**CRASHING**:ioctl() failure\n";
|
| + __FILE__":**CRASHING**:" SECCOMP_MESSAGE_IOCTL_CONTENT "\n";
|
| WriteToStdErr(kSeccompIoctlError, sizeof(kSeccompIoctlError) - 1);
|
| // Make "request" volatile so that we can see it on the stack in a minidump.
|
| volatile uint64_t request = args.args[1];
|
| @@ -142,4 +147,20 @@ intptr_t SIGSYSIoctlFailure(const struct arch_seccomp_data& args,
|
| _exit(1);
|
| }
|
|
|
| +const char* GetErrorMessageContentForTests() {
|
| + return SECCOMP_MESSAGE_COMMON_CONTENT;
|
| +}
|
| +
|
| +const char* GetCloneErrorMessageContentForTests() {
|
| + return SECCOMP_MESSAGE_CLONE_CONTENT;
|
| +}
|
| +
|
| +const char* GetPrctlErrorMessageContentForTests() {
|
| + return SECCOMP_MESSAGE_PRCTL_CONTENT;
|
| +}
|
| +
|
| +const char* GetIoctlErrorMessageContentForTests() {
|
| + return SECCOMP_MESSAGE_IOCTL_CONTENT;
|
| +}
|
| +
|
| } // namespace sandbox.
|
|
|