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:
Justine Tunney 2024-06-22 05:45:49 -07:00
parent 6ffed14b9c
commit d1d4388201
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
198 changed files with 130 additions and 2954 deletions

View file

@ -50,7 +50,6 @@ $(LIBC_PROC_A).pkg: \
$(LIBC_PROC_A_OBJS): private \
COPTS += \
-fno-sanitize=address \
-Wframe-larger-than=4096 \
-Walloca-larger-than=4096

View file

@ -22,7 +22,6 @@
#include "libc/calls/syscall-nt.internal.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/likely.h"
#include "libc/intrin/promises.internal.h"
@ -63,10 +62,7 @@
int execve(const char *prog, char *const argv[], char *const envp[]) {
int rc;
struct ZiposUri uri;
if (!prog || !argv || !envp ||
(IsAsan() && (!__asan_is_valid_str(prog) || //
!__asan_is_valid_strlist(argv) || //
!__asan_is_valid_strlist(envp)))) {
if (!prog || !argv || !envp) {
rc = efault();
} else {
STRACE("execve(%#s, %s, %s)", prog, DescribeStringList(argv),

View file

@ -18,7 +18,6 @@
*/
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/limits.h"
#include "libc/mem/alloca.h"
#include "libc/mem/mem.h"
@ -46,12 +45,6 @@ int execvpe(const char *prog, char *const argv[], char *const *envp) {
char *exe, **argv2;
char pathbuf[PATH_MAX];
// validate memory
if (IsAsan() &&
(!__asan_is_valid_str(prog) || !__asan_is_valid_strlist(argv))) {
return efault();
}
if (strchr(prog, '/')) {
return execve(prog, argv, envp);
}

View file

@ -27,7 +27,6 @@
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/safemacros.internal.h"
@ -186,9 +185,7 @@ static int fd_to_mem_fd(const int infd, char *path) {
*/
int fexecve(int fd, char *const argv[], char *const envp[]) {
int rc = 0;
if (!argv || !envp ||
(IsAsan() &&
(!__asan_is_valid_strlist(argv) || !__asan_is_valid_strlist(envp)))) {
if (!argv || !envp) {
rc = efault();
} else {
STRACE("fexecve(%d, %s, %s) → ...", fd, DescribeStringList(argv),

View file

@ -20,7 +20,6 @@
#include "libc/calls/struct/rusage.h"
#include "libc/calls/struct/rusage.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/sysv/errfuns.h"
@ -34,8 +33,6 @@ int getrusage(int who, struct rusage *usage) {
int rc;
if (who == 99) {
rc = einval();
} else if (IsAsan() && usage && !__asan_is_valid(usage, sizeof(*usage))) {
rc = efault();
} else if (!IsWindows()) {
rc = sys_getrusage(who, usage);
} else {

View file

@ -35,7 +35,6 @@
#include "libc/errno.h"
#include "libc/fmt/itoa.h"
#include "libc/fmt/magnumstrs.internal.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/atomic.h"
#include "libc/intrin/bsf.h"
#include "libc/intrin/describeflags.internal.h"
@ -419,10 +418,7 @@ static textwindows dontinline errno_t posix_spawn_nt(
int *pid, const char *path, const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp, char *const argv[], char *const envp[]) {
int err;
if (!path || !argv ||
(IsAsan() && (!__asan_is_valid_str(path) || //
!__asan_is_valid_strlist(argv) || //
(envp && !__asan_is_valid_strlist(envp))))) {
if (!path || !argv) {
err = EFAULT;
} else {
err = posix_spawn_nt_impl(pid, path, file_actions, attrp, argv, envp);

View file

@ -20,7 +20,6 @@
#include "libc/calls/cp.internal.h"
#include "libc/calls/struct/rusage.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/proc/proc.internal.h"
#include "libc/sysv/errfuns.h"
@ -44,13 +43,7 @@ int wait4(int pid, int *opt_out_wstatus, int options,
int rc, ws = 0;
BEGIN_CANCELATION_POINT;
if (IsAsan() &&
((opt_out_wstatus &&
!__asan_is_valid(opt_out_wstatus, sizeof(*opt_out_wstatus))) ||
(opt_out_rusage &&
!__asan_is_valid(opt_out_rusage, sizeof(*opt_out_rusage))))) {
rc = efault();
} else if (!IsWindows()) {
if (!IsWindows()) {
rc = sys_wait4(pid, &ws, options, opt_out_rusage);
} else {
rc = sys_wait4_nt(pid, &ws, options, opt_out_rusage);