| 1 |
#!/bin/sh |
| 2 |
# SPDX-FileCopyrightText: 2021 John Scott <[email protected]> |
| 3 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
sh-elf-gcc -o "$AUTOPKGTEST_TMP"/stack-smashing-protected debian/tests/stack-smashing.c -fstack-protector-all -Wno-stringop-overflow 2>&1 || exit 1 |
| 6 |
sh-elf-gcc -o "$AUTOPKGTEST_TMP"/stack-smashing-noprotect debian/tests/stack-smashing.c -fno-stack-protector -Wno-stringop-overflow 2>&1 || exit 1 |
| 7 |
cd "$AUTOPKGTEST_TMP" |
| 8 |
# Check that we get a different exit status when the stack protector is enabled. |
| 9 |
sh-elf-run ./stack-smashing-noprotect |
| 10 |
oldstat=$? |
| 11 |
|
| 12 |
sh-elf-run ./stack-smashing-protected |
| 13 |
if [ $? -eq $oldstat ] |
| 14 |
then |
| 15 |
echo Unable to distinguish the stack protector being enabled >&2 |
| 16 |
exit 1 |
| 17 |
fi |
| 18 |
|