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 #ifndef SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SIGSYS_HANDLERS_H_ | 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SIGSYS_HANDLERS_H_ |
6 #define SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SIGSYS_HANDLERS_H_ | 6 #define SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SIGSYS_HANDLERS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 // The handlers are suitable for use in Trap() error codes. They are | 11 // The handlers are suitable for use in Trap() error codes. They are |
12 // guaranteed to be async-signal safe. | 12 // guaranteed to be async-signal safe. |
13 // See sandbox/linux/seccomp-bpf/trap.h to see how they work. | 13 // See sandbox/linux/seccomp-bpf/trap.h to see how they work. |
14 | 14 |
15 namespace playground2 { | 15 namespace sandbox { |
| 16 |
16 struct arch_seccomp_data; | 17 struct arch_seccomp_data; |
17 } | |
18 | |
19 using playground2::arch_seccomp_data; | |
20 | |
21 namespace sandbox { | |
22 | 18 |
23 // This handler will crash the currently running process. The crashing address | 19 // This handler will crash the currently running process. The crashing address |
24 // will be the number of the current system call, extracted from |args|. | 20 // will be the number of the current system call, extracted from |args|. |
25 // This handler will also print to stderr the number of the crashing syscall. | 21 // This handler will also print to stderr the number of the crashing syscall. |
26 intptr_t CrashSIGSYS_Handler(const struct arch_seccomp_data& args, void* aux); | 22 intptr_t CrashSIGSYS_Handler(const struct arch_seccomp_data& args, void* aux); |
27 | 23 |
28 // The following three handlers are suitable to report failures with the | 24 // The following three handlers are suitable to report failures with the |
29 // clone(), prctl() and ioctl() system calls respectively. | 25 // clone(), prctl() and ioctl() system calls respectively. |
30 | 26 |
31 // The crashing address will be (clone_flags & 0xFFFFFF), where clone_flags is | 27 // The crashing address will be (clone_flags & 0xFFFFFF), where clone_flags is |
32 // the clone(2) argument, extracted from |args|. | 28 // the clone(2) argument, extracted from |args|. |
33 intptr_t SIGSYSCloneFailure(const struct arch_seccomp_data& args, void* aux); | 29 intptr_t SIGSYSCloneFailure(const struct arch_seccomp_data& args, void* aux); |
34 // The crashing address will be (option & 0xFFF), where option is the prctl(2) | 30 // The crashing address will be (option & 0xFFF), where option is the prctl(2) |
35 // argument. | 31 // argument. |
36 intptr_t SIGSYSPrctlFailure(const struct arch_seccomp_data& args, void* aux); | 32 intptr_t SIGSYSPrctlFailure(const struct arch_seccomp_data& args, void* aux); |
37 // The crashing address will be request & 0xFFFF, where request is the ioctl(2) | 33 // The crashing address will be request & 0xFFFF, where request is the ioctl(2) |
38 // argument. | 34 // argument. |
39 intptr_t SIGSYSIoctlFailure(const struct arch_seccomp_data& args, void* aux); | 35 intptr_t SIGSYSIoctlFailure(const struct arch_seccomp_data& args, void* aux); |
40 | 36 |
41 } // namespace sandbox. | 37 } // namespace sandbox. |
42 | 38 |
43 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SIGSYS_HANDLERS_H_ | 39 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SIGSYS_HANDLERS_H_ |
OLD | NEW |