Skip to content

Commit 520bcf8

Browse files
committed
chore: add .venv and build artifacts to .gitignore
1 parent 04ce267 commit 520bcf8

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,14 @@
2929
*.env
3030
.env
3131
tools/discord_audit_bot/.env
32+
# Python venv
33+
.venv/
34+
# Rust/C build artifacts
35+
/target/
36+
/**/target/
37+
/poCs/cache/flush_reload_attacker
38+
/poCs/cache/flush_reload_attacker_csv
39+
/poCs/cache/victim_sim
40+
# local env files
41+
.env
42+
tools/discord_audit_bot/.env
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// flush_reload_attacker_csv.c
2+
// Compile: gcc -O2 -o flush_reload_attacker_csv flush_reload_attacker_csv.c -march=native
3+
#include <stdio.h>
4+
#include <stdint.h>
5+
#include <x86intrin.h>
6+
#include <unistd.h>
7+
8+
#define ITER 20000
9+
10+
static inline uint64_t timed_read(volatile char *addr) {
11+
unsigned int aux;
12+
uint64_t t1 = __rdtscp(&aux);
13+
volatile unsigned char v = *addr;
14+
uint64_t t2 = __rdtscp(&aux);
15+
(void)v;
16+
return t2 - t1;
17+
}
18+
19+
int main(void) {
20+
static char probe[4096*256];
21+
volatile char *addr = &probe[4096*42];
22+
23+
// CSV 헤더
24+
printf("iter,cycles\n");
25+
26+
for (int i = 0; i < ITER; i++) {
27+
_mm_clflush((void*)addr); // 캐시에서 해당 라인 flush
28+
asm volatile("mfence" ::: "memory"); // 순서 보장 fence
29+
usleep(100); // victim이 접근할 시간 약간 부여(100µs)
30+
31+
uint64_t t = timed_read(addr); // 접근 시간 측정
32+
printf("%d,%lu\n", i, (unsigned long)t); // CSV 라인 출력
33+
}
34+
return 0;
35+
}

0 commit comments

Comments
 (0)