OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "sandbox/linux/seccomp-bpf/trap.h" | 5 #include "sandbox/linux/seccomp-bpf/trap.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/prctl.h> | 10 #include <sys/prctl.h> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 bool IsDefaultSignalAction(const struct sigaction& sa) { | 59 bool IsDefaultSignalAction(const struct sigaction& sa) { |
60 if (sa.sa_flags & SA_SIGINFO || sa.sa_handler != SIG_DFL) { | 60 if (sa.sa_flags & SA_SIGINFO || sa.sa_handler != SIG_DFL) { |
61 return false; | 61 return false; |
62 } | 62 } |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 namespace playground2 { | 68 namespace sandbox { |
69 | 69 |
70 Trap::Trap() | 70 Trap::Trap() |
71 : trap_array_(NULL), | 71 : trap_array_(NULL), |
72 trap_array_size_(0), | 72 trap_array_size_(0), |
73 trap_array_capacity_(0), | 73 trap_array_capacity_(0), |
74 has_unsafe_traps_(false) { | 74 has_unsafe_traps_(false) { |
75 // Set new SIGSYS handler | 75 // Set new SIGSYS handler |
76 struct sigaction sa = {}; | 76 struct sigaction sa = {}; |
77 sa.sa_sigaction = SigSysAction; | 77 sa.sa_sigaction = SigSysAction; |
78 sa.sa_flags = SA_SIGINFO | SA_NODEFER; | 78 sa.sa_flags = SA_SIGINFO | SA_NODEFER; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 ErrorCode Trap::ErrorCodeFromTrapId(uint16_t id) { | 344 ErrorCode Trap::ErrorCodeFromTrapId(uint16_t id) { |
345 if (global_trap_ && id > 0 && id <= global_trap_->trap_array_size_) { | 345 if (global_trap_ && id > 0 && id <= global_trap_->trap_array_size_) { |
346 return global_trap_->trap_array_[id - 1]; | 346 return global_trap_->trap_array_[id - 1]; |
347 } else { | 347 } else { |
348 return ErrorCode(); | 348 return ErrorCode(); |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 Trap* Trap::global_trap_; | 352 Trap* Trap::global_trap_; |
353 | 353 |
354 } // namespace playground2 | 354 } // namespace sandbox |
OLD | NEW |