#include <mach/exception_types.h>
#include <mach/exc.h>
#include <mach/mach_exc.h>
+
#include <ipc/port.h>
#include <ipc/ipc_entry.h>
#include <ipc/ipc_object.h>
#include <ipc/ipc_space.h>
#include <ipc/ipc_pset.h>
#include <ipc/ipc_machdep.h>
+
#include <kern/counters.h>
#include <kern/ipc_tt.h>
#include <kern/task.h>
#include <kern/sched_prim.h>
#include <kern/host.h>
#include <kern/misc_protos.h>
+#include <kern/ux_handler.h>
+
#include <security/mac_mach_internal.h>
#include <string.h>
+
#include <pexpert/pexpert.h>
extern int panic_on_exception_triage;
* As with other failures, exception_triage_thread will go on
* to the next level.
*/
- if (mac_exc_action_check_exception_send(task, excp) != 0) {
+
+ /* The global exception-to-signal translation port is safe to be an exception handler. */
+ if (is_ux_handler_port(exc_port) == FALSE &&
+ mac_exc_action_check_exception_send(task, excp) != 0) {
kr = KERN_FAILURE;
goto out_release_right;
}
c_thr_exc_raise_state++;
state_cnt = _MachineStateCount[flavor];
- kr = thread_getstatus(thread, flavor,
+ kr = thread_getstatus_to_user(thread, flavor,
(thread_state_t)state,
&state_cnt);
if (kr == KERN_SUCCESS) {
}
if (kr == KERN_SUCCESS) {
if (exception != EXC_CORPSE_NOTIFY)
- kr = thread_setstatus(thread, flavor,
+ kr = thread_setstatus_from_user(thread, flavor,
(thread_state_t)state,
state_cnt);
goto out_release_right;
c_thr_exc_raise_state_id++;
state_cnt = _MachineStateCount[flavor];
- kr = thread_getstatus(thread, flavor,
+ kr = thread_getstatus_to_user(thread, flavor,
(thread_state_t)state,
&state_cnt);
if (kr == KERN_SUCCESS) {
if (kr == KERN_SUCCESS) {
if (exception != EXC_CORPSE_NOTIFY)
- kr = thread_setstatus(thread, flavor,
+ kr = thread_setstatus_from_user(thread, flavor,
(thread_state_t)state,
state_cnt);
goto out_release_right;