diff --git a/Unrootless/Unrootless.c b/Unrootless/Unrootless.c index 54bc9f9..9e9b1a9 100644 --- a/Unrootless/Unrootless.c +++ b/Unrootless/Unrootless.c @@ -133,6 +133,12 @@ static int sysctl_rootless_disabled_func SYSCTL_HANDLER_ARGS { static int sysctl_rootless_csrFlags SYSCTL_HANDLER_ARGS { csr_flags = csr_flags & CSR_VALID_FLAGS; + boot_args *args = (boot_args*) PE_state_loc->bootArgs; + if (csr_flags & CSR_ALLOW_DEVICE_CONFIGURATION) { // Allow using csrutil enable/disable + args->flags |= kBootArgsFlagCSRConfigMode; + } else { + args->flags &= ~(kBootArgsFlagCSRConfigMode); + } setCSR(1); // Value doesn't care... return sysctl_handle_int( oidp, oidp->oid_arg1 , oidp->oid_arg2 , req ); diff --git a/Unrootless/csr.h b/Unrootless/csr.h index e12799d..2e72753 100644 --- a/Unrootless/csr.h +++ b/Unrootless/csr.h @@ -32,6 +32,8 @@ typedef struct PE_state { #endif } PE_state_t; +#define kBootArgsFlagCSRConfigMode (1 << 4) + PE_state_t *PE_state_loc = NULL; #define BOOT_LINE_LENGTH 1024