Loading...
--- xnu/xnu-12377.61.12/bsd/sys/reason.h
+++ xnu/xnu-7195.60.75/bsd/sys/reason.h
@@ -36,9 +36,9 @@
#ifdef KERNEL_PRIVATE
#include <kern/kern_cdata.h>
+#include <os/refcnt.h>
#ifdef XNU_KERNEL_PRIVATE
-#include <os/refcnt.h>
#include <kern/locks.h>
typedef struct os_reason {
@@ -52,7 +52,7 @@
char *osr_kcd_buf;
} *os_reason_t;
-#define OS_REASON_NULL ((os_reason_t) NULL)
+#define OS_REASON_NULL ((os_reason_t) 0)
/* We only include 800 bytes of the exit reason description to not blow through the panic buffer */
#define LAUNCHD_PANIC_REASON_STRING_MAXLEN "800"
@@ -61,35 +61,10 @@
os_reason_t build_userspace_exit_reason(uint32_t reason_namespace, uint64_t reason_code, user_addr_t payload, uint32_t payload_size,
user_addr_t reason_string, uint64_t reason_flags);
-char *exit_reason_get_string_desc(os_reason_t exit_reason);
+char *launchd_exit_reason_get_string_desc(os_reason_t exit_reason);
/* The blocking allocation is currently not exported to KEXTs */
int os_reason_alloc_buffer(os_reason_t cur_reason, uint32_t osr_bufsize);
-
-typedef struct _exception_info {
- int os_reason;
- int signal;
- exception_type_t exception_type;
- mach_exception_data_type_t mx_code;
- mach_exception_data_type_t mx_subcode;
- struct kt_info {
- int kt_subsys;
- uint32_t kt_error;
- } kt_info;
-} exception_info_t;
-
-#define PX_FLAGS_NONE 0
-/* think twice about userspace debugging experience before using PX_DEBUG_NO_HONOR */
-#define PX_DEBUG_NO_HONOR (1 << 0) /* force exit even when debugging */
-#define PX_KTRIAGE (1 << 1) /* leave a ktriage record */
-#define PX_PSIGNAL (1 << 2) /* send sig instead of forced exit */
-#define PX_NO_EXCEPTION_UTHREAD (1 << 3) /* do not set bsdthread exception */
-
-int exit_with_mach_exception(struct proc *p, exception_info_t exception, uint32_t flags);
-#if CONFIG_EXCLAVES
-int exit_with_exclave_exception(struct proc *p, exception_info_t exception, uint32_t flags);
-#endif
-void exit_with_mach_exception_using_ast(exception_info_t exception, uint32_t flags, bool fatal);
#else /* XNU_KERNEL_PRIVATE */
@@ -140,55 +115,35 @@
#define OS_REASON_ENDPOINTSECURITY 27
#define OS_REASON_PAC_EXCEPTION 28
#define OS_REASON_BLUETOOTH_CHIP 29
-#define OS_REASON_PORT_SPACE 30
-#define OS_REASON_WEBKIT 31
-#define OS_REASON_BACKLIGHTSERVICES 32
-#define OS_REASON_MEDIA 33
-#define OS_REASON_ROSETTA 34
-#define OS_REASON_LIBIGNITION 35
-#define OS_REASON_BOOTMOUNT 36
-#define OS_REASON_MTE_FAIL 37
-#define OS_REASON_REALITYKIT 38
-#define OS_REASON_AUDIO 39
-#define OS_REASON_WAKEBOARD 40
-#define OS_REASON_CORERC 41
-#define OS_REASON_SELF_RESTRICT 42
-#define OS_REASON_ARKIT 43
-#define OS_REASON_CAMERA 44
-#define OS_REASON_BACKBOARD 45
-#define OS_REASON_POWEREXCEPTIONS 46
-#define OS_REASON_SECINIT 47
/*
* Update whenever new OS_REASON namespaces are added.
*/
-#define OS_REASON_MAX_VALID_NAMESPACE OS_REASON_SECINIT
+#define OS_REASON_MAX_VALID_NAMESPACE OS_REASON_BLUETOOTH_CHIP
#define OS_REASON_BUFFER_MAX_SIZE 5120
-#define OS_REASON_FLAG_NO_CRASH_REPORT 0x1 /* Don't create a crash report */
-#define OS_REASON_FLAG_GENERATE_CRASH_REPORT 0x2 /* Create a crash report - the default for userspace requests */
-#define OS_REASON_FLAG_FROM_USERSPACE 0x4 /* Reason created from a userspace syscall */
-#define OS_REASON_FLAG_FAILED_DATA_COPYIN 0x8 /* We failed to copyin data from userspace */
-#define OS_REASON_FLAG_PAYLOAD_TRUNCATED 0x10 /* The payload was truncated because it was longer than allowed */
-#define OS_REASON_FLAG_BAD_PARAMS 0x20 /* Invalid parameters were passed involved with creating this reason */
-#define OS_REASON_FLAG_CONSISTENT_FAILURE 0x40 /* Whatever caused this reason to be created will happen again */
-#define OS_REASON_FLAG_ONE_TIME_FAILURE 0x80 /* Whatever caused this reason to be created was a one time issue */
-#define OS_REASON_FLAG_NO_CRASHED_TID 0x100 /* Don't include the TID that processed the exit in the crash report */
-#define OS_REASON_FLAG_ABORT 0x200 /* Reason created from abort_* rather than terminate_* */
-#define OS_REASON_FLAG_SHAREDREGION_FAULT 0x400 /* Fault happened within the shared cache region */
-#define OS_REASON_FLAG_CAPTURE_LOGS 0x800 /* The report generated for this reason should capture logs */
-#define OS_REASON_FLAG_SECURITY_SENSITIVE 0x1000 /* Mark as security sensitive for priority treatment */
+#define OS_REASON_FLAG_NO_CRASH_REPORT 0x1 /* Don't create a crash report */
+#define OS_REASON_FLAG_GENERATE_CRASH_REPORT 0x2 /* Create a crash report - the default for userspace requests */
+#define OS_REASON_FLAG_FROM_USERSPACE 0x4 /* Reason created from a userspace syscall */
+#define OS_REASON_FLAG_FAILED_DATA_COPYIN 0x8 /* We failed to copyin data from userspace */
+#define OS_REASON_FLAG_PAYLOAD_TRUNCATED 0x10 /* The payload was truncated because it was longer than allowed */
+#define OS_REASON_FLAG_BAD_PARAMS 0x20 /* Invalid parameters were passed involved with creating this reason */
+#define OS_REASON_FLAG_CONSISTENT_FAILURE 0x40 /* Whatever caused this reason to be created will happen again */
+#define OS_REASON_FLAG_ONE_TIME_FAILURE 0x80 /* Whatever caused this reason to be created was a one time issue */
+#define OS_REASON_FLAG_NO_CRASHED_TID 0x100 /* Don't include the TID that processed the exit in the crash report */
+#define OS_REASON_FLAG_ABORT 0x200 /* Reason created from abort_* rather than terminate_* */
+#define OS_REASON_FLAG_SHAREDREGION_FAULT 0x400 /* Fault happened within the shared cache region */
/*
* Set of flags that are allowed to be passed from userspace
*/
-#define OS_REASON_FLAG_MASK_ALLOWED_FROM_USER (OS_REASON_FLAG_CONSISTENT_FAILURE | OS_REASON_FLAG_ONE_TIME_FAILURE | OS_REASON_FLAG_NO_CRASH_REPORT | OS_REASON_FLAG_ABORT | OS_REASON_FLAG_CAPTURE_LOGS | OS_REASON_FLAG_SECURITY_SENSITIVE)
+#define OS_REASON_FLAG_MASK_ALLOWED_FROM_USER (OS_REASON_FLAG_CONSISTENT_FAILURE | OS_REASON_FLAG_ONE_TIME_FAILURE | OS_REASON_FLAG_NO_CRASH_REPORT | OS_REASON_FLAG_ABORT)
/*
* Macros to encode the exit reason namespace and first 32 bits of code in exception code
* which is used by Report Crash as a hint. It should be only used as a hint since it
- * loses higher 32 bits of exit reason code.
+ * looses higher 32 bits of exit reason code.
*/
#define ENCODE_OSR_NAMESPACE_TO_MACH_EXCEPTION_CODE(code, osr_namespace) \
(code) = (code) | (((osr_namespace) & ((uint64_t)UINT32_MAX)) << 32)
@@ -238,9 +193,9 @@
* args->reason_string - additional string formatted information about the request
* args->reason_flags - options requested for how the process should be terminated (see OS_REASON_FLAG_* above)
*
- * Outputs: returns -1 and sets errno to EINVAL if the PID requested is the same as that of the calling process, invalid or the namespace provided is invalid.
- * returns -1 and sets errno to ESRCH if we couldn't find a live process with the requested PID
- * returns -1 and sets errno to EPERM if the caller is not privileged enough to kill the process with the requested PID
+ * Outputs: EINVAL if the PID requested is the same as that of the calling process, invalid or the namespace provided is invalid.
+ * ESRCH if we couldn't find a live process with the requested PID
+ * EPERM if the caller is not privileged enough to kill the process with the requested PID
* returns 0 otherwise
*/
int terminate_with_reason(int pid, uint32_t reason_namespace, uint64_t reason_code, const char *reason_string, uint64_t reason_flags);
@@ -259,9 +214,9 @@
* args->reason_string - additional string formatted information about the request
* args->reason_flags - options requested for how the process should be terminated (see OS_REASON_FLAG_* above)
*
- * Outputs: returns -1 and sets errno to EINVAL if the PID requested is the same as that of the calling process, is invalid or the namespace provided is invalid.
- * returns -1 and sets errno to ESRCH if we couldn't find a live process with the requested PID
- * returns -1 and sets errno to EPERM if the caller is not privileged enough to kill the process with the requested PID
+ * Outputs: EINVAL if the PID requested is the same as that of the calling process, is invalid or the namespace provided is invalid.
+ * ESRCH if we couldn't find a live process with the requested PID
+ * EPERM if the caller is not privileged enough to kill the process with the requested PID
* returns 0 otherwise
*/
int terminate_with_payload(int pid, uint32_t reason_namespace, uint64_t reason_code, void *payload, uint32_t payload_size,
@@ -271,10 +226,10 @@
/*
* codesigning exit reasons
*/
-#define CODESIGNING_EXIT_REASON_TASKGATED_INVALID_SIG 1
-#define CODESIGNING_EXIT_REASON_INVALID_PAGE 2
-#define CODESIGNING_EXIT_REASON_TASK_ACCESS_PORT 3
-#define CODESIGNING_EXIT_REASON_LAUNCH_CONSTRAINT_VIOLATION 4
+#define CODESIGNING_EXIT_REASON_TASKGATED_INVALID_SIG 1
+#define CODESIGNING_EXIT_REASON_INVALID_PAGE 2
+#define CODESIGNING_EXIT_REASON_TASK_ACCESS_PORT 3
+
/*
* exec path specific exit reasons
*/
@@ -294,19 +249,12 @@
#define EXEC_EXIT_REASON_WRONG_PLATFORM 14
#define EXEC_EXIT_REASON_MAIN_FD_ALLOC 15
#define EXEC_EXIT_REASON_COPYOUT_ROSETTA 16
-#define EXEC_EXIT_REASON_SET_DYLD_INFO 17
-#define EXEC_EXIT_REASON_MACHINE_THREAD 18
-#define EXEC_EXIT_REASON_BAD_PSATTR 19
-#define EXEC_EXIT_REASON_NOX86EXEC 20
-#define EXEC_EXIT_REASON_MAP_EXEC_FAILURE 21
/*
* guard reasons
*/
#define GUARD_REASON_VNODE 1
#define GUARD_REASON_VIRT_MEMORY 2
#define GUARD_REASON_MACH_PORT 3
-#define GUARD_REASON_EXCLAVES 4
-#define GUARD_REASON_JIT 5
__END_DECLS