We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2bbbfd8 + 37b4c6b commit 457eb62Copy full SHA for 457eb62
lab5/antiasan.c
@@ -1,6 +1,14 @@
1
-#include <string.h>
+// antiasan.c
2
+#include "antiasan.h"
3
+#include <sanitizer/asan_interface.h>
4
5
void antiasan(unsigned long addr)
6
{
7
+ // addr 是 &gBadBuf,gS 緊接在它前面 0x18 bytes
8
+ // 我們直接往前退 0x20 bytes,解毒整塊 gS + 之後很大一段,
9
+ // 確保把中間那段紅區(redzone) 都 unpoison 掉
10
+ void *start = (void*)(addr - 0x20);
11
+ size_t len = 0x200; // 解毒 0x200 bytes(512 bytes),足夠覆蓋所有紅區
12
13
+ __asan_unpoison_memory_region(start, len);
14
}
0 commit comments