]>
git.saurik.com Git - apple/libsystem.git/blob - enable_asan_mode
5 echo " sudo $0 enable ... enables ASanification of system libraries on your system" 1>&2
6 echo " sudo $0 disable ... reverts the changes and restores the system back to normal" 1>&2
7 echo " $0 status ... prints current mode" 1>&2
11 if [ "$1" == "enable" ]; then
12 if [[ $(id -u) != 0 ]]; then echo "Must be run as root." 1>&2; exit 1; fi
14 if [ -f /usr
/lib
/libSystem.B.dylib
-asan-mode-backup ]; then
15 if [ "`md5 -q /usr/lib/libSystem.B.dylib-asan-mode-backup`" != "`md5 -q /usr/lib/libSystem.B.dylib`" ]; then
16 echo "Looks like your system already has ASan mode enabled, or you have a custom /usr/lib/libSystem.B.dylib file. Not activating." 1>&2
21 ditto
/usr
/lib
/libSystem.B.dylib
/usr
/lib
/libSystem.B.dylib
-asan-mode-backup
22 ditto
/usr
/lib
/libSystem.B_asan.dylib
/usr
/lib
/libSystem.B.dylib
23 echo "ASan mode activated. You probably want to reboot now." 1>&2
25 elif [ "$1" == "disable" ]; then
26 if [[ $(id -u) != 0 ]]; then echo "Must be run as root." 1>&2; exit 1; fi
27 ditto
/usr
/lib
/libSystem.B.dylib
-asan-mode-backup /usr
/lib
/libSystem.B.dylib
28 echo "ASan mode deactivated. You probably want to reboot now." 1>&2
30 elif [ "$1" == "status" ]; then
31 if [ ! -f /usr
/lib
/libSystem.B.dylib
-asan-mode-backup ]; then
32 echo "ASan mode is disabled." 1>&2
36 if [ "`md5 -q /usr/lib/libSystem.B.dylib-asan-mode-backup`" == "`md5 -q /usr/lib/libSystem.B.dylib`" ]; then
37 echo "ASan mode is disabled." 1>&2
41 if [ "`md5 -q /usr/lib/libSystem.B_asan.dylib`" == "`md5 -q /usr/lib/libSystem.B.dylib`" ]; then
42 echo "ASan mode is enabled." 1>&2
46 echo "Cannot tell whether ASan mode is enabled or not. You seem to have a custom /usr/lib/libSystem.B.dylib file." 1>&2
49 echo "Invalid argument. Run '$0' for usage instructions." 1>&2