36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
. /usr/share/beakerlib/beakerlib.sh
|
|
|
|
TEST="/CRB/execstack/Sanity/execstack"
|
|
|
|
PACKAGES=${PACKAGES:-execstack}
|
|
REQUIRES=${REQUIRES:-gcc}
|
|
|
|
rlJournalStart
|
|
rlPhaseStartSetup
|
|
rlAssertRpm --all
|
|
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
|
rlRun "pushd $TmpDir"
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStartTest
|
|
rlRun "echo 'int main() {}' | gcc -x c -z noexecstack - -o A" 0 "Compiling binary without executable stack"
|
|
rlRun "echo 'int main() {}' | gcc -x c -z execstack - -o B" 0 "Compiling binary with executable stack"
|
|
rlRun "execstack --query A > out" 0 "Querying binary A"
|
|
rlAssertGrep "^-" "out"
|
|
rlRun "execstack --query B > out" 0 "Querying binary B"
|
|
rlAssertGrep "^X" "out"
|
|
rlRun "execstack --clear-execstack B" 0 "Clearing executable stack marking from binary B"
|
|
rlRun "execstack --query B > out" 0 "Querying binary B"
|
|
rlAssertGrep "^-" "out"
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStartCleanup
|
|
rlRun "popd"
|
|
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
|
rlPhaseEnd
|
|
rlJournalEnd
|
|
|
|
rlJournalPrintText
|