-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
134 lines (101 loc) · 3.96 KB
/
Makefile
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
COMPILER=gcc
EXTRA_FLAGS=-j8 #V=1
SAFEFETCH_DIR=safefetch
MIDAS_DIR=midas
# Give some random unexisting SAVED_DIR as default (save_kernel will simply remove all other kernel but not install anything)
SAVED_DIR?=dummy
KERNEL_NAME=$(shell ./get_version.sh ${SAVED_DIR})
KERNEL_VERSION=$(shell ./get_version.sh $(shell uname -r))
all: version
setup:
./setup.sh
governor:
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
cpu_scaling: governor
./warmup.sh
all_bench_timestamped: cpu_scaling
BENCHNAME=${BUILD_STRING}-$$(date '+%d-%b-%g-%Hh%Mm') ;\
./run_lmbench.sh $$BENCHNAME ;\
./run_osbench.sh $$BENCHNAME ;\
./run_phoronix.sh $$BENCHNAME ;\
all_bench: cpu_scaling
BENCHNAME=${BUILD_STRING} ;\
./run_lmbench.sh $$BENCHNAME ;\
./run_osbench.sh $$BENCHNAME ;\
./run_phoronix.sh $$BENCHNAME ;\
phoronix_result:
cd ./playground/performance; \
./phoronix_to_csv.sh; \
# Result aggregation
result: phoronix_result
set -e; \
cd ./playground/performance; \
python3 ./lmbench_to_csv.py; \
python3 ./osbench_to_csv.py; \
set +e; \
# Result representation (write to pdf file)
paper:
cd ./playground/paper/scripts && python3 ./generate_plots.py && cd .. && make all && cd ../..
all-paper: result paper
# Kernel compilation
def_safefetch_config:
make -C $(SAFEFETCH_DIR) mrproper
make -C $(SAFEFETCH_DIR) x86_64_defconfig CC=$(COMPILER) LD=ld
local_safefetch_config:
make -C $(SAFEFETCH_DIR) mrproper
yes "" | make -C $(SAFEFETCH_DIR) localmodconfig
cd $(SAFEFETCH_DIR); ./scripts/config -d CONFIG_DEBUG_INFO_BTF ; cd ..
safefetch_config:
cd $(SAFEFETCH_DIR); ./scripts/config -e CONFIG_SAFEFETCH; cd ..
compile_safefetch:
yes "" | make -C $(SAFEFETCH_DIR) CC=$(COMPILER) LD=ld $(EXTRA_FLAGS)
make -C $(SAFEFETCH_DIR) modules CC=$(COMPILER) LD=ld $(EXTRA_FLAGS)
sudo make -C $(SAFEFETCH_DIR) modules_install CC=$(COMPILER) LD=ld $(EXTRA_FLAGS)
sudo make -C $(SAFEFETCH_DIR) install CC=$(COMPILER) LD=ld $(EXTRA_FLAGS)
all_local_safefetch: local_safefetch_config safefetch_config compile_safefetch
all_default_safefetch: def_safefetch_config safefetch_config compile_safefetch
def_midas_config:
make -C $(MIDAS_DIR) mrproper
make -C $(MIDAS_DIR) x86_64_defconfig CC=$(COMPILER) LD=ld
local_midas_config:
make -C $(MIDAS_DIR) mrproper
yes "" | make -C $(MIDAS_DIR) localmodconfig
cd $(MIDAS_DIR); ./scripts/config -d CONFIG_DEBUG_INFO_BTF ; cd ..
midas_config:
cd $(MIDAS_DIR); ./scripts/config -e CONFIG_TOCTTOU_PROTECTION; cd ..
compile_midas:
yes "" | make -C $(MIDAS_DIR) CC=$(COMPILER) LD=ld $(EXTRA_FLAGS)
make -C $(MIDAS_DIR) modules CC=$(COMPILER) LD=ld $(EXTRA_FLAGS)
sudo make -C $(MIDAS_DIR) modules_install CC=$(COMPILER) LD=ld $(EXTRA_FLAGS)
sudo make -C $(MIDAS_DIR) install CC=$(COMPILER) LD=ld $(EXTRA_FLAGS)
all_local_midas: local_midas_config midas_config compile_midas
all_default_midas: def_midas_config midas_config compile_midas
# Loading the kernel onto the machine
version:
@echo "Artifact for paper SafeFetch"
@echo You ar running the artifact on machine:[$(KERNEL_VERSION)]
@echo If the output of the previous line contains [no-version]
@echo you are not running a kernel that comes with this artifact
clean_kernels:
./save_kernel.sh -silent-clean safefetch
./save_kernel.sh -silent-clean whitelist
./save_kernel.sh -silent-clean midas
./save_kernel.sh -silent-clean exploit
load_kernel: clean_kernels
@echo Loading kernel $(KERNEL_NAME) from $(SAVED_DIR)
./save_kernel.sh -restore $(KERNEL_NAME) $(SAVED_DIR)
./configure_grub.sh
# Running performance artifact
run_performance_artifact:
@echo Running performance artifact on local machine
./run_performance_artifact.sh $(KERNEL_VERSION)
# Running security artifact
run_security_artifact:
@echo Running security artifact on local machine
./run_security_artifact.sh $(KERNEL_VERSION)
clean_artifact: clean_kernels
@echo Cleaning installed kernels and reverting to default machine kernel
./clean_artifact.sh
verify_install:
./basic_install_test.sh
#.PHONY: paper