+#if CONFIG_CSR
+ /* If the process is restricted, CSR isn't configured to allow
+ * restricted processes to be debugged, and CSR isn't configured in
+ * AppleInternal mode, then don't dump core. */
+ if (cs_restricted(core_proc) &&
+ csr_check(CSR_ALLOW_TASK_FOR_PID) &&
+ csr_check(CSR_ALLOW_APPLE_INTERNAL)) {
+#if CONFIG_AUDIT
+ audit_proc_coredump(core_proc, NULL, EFAULT);
+#endif
+ return (EFAULT);
+ }
+#endif
+