mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 10:18:31 +00:00
Delete ASAN
It hasn't been helpful enough to be justify the maintenance burden. What actually does help is mprotect(), kprintf(), --ftrace and --strace which can always be counted upon to work correctly. We aren't losing much with this change. Support for ASAN on AARCH64 was never implemented. Applying ASAN to the core libc runtimes was disabled many months ago. If there is some way to have an ASAN runtime for user programs that is less invasive we can potentially consider reintroducing support. But now is premature.
This commit is contained in:
parent
6ffed14b9c
commit
d1d4388201
198 changed files with 130 additions and 2954 deletions
|
@ -27,7 +27,6 @@
|
|||
#include "libc/calls/wincrash.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/ulock.h"
|
||||
|
@ -751,13 +750,6 @@ errno_t clone(void *func, void *stk, size_t stksz, int flags, void *arg,
|
|||
|
||||
if (!func) {
|
||||
rc = EINVAL;
|
||||
} else if (IsAsan() &&
|
||||
(((flags & CLONE_SETTLS) && !__asan_is_valid(tls, 64)) ||
|
||||
((flags & CLONE_PARENT_SETTID) &&
|
||||
!__asan_is_valid(ptid, sizeof(int))) ||
|
||||
((flags & CLONE_CHILD_SETTID) &&
|
||||
!__asan_is_valid(ctid, sizeof(int))))) {
|
||||
rc = EFAULT;
|
||||
} else if (IsLinux()) {
|
||||
rc = CloneLinux(func, stk, stksz, flags, arg, tls, ptid, ctid);
|
||||
} else if (!IsTiny() &&
|
||||
|
|
|
@ -134,16 +134,6 @@ cosmo: push %rbp
|
|||
pop %rdi
|
||||
.init.end 304,_init_tls
|
||||
|
||||
#if IsAsan()
|
||||
.init.start 305,_init_symbols
|
||||
push %rdi
|
||||
push %rsi
|
||||
call __init_symbols
|
||||
pop %rsi
|
||||
pop %rdi
|
||||
.init.end 305,_init_symbols
|
||||
#endif
|
||||
|
||||
#ifdef FTRACE
|
||||
.init.start 306,_init_ftrace
|
||||
push %rdi
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/asancodes.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/intrin/dll.h"
|
||||
#include "libc/intrin/getenv.internal.h"
|
||||
|
@ -151,22 +149,12 @@ textstartup void __enable_tls(void) {
|
|||
mem = _weaken(_mapanon)(siz);
|
||||
}
|
||||
|
||||
if (IsAsan()) {
|
||||
// poison the space between .tdata and .tbss
|
||||
__asan_poison(mem + I(_tdata_size), I(_tbss_offset) - I(_tdata_size),
|
||||
kAsanProtected);
|
||||
}
|
||||
|
||||
struct CosmoTib *tib = (struct CosmoTib *)(mem + siz - sizeof(*tib));
|
||||
char *tls = mem + siz - sizeof(*tib) - I(_tls_size);
|
||||
|
||||
// copy in initialized data section
|
||||
if (I(_tdata_size)) {
|
||||
if (IsAsan()) {
|
||||
__asan_memcpy(tls, _tdata_start, I(_tdata_size));
|
||||
} else {
|
||||
memcpy(tls, _tdata_start, I(_tdata_size));
|
||||
}
|
||||
memcpy(tls, _tdata_start, I(_tdata_size));
|
||||
}
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/asancodes.h"
|
||||
#include "libc/runtime/memtrack.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/stack.h"
|
||||
|
@ -55,10 +53,6 @@ void *NewCosmoStack(void) {
|
|||
-1, 0, 0) != p) {
|
||||
notpossible;
|
||||
}
|
||||
if (IsAsan()) {
|
||||
__asan_poison(p + n - 16, 16, kAsanStackOverflow);
|
||||
__asan_poison(p, getauxval(AT_PAGESZ), kAsanStackOverflow);
|
||||
}
|
||||
return p;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "libc/runtime/symbols.internal.h"
|
||||
|
||||
void __init_symbols(void) {
|
||||
if (__strace > 0 || (IsAsan() && _weaken(__die))) {
|
||||
if (__strace > 0)
|
||||
GetSymbolTable();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/intrin/cmpxchg.h"
|
||||
#include "libc/intrin/directmap.internal.h"
|
||||
|
@ -94,10 +93,6 @@ void __zipos_drop(struct ZiposHandle *h) {
|
|||
return;
|
||||
}
|
||||
atomic_thread_fence(memory_order_acquire);
|
||||
if (IsAsan()) {
|
||||
__asan_poison((char *)h + sizeof(struct ZiposHandle),
|
||||
h->mapsize - sizeof(struct ZiposHandle), kAsanHeapFree);
|
||||
}
|
||||
__zipos_lock();
|
||||
do
|
||||
h->next = h->zipos->freelist;
|
||||
|
@ -125,12 +120,6 @@ StartOver:
|
|||
h = __zipos_mmap_space(mapsize);
|
||||
}
|
||||
__zipos_unlock();
|
||||
if (IsAsan()) {
|
||||
__asan_unpoison((char *)h, sizeof(struct ZiposHandle) + size);
|
||||
__asan_poison((char *)h + sizeof(struct ZiposHandle) + size,
|
||||
mapsize - (sizeof(struct ZiposHandle) + size),
|
||||
kAsanHeapOverrun);
|
||||
}
|
||||
if (h) {
|
||||
atomic_store_explicit(&h->refs, 0, memory_order_relaxed);
|
||||
h->size = size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue