File: run-stack-smashing

package info (click to toggle)
gcc-sh-elf 8.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 140 kB
  • sloc: ansic: 237; makefile: 93; sh: 54
file content (18 lines) | stat: -rwxr-xr-x 709 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
# SPDX-FileCopyrightText: 2021 John Scott <jscott@posteo.net>
# SPDX-License-Identifier: GPL-3.0-or-later

sh-elf-gcc -o "$AUTOPKGTEST_TMP"/stack-smashing-protected debian/tests/stack-smashing.c -fstack-protector-all -Wno-stringop-overflow 2>&1 || exit 1
sh-elf-gcc -o "$AUTOPKGTEST_TMP"/stack-smashing-noprotect debian/tests/stack-smashing.c -fno-stack-protector -Wno-stringop-overflow 2>&1 || exit 1
cd "$AUTOPKGTEST_TMP"
# Check that we get a different exit status when the stack protector is enabled.
sh-elf-run ./stack-smashing-noprotect
oldstat=$?

sh-elf-run ./stack-smashing-protected
if [ $? -eq $oldstat ]
then
	echo Unable to distinguish the stack protector being enabled >&2
	exit 1
fi