mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 10:15:38 +01:00
Gdb script: improve portability of ASLR disabling disabling
Call `set disable-randomization off` only if it seems to be supported. The goal is to neither get an error about disable-randomization not being supported (e.g. on FreeBSD), nor get an error if it is supported but fails (e.g. on Ubuntu). Only fiddle with disable-randomization from all.sh, which cares because it reports the failure of ASLR disabling as an error. If a developer invokes the Gdb script manually, a warning about ASLR doesn't matter.
This commit is contained in:
parent
5fa32a7a7a
commit
4976e82a9e
@ -1117,17 +1117,27 @@ component_test_zeroize () {
|
|||||||
# system in all cases that the script fails, so we must manually search the
|
# system in all cases that the script fails, so we must manually search the
|
||||||
# output to check whether the pass string is present and no failure strings
|
# output to check whether the pass string is present and no failure strings
|
||||||
# were printed.
|
# were printed.
|
||||||
|
|
||||||
|
# Don't try to disable ASLR. We don't care about ASLR here. We do care
|
||||||
|
# about a spurious message if Gdb tries and fails, so suppress that.
|
||||||
|
gdb_disable_aslr=
|
||||||
|
if [ -z "$(gdb -batch -nw -ex 'set disable-randomization off' 2>&1)" ]; then
|
||||||
|
gdb_disable_aslr='set disable-randomization off'
|
||||||
|
fi
|
||||||
|
|
||||||
for optimization_flag in -O2 -O3 -Ofast -Os; do
|
for optimization_flag in -O2 -O3 -Ofast -Os; do
|
||||||
for compiler in clang gcc; do
|
for compiler in clang gcc; do
|
||||||
msg "test: $compiler $optimization_flag, mbedtls_platform_zeroize()"
|
msg "test: $compiler $optimization_flag, mbedtls_platform_zeroize()"
|
||||||
make programs CC="$compiler" DEBUG=1 CFLAGS="$optimization_flag"
|
make programs CC="$compiler" DEBUG=1 CFLAGS="$optimization_flag"
|
||||||
if_build_succeeded gdb -x tests/scripts/test_zeroize.gdb -nw -batch -nx 2>&1 | tee test_zeroize.log
|
if_build_succeeded gdb -ex "$gdb_disable_aslr" -x tests/scripts/test_zeroize.gdb -nw -batch -nx 2>&1 | tee test_zeroize.log
|
||||||
if_build_succeeded grep "The buffer was correctly zeroized" test_zeroize.log
|
if_build_succeeded grep "The buffer was correctly zeroized" test_zeroize.log
|
||||||
if_build_succeeded not grep -i "error" test_zeroize.log
|
if_build_succeeded not grep -i "error" test_zeroize.log
|
||||||
rm -f test_zeroize.log
|
rm -f test_zeroize.log
|
||||||
make clean
|
make clean
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
unset gdb_disable_aslr
|
||||||
}
|
}
|
||||||
|
|
||||||
component_check_python_files () {
|
component_check_python_files () {
|
||||||
|
@ -41,8 +41,6 @@
|
|||||||
# number does not need to be updated often.
|
# number does not need to be updated often.
|
||||||
|
|
||||||
set confirm off
|
set confirm off
|
||||||
# We don't need to turn off ASLR, so don't try.
|
|
||||||
set disable-randomization off
|
|
||||||
|
|
||||||
file ./programs/test/zeroize
|
file ./programs/test/zeroize
|
||||||
break zeroize.c:100
|
break zeroize.c:100
|
||||||
|
Loading…
Reference in New Issue
Block a user