summaryrefslogtreecommitdiff
path: root/test.sh
blob: a50b3bc862b599fb066fd724412861b63c2ea9d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

GEM5="./build/X86_MESI_Two_Level/gem5.opt -q configs/example/se.py --cpu-type=DerivO3CPU --ruby --needsTSO=1 --output=stdout.txt"
SCMS=(
"--scheme=UnsafeBaseline"
"--scheme=SpectreSafeInvisibleSpec --useIFT=0"
"--scheme=SpectreSafeInvisibleSpec --useIFT=1 --trackBranch=0"
"--scheme=SpectreSafeInvisibleSpec --useIFT=1 --trackBranch=1"
"--scheme=SpectreSafeFence --useIFT=0"
"--scheme=SpectreSafeFence --useIFT=1 --trackBranch=0"
"--scheme=SpectreSafeFence --useIFT=1 --trackBranch=1"
)

echo "Testing Spectre PoC victim function"
for scm in "${SCMS[@]}"
do
	echo "$scm"
	$GEM5 $scm -c attack
	grep hit stdout.txt && echo unsafe || echo safe
done

echo "Testing victim function v10"
for scm in "${SCMS[@]}"
do
	echo "$scm"
	$GEM5 $scm -c attack_v10
	grep '^[123]' stdout.txt && echo unsafe || echo safe
done