]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/sys/reason.h
xnu-4903.270.47.tar.gz
[apple/xnu.git] / bsd / sys / reason.h
index 2d81e3a41a4a5942824d16bf1c0ef379852cd0da..c695340910d43b79ce9dd433a4fb995d139005ad 100644 (file)
@@ -41,14 +41,14 @@ __BEGIN_DECLS
 #include <kern/locks.h>
 
 typedef struct os_reason {
-       decl_lck_mtx_data(,             osr_lock)
-       int                             osr_refcount;
-       uint32_t                        osr_namespace;
-       uint64_t                        osr_code;
-       uint64_t                        osr_flags;
-       uint32_t                        osr_bufsize;
-       struct kcdata_descriptor        osr_kcd_descriptor;
-       char                            *osr_kcd_buf;
+       decl_lck_mtx_data(, osr_lock)
+       unsigned int                    osr_refcount;
+       uint32_t                        osr_namespace;
+       uint64_t                        osr_code;
+       uint64_t                        osr_flags;
+       uint32_t                        osr_bufsize;
+       struct kcdata_descriptor        osr_kcd_descriptor;
+       char                            *osr_kcd_buf;
 } *os_reason_t;
 
 #define OS_REASON_NULL ((os_reason_t) 0)
@@ -59,7 +59,7 @@ typedef struct os_reason {
 void os_reason_init(void);
 
 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);
+    user_addr_t reason_string, uint64_t reason_flags);
 char *launchd_exit_reason_get_string_desc(os_reason_t exit_reason);
 
 /* The blocking allocation is currently not exported to KEXTs */
@@ -104,11 +104,14 @@ void os_reason_free(os_reason_t cur_reason);
 #define OS_REASON_FOUNDATION    19
 #define OS_REASON_WATCHDOG      20
 #define OS_REASON_METAL         21
+#define OS_REASON_WATCHKIT      22
+#define OS_REASON_GUARD         23
+#define OS_REASON_ANALYTICS     24
 
 /*
  * Update whenever new OS_REASON namespaces are added.
  */
-#define OS_REASON_MAX_VALID_NAMESPACE OS_REASON_METAL
+#define OS_REASON_MAX_VALID_NAMESPACE OS_REASON_ANALYTICS
 
 #define OS_REASON_BUFFER_MAX_SIZE 5120
 
@@ -121,11 +124,12 @@ void os_reason_free(os_reason_t cur_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_* */
 
 /*
  * 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)
+#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
@@ -167,7 +171,7 @@ void abort_with_reason(uint32_t reason_namespace, uint64_t reason_code, const ch
  * Outputs:             Does not return.
  */
 void abort_with_payload(uint32_t reason_namespace, uint64_t reason_code, void *payload, uint32_t payload_size, const char *reason_string,
-                                uint64_t reason_flags) __attribute__((noreturn));
+    uint64_t reason_flags) __attribute__((noreturn));
 
 /*
  * terminate_with_reason: Used to terminate a specific process and pass along
@@ -206,7 +210,7 @@ int terminate_with_reason(int pid, uint32_t reason_namespace, uint64_t reason_co
  *                      returns 0 otherwise
  */
 int terminate_with_payload(int pid, uint32_t reason_namespace, uint64_t reason_code, void *payload, uint32_t payload_size,
-                                const char *reason_string, uint64_t reason_flags);
+    const char *reason_string, uint64_t reason_flags);
 #endif /* KERNEL */
 
 /*
@@ -231,6 +235,14 @@ int terminate_with_payload(int pid, uint32_t reason_namespace, uint64_t reason_c
 #define EXEC_EXIT_REASON_FAIRPLAY_DECRYPT   10
 #define EXEC_EXIT_REASON_DECRYPT            11
 #define EXEC_EXIT_REASON_UPX                12
+#define EXEC_EXIT_REASON_NO32EXEC           13
+
+/*
+ * guard reasons
+ */
+#define GUARD_REASON_VNODE       1
+#define GUARD_REASON_VIRT_MEMORY 2
+#define GUARD_REASON_MACH_PORT   3
 
 __END_DECLS