| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 DCHECK_NE(exception_port_, kMachPortNull); | 181 DCHECK_NE(exception_port_, kMachPortNull); |
| 182 | 182 |
| 183 // Set the exception handler for EXC_CRASH, EXC_RESOURCE, and EXC_GUARD. | 183 // Set the exception handler for EXC_CRASH, EXC_RESOURCE, and EXC_GUARD. |
| 184 // | 184 // |
| 185 // EXC_CRASH is how most crashes are received. Most other exception types such | 185 // EXC_CRASH is how most crashes are received. Most other exception types such |
| 186 // as EXC_BAD_ACCESS are delivered to a host-level exception handler in the | 186 // as EXC_BAD_ACCESS are delivered to a host-level exception handler in the |
| 187 // kernel where they are converted to POSIX signals. See 10.9.5 | 187 // kernel where they are converted to POSIX signals. See 10.9.5 |
| 188 // xnu-2422.115.4/bsd/uxkern/ux_exception.c catch_mach_exception_raise(). If a | 188 // xnu-2422.115.4/bsd/uxkern/ux_exception.c catch_mach_exception_raise(). If a |
| 189 // core-generating signal (triggered through this hardware mechanism or a | 189 // core-generating signal (triggered through this hardware mechanism or a |
| 190 // software mechanism such as abort() sending SIGABRT) is unhandled and the | 190 // software mechanism such as abort() sending SIGABRT) is unhandled and the |
| 191 // process exits, the exception becomes EXC_CRASH. See 10.9.5 | 191 // process exits, or if the process is killed with SIGKILL for code-signing |
| 192 // reasons, an EXC_CRASH exception will be sent. See 10.9.5 |
| 192 // xnu-2422.115.4/bsd/kern/kern_exit.c proc_prepareexit(). | 193 // xnu-2422.115.4/bsd/kern/kern_exit.c proc_prepareexit(). |
| 193 // | 194 // |
| 194 // EXC_RESOURCE and EXC_GUARD do not become signals or EXC_CRASH exceptions. | 195 // EXC_RESOURCE and EXC_GUARD do not become signals or EXC_CRASH exceptions. |
| 195 // The host-level exception handler in the kernel does not receive these | 196 // The host-level exception handler in the kernel does not receive these |
| 196 // exception types, and even if it did, it would not map them to signals. | 197 // exception types, and even if it did, it would not map them to signals. |
| 197 // Instead, the first Mach service loaded by the root (process ID 1) launchd | 198 // Instead, the first Mach service loaded by the root (process ID 1) launchd |
| 198 // with a boolean “ExceptionServer” property in its job dictionary (regardless | 199 // with a boolean “ExceptionServer” property in its job dictionary (regardless |
| 199 // of its value) or with any subdictionary property will become the host-level | 200 // of its value) or with any subdictionary property will become the host-level |
| 200 // exception handler for EXC_CRASH, EXC_RESOURCE, and EXC_GUARD. See 10.9.5 | 201 // exception handler for EXC_CRASH, EXC_RESOURCE, and EXC_GUARD. See 10.9.5 |
| 201 // launchd-842.92.1/src/core.c job_setup_exception_port(). Normally, this job | 202 // launchd-842.92.1/src/core.c job_setup_exception_port(). Normally, this job |
| (...skipping 15 matching lines...) Expand all Loading... |
| 217 exception_port_, | 218 exception_port_, |
| 218 EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, | 219 EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, |
| 219 MACHINE_THREAD_STATE)) { | 220 MACHINE_THREAD_STATE)) { |
| 220 return false; | 221 return false; |
| 221 } | 222 } |
| 222 | 223 |
| 223 return true; | 224 return true; |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace crashpad | 227 } // namespace crashpad |
| OLD | NEW |