-# ldconfig, glibc_post_upgrade : static binary
-/usr/sbin/ldconfig
-/usr/sbin/glibc_post_upgrade
-# qemu-arm-binfmt : only used for mic build
-/usr/bin/qemu-arm-binfmt
-# containerd ~ docker-proxy : golang pre-built binary
-/usr/bin/containerd
-/usr/bin/containerd-shim-runc-v2
-/usr/bin/docker
-/usr/bin/docker-init
-/usr/bin/runc
-/usr/bin/containerd-shim
-/usr/bin/ctr
-/usr/bin/dockerd
-/usr/bin/docker-proxy
-# last line
+# Static binaries, dll and qemu binaries are automatically detected and allowed during testing.
+# If cases are existed that ASLR cannot be applied except aboves, write full path here.
+# example:
+# /usr/bin/containerd
echo "find exception" "$1"
return 1
fi
- filename=$(basename $1)
- fileext=${filename##*.}
- if [ $fileext == "dll" ]
- then
- echo "*.dll files are excluded : " "$1"
- return 1
- fi
return 0
}
/usr/bin/echo "Start aslr check test"
-/usr/bin/find / -type f -executable 2>/dev/null | /usr/bin/xargs $utl_path/file | /usr/bin/grep "executable" | /usr/bin/grep -v "shared object" | /usr/bin/grep -v "pie" | /usr/bin/grep -v "script" | /usr/bin/cut -d ":" -f1 >> $tmp_file
+/usr/bin/find / -type f -executable -not -name "*.dll" -not -name "/usr/bin/qemu*" 2>/dev/null | /usr/bin/xargs $utl_path/file | /usr/bin/grep -E "executable.*dynamically linked" | /usr/bin/grep -v -e "shared object" -e "pie" -e "script" | /usr/bin/cut -d ":" -f1 >> $tmp_file
#init log
if [ -e "$log_file" ]
/usr/bin/rm $log_file
fi
-# Retrieve exec permission (chmod & cat need to be considered separately to finish below lines)
-# Checking "/etc/smack/onlycap" is temporary. This should be considered again later.
while read line
do
- if [[ $line != "/usr/bin/chmod" ]] && [[ $line != "/usr/bin/cat" ]] && [[ $line != "/usr/bin/qemu-arm" ]] && [[ $line != "/usr/bin/qemu-aarch64" ]]
+ CHECK_EXCEPTION $line
+ if [ "$?" == 0 ]
then
- CHECK_EXCEPTION $line
- if [ "$?" == 0 ]
- then
- if [[ -e "/etc/smack/onlycap" ]]
- then
- chmod a-x $line
- fi
- echo "$line" >> $log_file
- fi
+ echo "$line" >> $log_file
fi
done < <(cat $tmp_file)
rm $tmp_file
echo "YES" > $result_file
else
echo "NO" > $result_file
+ chmod a-x $(cat $log_file)
fi
/usr/bin/echo "Finish aslr check test"