OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright 2014 The Crashpad Authors. All rights reserved. |
| 3 |
| 4 Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 you may not use this file except in compliance with the License. |
| 6 You may obtain a copy of the License at |
| 7 |
| 8 http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
| 10 Unless required by applicable law or agreed to in writing, software |
| 11 distributed under the License is distributed on an "AS IS" BASIS, |
| 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 See the License for the specific language governing permissions and |
| 14 limitations under the License. |
| 15 --> |
| 16 |
| 17 # exception_port_tool(1) |
| 18 |
| 19 ## Name |
| 20 |
| 21 exception_port_tool—Show and change Mach exception ports |
| 22 |
| 23 ## Synopsis |
| 24 |
| 25 **exception_port_tool** [_OPTION…_] [_COMMAND_ [_ARG…_]] |
| 26 |
| 27 ## Description |
| 28 |
| 29 Shows Mach exception ports registered for a thread, task, or host target with a |
| 30 __--show-*__ option, changes Mach exception ports with **--set-handler**, shows |
| 31 changes with a __--show-new-*__ option, and executes _COMMAND_ along with any |
| 32 arguments specified (_ARG…_) with the changed exception ports in effect. |
| 33 |
| 34 ## Options |
| 35 |
| 36 * **-s**, **--set-handler**=_DESCRIPTION_ |
| 37 |
| 38 Set an exception port to _DESCRIPTION_. This option may appear zero, one, or |
| 39 more times. |
| 40 |
| 41 _DESCRIPTION_ is formatted as a comma-separated sequence of tokens, where |
| 42 each token consists of a key and value separated by an equals sign. These |
| 43 keys are recognized: |
| 44 |
| 45 * **target**=_TARGET_ |
| 46 |
| 47 _TARGET_ defines which target’s exception ports to set: **host**, |
| 48 **task**, or **thread**. The default value of _TARGET_ is **task**. |
| 49 Operations on **host** are restricted to the superuser. |
| 50 |
| 51 * **mask**=_MASK_ |
| 52 |
| 53 _MASK_ defines the mask of exception types to handle, from |
| 54 `<mach/exception_types.h>`. This can be **BAD_ACCESS**, |
| 55 **BAD_INSTRUCTION**, **ARITHMETIC**, **EMULATION**, **SOFTWARE**, |
| 56 **BREAKPOINT**, **SYSCALL**, **MACH_SYSCALL**, **RPC_ALERT**, **CRASH**, |
| 57 **RESOURCE**, **GUARD**, or **CORPSE_NOTIFY**. Different exception types |
| 58 may be combined by combining them with pipe characters (**|**). The |
| 59 special value **ALL** includes each exception type except for **CRASH** |
| 60 and **CORPSE_NOTIFY**. To truly specify all exception types including |
| 61 these, use **ALL|CRASH|CORPSE_NOTIFY**. The default value of _MASK_ is |
| 62 **CRASH**. |
| 63 |
| 64 * **behavior**=_BEHAVIOR_ |
| 65 |
| 66 _BEHAVIOR_ defines the specific exception handler routine to be called |
| 67 when an exception occurs. This can be **DEFAULT**, **STATE**, or |
| 68 **STATE_IDENTITY**. **MACH** may also be specified by combining them with |
| 69 pipe characters (**|**). The most complete set of exception information is |
| 70 provided with **STATE_IDENTITY|MACH**. Not all exception servers implement |
| 71 all possible behaviors. The default value of _BEHAVIOR_ is |
| 72 **DEFAULT|MACH**. |
| 73 |
| 74 * **flavor**=_FLAVOR_ |
| 75 |
| 76 For state-carrying values of _BEHAVIOR_ (those including **STATE** or |
| 77 **STATE_IDENTITY**), _FLAVOR_ specifies the architecture-specific thread |
| 78 state flavor to be provided to the exception handler. For the x86 family, |
| 79 this can be **THREAD**, **THREAD32**, **THREAD64**, **FLOAT**, |
| 80 **FLOAT32**, **FLOAT64**, **DEBUG**, **DEBUG32**, or **DEBUG64**. The |
| 81 default value of _FLAVOR_ is **NONE**, which is not valid for |
| 82 state-carrying values of _BEHAVIOR_. |
| 83 |
| 84 * **handler**=_HANDLER_ |
| 85 |
| 86 _HANDLER_ defines the exception handler. **NULL** indicates that any |
| 87 existing exception port should be cleared. _HANDLER_ may also take the |
| 88 form **bootstrap**:_SERVICE_, which will look _SERVICE_ up with the |
| 89 bootstrap server and set that service as the exception handler. The |
| 90 default value of _HANDLER_ is **NULL**. |
| 91 |
| 92 * **--show-bootstrap**=_SERVICE_ |
| 93 |
| 94 Looks up _SERVICE_ with the bootstrap server and shows it. Normally, the |
| 95 handler port values displayed by the other __--show-*__ options are |
| 96 meaningless handles, but by comparing them to the port values for known |
| 97 bootstrap services, it is possible to verify that they are set as intended. |
| 98 |
| 99 * **-p**, **--pid**=_PID_ |
| 100 |
| 101 For operations on the task target, including **--set-handler** with _TARGET_ |
| 102 set to **task**, **--show-task**, and **--show-new-task**, operates on the |
| 103 task associated with process id _PID_ instead of the current task associated |
| 104 with the tool. When this option is supplied, _COMMAND_ must not be specified. |
| 105 |
| 106 This option uses `task_for_pid()` to access the process’ task port. This |
| 107 operation may be restricted to use by the superuser, executables signed by an |
| 108 authority trusted by the system, and processes otherwise permitted by |
| 109 taskgated(8). Consequently, this program must normally either be signed or be |
| 110 invoked by root to use this option. It is possible to install this program as |
| 111 a setuid root executable to overcome this limitation. However, it is not |
| 112 possible to use this option to operate on processes protected by [System |
| 113 Integrity Protection (SIP)](https://support.apple.com/HT204899), including |
| 114 those whose “restrict” codesign(1) option is respected. |
| 115 |
| 116 * **-h**, **--show-host** |
| 117 |
| 118 Shows the original host exception ports before making any changes requested |
| 119 by **--set-handler**. This option is restricted to the superuser. |
| 120 |
| 121 * **-t**, **--show-task** |
| 122 |
| 123 Shows the original task exception ports before making any changes requested |
| 124 by **--set-handler**. |
| 125 |
| 126 * **--show-thread** |
| 127 |
| 128 Shows the original thread exception ports before making any changes requested |
| 129 by **--set-handler**. |
| 130 |
| 131 * **-H**, **--show-new-host** |
| 132 |
| 133 Shows the modified host exception ports after making any changes requested by |
| 134 **--set-handler**. This option is restricted to the superuser. |
| 135 |
| 136 * **-T**, **--show-new-task** |
| 137 |
| 138 Shows the modified task exception ports after making any changes requested by |
| 139 **--set-handler**. |
| 140 |
| 141 * **--show-new-thread** |
| 142 |
| 143 Shows the modified thread exception ports after making any changes requested |
| 144 by **--set-handler** |
| 145 |
| 146 * **-n**, **--numeric** |
| 147 |
| 148 For __--show-*__ options, all values will be displayed numerically only. The |
| 149 default is to decode numeric values and display them symbolically as well. |
| 150 |
| 151 * **--help** |
| 152 |
| 153 Display help and exit. |
| 154 |
| 155 * **--version** |
| 156 |
| 157 Output version information and exit. |
| 158 |
| 159 ## Examples |
| 160 |
| 161 Sets a new task-level exception handler for `EXC_CRASH`-type exceptions to the |
| 162 handler registered with the bootstrap server as `svc`, showing the task-level |
| 163 exception ports before and after the change. The old and new exception handlers |
| 164 are verified by their service names as registered with the bootstrap server. |
| 165 With the new task-level exception ports in effect, a program is run. |
| 166 |
| 167 ``` |
| 168 $ exception_port_tool --show-task --show-new-task \ |
| 169 --show-bootstrap=com.apple.ReportCrash --show-bootstrap=svc \ |
| 170 --set-handler=behavior=DEFAULT,handler=bootstrap:svc crash |
| 171 service com.apple.ReportCrash 0xe03 |
| 172 service svc 0x1003 |
| 173 task exception port 0, mask 0x400 (CRASH), port 0xe03, behavior 0x80000003 (STAT
E_IDENTITY|MACH), flavor 7 (THREAD) |
| 174 new task exception port 0, mask 0x400 (CRASH), port 0x1003, behavior 0x1 (DEFAUL
T), flavor 13 (NONE) |
| 175 Illegal instruction: 4 |
| 176 ``` |
| 177 |
| 178 Shows the task-level exception ports for the process with PID 1234. This |
| 179 requires superuser permissions or the approval of taskgated(8), and the process |
| 180 must not be SIP-protected. |
| 181 |
| 182 ``` |
| 183 # exception_port_tool --pid=1234 --show-task |
| 184 task exception port 0, mask 0x4e (BAD_ACCESS|BAD_INSTRUCTION|ARITHMETIC|BREAKPOI
NT), port 0x1503, behavior 0x1 (DEFAULT), flavor 13 (NONE) |
| 185 task exception port 1, mask 0x1c00 (CRASH|RESOURCE|GUARD), port 0x1403, behavior
0x80000003 (STATE_IDENTITY|MACH), flavor 7 (THREAD) |
| 186 ``` |
| 187 |
| 188 ## Exit Status |
| 189 |
| 190 * **0** |
| 191 |
| 192 Success. |
| 193 |
| 194 * **125** |
| 195 |
| 196 Failure, with a message printed to the standard error stream. |
| 197 |
| 198 * **126** |
| 199 |
| 200 The program specified by _COMMAND_ was found, but could not be invoked. |
| 201 |
| 202 * **127** |
| 203 |
| 204 The program specified by _COMMAND_ could not be found. |
| 205 |
| 206 ## See Also |
| 207 |
| 208 [catch_exception_tool(1)](catch_exception_tool.md), |
| 209 [on_demand_service_tool(1)](on_demand_service_tool.md) |
| 210 |
| 211 ## Resources |
| 212 |
| 213 Crashpad home page: https://crashpad.chromium.org/. |
| 214 |
| 215 Report bugs at https://crashpad.chromium.org/bug/new. |
| 216 |
| 217 ## Copyright |
| 218 |
| 219 Copyright 2014 [The Crashpad |
| 220 Authors](https://chromium.googlesource.com/crashpad/crashpad/+/master/AUTHORS). |
| 221 |
| 222 ## License |
| 223 |
| 224 Licensed under the Apache License, Version 2.0 (the “License”); |
| 225 you may not use this file except in compliance with the License. |
| 226 You may obtain a copy of the License at |
| 227 |
| 228 http://www.apache.org/licenses/LICENSE-2.0 |
| 229 |
| 230 Unless required by applicable law or agreed to in writing, software |
| 231 distributed under the License is distributed on an “AS IS” BASIS, |
| 232 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 233 See the License for the specific language governing permissions and |
| 234 limitations under the License. |
OLD | NEW |