You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhanced csrstat with historically accurate SIP analysis based on Apple XNU kernel source research
- Implemented version-specific CSR disable values (0x67 for Catalina-, 0x6F for Big Sur+)
- Added comprehensive XNU kernel source analysis with complete CSR flag evolution timeline
- Discovered Apple's transition from dynamic CSR logic to static CSR_DISABLE_FLAGS constant
- Updated compilation instructions for universal binary support (ARM64 + x86_64)
- Refactored to use official Apple CSR_DISABLE_FLAGS definition with historical accuracy
- Enhanced documentation with complete macOS version mapping and XNU source evolution
Technical improvements:
- Version-aware CSR disable logic based on Darwin kernel version detection
- Complete CSR flag evolution documentation from El Capitan through current versions
- Accurate handling of kernel debugger flag inclusion changes between macOS versions
- Universal binary compilation support for both Intel and Apple Silicon architectures
Please note that csrstat reads the active SIP configuration directly from the kernel via syscall, not from the NVRAM variable (csr-active-config), as it should. The NVRAM variable is only applied after a reboot.
110
+
### CSR Configuration Storage by Architecture
111
+
112
+
Based on Apple's XNU kernel source analysis:
113
+
114
+
-**Intel Systems**: Configuration stored in NVRAM variable `csr-active-config` and read via boot arguments
115
+
-**Apple Silicon**: Configuration read via `lp-sip0` entry in the Device Tree (`lp-sip1`, `lp-sip2` for additional flags) under `/chosen/asmb` - **NO NVRAM usage**
116
+
117
+
The kernel code shows this clearly:
118
+
```c
119
+
// Apple Silicon - Device Tree lookup
120
+
if (SecureDTLookupEntry(0, "/chosen/asmb", &entry) == kSuccess &&
csr_config = (uint32_t)uint64_value; // Currently only 32 bits used.
123
+
config_active = true;
124
+
}
125
+
```
126
+
127
+
### Dynamic Kernel Behavior
128
+
129
+
The kernel includes sophisticated logic that dynamically enables `CSR_ALLOW_KERNEL_DEBUGGER` when other debugging flags are present:
130
+
131
+
```c
132
+
// From XNU kernel source
133
+
if ((config & (CSR_ALLOW_UNTRUSTED_KEXTS | CSR_ALLOW_APPLE_INTERNAL)) != 0) {
134
+
config |= CSR_ALLOW_KERNEL_DEBUGGER;
135
+
}
136
+
```
137
+
138
+
This explains why kernel debugging appears enabled even when not explicitly set.
139
+
140
+
### Apple Internal Bit Handling
141
+
142
+
On retail hardware, the kernel automatically strips the Apple Internal bit:
143
+
144
+
```c
145
+
if (!_csr_is_iuou_or_iuos_device()) {
146
+
csr_config &= ~CSR_ALLOW_APPLE_INTERNAL;
147
+
}
148
+
```
149
+
150
+
### Active Configuration Reading
151
+
152
+
csrstat reads the active SIP configuration directly from the kernel via syscall (`csr_get_active_config`), not from the stored configuration sources. The stored values (NVRAM on Intel, Device Tree on Apple Silicon) are only applied during boot and after a reboot.
92
153
93
154
## Version History
94
155
@@ -102,7 +163,9 @@ Please note that csrstat reads the active SIP configuration directly from the ke
0 commit comments