]>
git.saurik.com Git - apple/xnu.git/blob - san/tools/kasan_install
4 # kasan_install: set up a system to run the KASan kernel. Run with "--uninstall"
5 # to reverse the setup.
7 # Adds kcsuffix=kasan to boot-args.
11 if [[ `whoami` != root
]] ; then
12 echo "Re-running with sudo"
18 csrutil status
|grep -q enabled
34 echo -n "Checking KASan boot args... "
36 bootargs
=$(nvram boot-args | cut -f2)
37 cursuffix
=$(echo $bootargs | sed -n 's/.*kcsuffix=\([^ ]\)/\
1/p
')
39 if [[ "$cursuffix" == kasan ]] ; then
41 elif [[ -n "$cursuffix" ]] ; then
42 prompt "custom kcsuffix ($cursuffix) is set. Overwrite?" && {
43 bootargs=$(echo "$bootargs" | sed 's/[ ]*kcsuffix=[^ ]*//')
47 prompt "not set. Modify?" && {
52 [[ $dobootargs -eq 1 ]] && {
53 echo -n "Adding boot arg kcsuffix=kasan... "
54 newlen=$(echo -n "$bootargs kcsuffix=kasan" |wc -c)
55 if [[ $newlen -ge 512 ]] ; then
56 echo "boot-args too long. Bailing."
60 nvram boot-args="$bootargs kcsuffix=kasan" || exit $?
69 echo -n "Removing boot args... "
71 bootargs=$(nvram boot-args | cut -f2)
72 cursuffix=$(echo $bootargs | sed -n 's/.*kcsuffix=\([^ ]\)/\1/p')
74 if [[ $cursuffix == "kasan" ]] ; then
75 prompt
"remove kcsuffix=kasan?" && {
76 echo -n "Removing kcsuffix... "
77 bootargs
=$(echo "$bootargs" | sed 's/[ ]*kcsuffix=[^ ]*//')
78 nvram boot
-args="$bootargs"
88 *uninstall
|*del
*|*remove
|*rm)