About-This-Hack
About-This-Hack copied to clipboard
Attempt to fix wrong SIP value (for Intel and Silicon)
There are users (including myself) who don't see the correct SIP value when it is fully or partially disabled, seeing it as Enabled (0x00000000). There is even a closed issue (124, user has Clover and the problem is attributed to this). But I have tried Clover and OpenCore and the same thing happens with both boot loaders. SIP value is enabled 0x00000000 even if disabled.
SIP value is read either via the csr-active-config NVRAM variable on Intel-based systems or via lp-sip0 entry in the Device Tree on Apple Silicon-based systems.
On Hackintosh and Intel Macs it is easy to get SIP value with ioreg -l | grep csr-active-config | cut -c 38- | cut -c -8. Returned value is the hexadecimal number to be displayed in the tooltip.
On Apple Silicon there is no easy way to get this value. Mykola Grymalyuk proposes, in an article about SIP, to access csr_get_active_config function of the /usr/lib/libSystem.dylib system library using Objective-C code.
I haven't found an easy way to do the same with Swift. But since Xcode allows you to include Objective-C files in Swift projects, I've added the (modified) Objective-C code to the About This Hack project via a Bridging-Header.h header file.
This way SIP value (enabled or disabled) is displayed in the tooltip as it should. And the method should work for both Intel and Silicon platforms.
I have tested it on 2 Hacks and 1 Intel Mac but I don't have access to any Apple Silicon. So I ask you to test it on your M2 to make sure it works fine.
Waiting for this question to be resolved, best regards.
Note: There is also a small change commenting that bdmesg is no longer used to detect Clover.