| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Note: any code in this file MUST be async-signal safe. | 5 // Note: any code in this file MUST be async-signal safe. |
| 6 | 6 |
| 7 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 7 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
| 8 | 8 |
| 9 #include <sys/syscall.h> | 9 #include <sys/syscall.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 *addr = '\0'; | 181 *addr = '\0'; |
| 182 for (;;) | 182 for (;;) |
| 183 _exit(1); | 183 _exit(1); |
| 184 } | 184 } |
| 185 | 185 |
| 186 intptr_t SIGSYSKillFailure(const struct arch_seccomp_data& args, | 186 intptr_t SIGSYSKillFailure(const struct arch_seccomp_data& args, |
| 187 void* /* aux */) { | 187 void* /* aux */) { |
| 188 static const char kSeccompKillError[] = | 188 static const char kSeccompKillError[] = |
| 189 __FILE__":**CRASHING**:" SECCOMP_MESSAGE_KILL_CONTENT "\n"; | 189 __FILE__":**CRASHING**:" SECCOMP_MESSAGE_KILL_CONTENT "\n"; |
| 190 WriteToStdErr(kSeccompKillError, sizeof(kSeccompKillError) - 1); | 190 WriteToStdErr(kSeccompKillError, sizeof(kSeccompKillError) - 1); |
| 191 // Make "request" volatile so that we can see it on the stack in a minidump. | 191 // Make "pid" volatile so that we can see it on the stack in a minidump. |
| 192 volatile uint64_t pid = args.args[0]; | 192 volatile uint64_t my_pid = sys_getpid(); |
| 193 volatile char* addr = reinterpret_cast<volatile char*>(pid & 0xFFF); | 193 volatile char* addr = reinterpret_cast<volatile char*>(my_pid & 0xFFF); |
| 194 *addr = '\0'; | |
| 195 // Hit the NULL page if this fails. | |
| 196 addr = reinterpret_cast<volatile char*>(pid & 0xFFF); | |
| 197 *addr = '\0'; | 194 *addr = '\0'; |
| 198 for (;;) | 195 for (;;) |
| 199 _exit(1); | 196 _exit(1); |
| 200 } | 197 } |
| 201 | 198 |
| 202 intptr_t SIGSYSFutexFailure(const struct arch_seccomp_data& args, | 199 intptr_t SIGSYSFutexFailure(const struct arch_seccomp_data& args, |
| 203 void* /* aux */) { | 200 void* /* aux */) { |
| 204 static const char kSeccompFutexError[] = | 201 static const char kSeccompFutexError[] = |
| 205 __FILE__ ":**CRASHING**:" SECCOMP_MESSAGE_FUTEX_CONTENT "\n"; | 202 __FILE__ ":**CRASHING**:" SECCOMP_MESSAGE_FUTEX_CONTENT "\n"; |
| 206 WriteToStdErr(kSeccompFutexError, sizeof(kSeccompFutexError) - 1); | 203 WriteToStdErr(kSeccompFutexError, sizeof(kSeccompFutexError) - 1); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 288 |
| 292 const char* GetKillErrorMessageContentForTests() { | 289 const char* GetKillErrorMessageContentForTests() { |
| 293 return SECCOMP_MESSAGE_KILL_CONTENT; | 290 return SECCOMP_MESSAGE_KILL_CONTENT; |
| 294 } | 291 } |
| 295 | 292 |
| 296 const char* GetFutexErrorMessageContentForTests() { | 293 const char* GetFutexErrorMessageContentForTests() { |
| 297 return SECCOMP_MESSAGE_FUTEX_CONTENT; | 294 return SECCOMP_MESSAGE_FUTEX_CONTENT; |
| 298 } | 295 } |
| 299 | 296 |
| 300 } // namespace sandbox. | 297 } // namespace sandbox. |
| OLD | NEW |