src/executor/x86: Evict+Reload mode
This commit is contained in:
Родитель
acdd792678
Коммит
8d679e1b59
|
@ -23,8 +23,6 @@ def check_config():
|
||||||
assert CONF.prng_seed != 0 # deprecated?
|
assert CONF.prng_seed != 0 # deprecated?
|
||||||
if CONF.max_outliers > 20:
|
if CONF.max_outliers > 20:
|
||||||
print("Are you sure you want to ignore so many outliers?")
|
print("Are you sure you want to ignore so many outliers?")
|
||||||
if CONF.attack_variant not in ["F+R", "P+P"]:
|
|
||||||
print("CONFIG: Unknown attack_variant")
|
|
||||||
|
|
||||||
|
|
||||||
def ensure_reliable_environment():
|
def ensure_reliable_environment():
|
||||||
|
|
|
@ -75,7 +75,7 @@ class ConfCls:
|
||||||
warmups: int = 1
|
warmups: int = 1
|
||||||
num_measurements: int = 40
|
num_measurements: int = 40
|
||||||
max_outliers = 3
|
max_outliers = 3
|
||||||
attack_variant: str = 'P+P' # options: 'F+R', 'P+P'
|
attack_variant: str = 'P+P'
|
||||||
enable_ssbp_patch: bool = True
|
enable_ssbp_patch: bool = True
|
||||||
enable_pre_run_flush: bool = True
|
enable_pre_run_flush: bool = True
|
||||||
enable_mds: bool = False
|
enable_mds: bool = False
|
||||||
|
@ -92,6 +92,10 @@ class ConfCls:
|
||||||
verbose: int = 0
|
verbose: int = 0
|
||||||
|
|
||||||
def set(self, name, value):
|
def set(self, name, value):
|
||||||
|
options = {
|
||||||
|
'attack_variant': ['P+P', 'F+R', 'E+R']
|
||||||
|
}
|
||||||
|
|
||||||
if self.__getattribute__(name) is None:
|
if self.__getattribute__(name) is None:
|
||||||
print(f"Error: Unknown configuration variable {name}.\n"
|
print(f"Error: Unknown configuration variable {name}.\n"
|
||||||
f"It's likely a typo in the configuration file.")
|
f"It's likely a typo in the configuration file.")
|
||||||
|
@ -100,7 +104,13 @@ class ConfCls:
|
||||||
print(f"Error: Wrong type of the configuration variable {name}.\n"
|
print(f"Error: Wrong type of the configuration variable {name}.\n"
|
||||||
f"It's likely a typo in the configuration file.")
|
f"It's likely a typo in the configuration file.")
|
||||||
exit(1)
|
exit(1)
|
||||||
# TODO: would be great to do some sanity checks before setting changing the value
|
|
||||||
|
# value checks
|
||||||
|
# TODO: would be great to have more of these
|
||||||
|
if options.get(name, '') != '' and value not in options[name]:
|
||||||
|
print(f"Error: Unknown value '{value}' of configuration variable '{name}'")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
self.__setattr__(name, value)
|
self.__setattr__(name, value)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,7 @@ class X86Intel(Executor):
|
||||||
"/sys/x86-executor/enable_ssbp_patch")
|
"/sys/x86-executor/enable_ssbp_patch")
|
||||||
write_to_pseudo_file("1" if CONF.enable_ssbp_patch else "0",
|
write_to_pseudo_file("1" if CONF.enable_ssbp_patch else "0",
|
||||||
"/sys/x86-executor/enable_pre_run_flush")
|
"/sys/x86-executor/enable_pre_run_flush")
|
||||||
if CONF.attack_variant == 'F+R':
|
write_to_pseudo_file(CONF.attack_variant, "/sys/x86-executor/measurement_mode")
|
||||||
write_to_pseudo_file("F", "/sys/x86-executor/measurement_mode")
|
|
||||||
elif CONF.attack_variant == 'P+P':
|
|
||||||
write_to_pseudo_file("P", "/sys/x86-executor/measurement_mode")
|
|
||||||
write_to_pseudo_file(CONF.input_mask, '/sys/x86-executor/input_mask')
|
write_to_pseudo_file(CONF.input_mask, '/sys/x86-executor/input_mask')
|
||||||
|
|
||||||
def load_test_case(self, test_case_asm: str):
|
def load_test_case(self, test_case_asm: str):
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7aab81bcfd1d381f7afb6bf03a5233bc92da8679
|
Subproject commit 3d1f2757630e429c2f4a99a79f39c5f518cdffad
|
|
@ -0,0 +1,4 @@
|
||||||
|
contract_observation_mode: ct
|
||||||
|
contract_execution_mode:
|
||||||
|
- seq
|
||||||
|
attack_variant: E+R
|
|
@ -20,6 +20,13 @@ FAST_TEST=1
|
||||||
[[ "$output" == *"2305843009213693953"* ]]
|
[[ "$output" == *"2305843009213693953"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "Executor: Hardware tracing with E+R" {
|
||||||
|
bash -c "./cli.py fuzz -s $INSTRUCTION_SET -t tests/evict_second_line.asm -c tests/ct-seq-er.yaml -i 3"
|
||||||
|
run cat measurement.txt
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" == *"2305843009213693952"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
@test "Model and Executor are initialized with the same register and memory values" {
|
@test "Model and Executor are initialized with the same register and memory values" {
|
||||||
run bash -c "./cli.py fuzz -s $INSTRUCTION_SET -t tests/model_match.asm -c tests/model_match.yaml -i 1000"
|
run bash -c "./cli.py fuzz -s $INSTRUCTION_SET -t tests/model_match.asm -c tests/model_match.yaml -i 1000"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче