Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Patch to allow csrutil enable/disable without Recovery OS
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusHenze committed Mar 24, 2016
1 parent 78c3ee6 commit 1a34f03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Unrootless/Unrootless.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 2 additions & 0 deletions Unrootless/csr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a34f03

Please sign in to comment.