mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-23 02:50:29 +00:00
Get address sanitizer mostly working
This commit is contained in:
parent
1f1f3cd477
commit
7327c345f9
149 changed files with 3777 additions and 3457 deletions
34
libc/mem/hook/calloc.S
Normal file
34
libc/mem/hook/calloc.S
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_calloc
|
||||
hook$calloc:
|
||||
.quad 0
|
||||
.endobj hook$calloc,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_calloc
|
||||
.hidden dlcalloc
|
||||
ezlea dlcalloc,ax
|
||||
stosq
|
||||
yoink free
|
||||
.init.end 202,_init_calloc
|
35
libc/mem/hook/free.S
Normal file
35
libc/mem/hook/free.S
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_free
|
||||
hook$free:
|
||||
.quad 0
|
||||
.endobj hook$free,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_free
|
||||
ezlea dlfree,ax
|
||||
stosq
|
||||
yoink realloc
|
||||
.init.end 202,_init_free
|
||||
|
||||
.hidden dlfree
|
18
libc/mem/hook/hook.h
Normal file
18
libc/mem/hook/hook.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_
|
||||
#define COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern void (*hook$free)(void *);
|
||||
extern void *(*hook$malloc)(size_t);
|
||||
extern void *(*hook$calloc)(size_t, size_t);
|
||||
extern void *(*hook$memalign)(size_t, size_t);
|
||||
extern void *(*hook$realloc)(void *, size_t);
|
||||
extern void *(*hook$realloc_in_place)(void *, size_t);
|
||||
extern void *(*hook$valloc)(size_t);
|
||||
extern void *(*hook$pvalloc)(size_t);
|
||||
extern size_t (*hook$malloc_usable_size)(const void *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_MEM_HOOK_HOOK_H_ */
|
34
libc/mem/hook/malloc.S
Normal file
34
libc/mem/hook/malloc.S
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_malloc
|
||||
hook$malloc:
|
||||
.quad 0
|
||||
.endobj hook$malloc,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_malloc
|
||||
.hidden dlmalloc
|
||||
ezlea dlmalloc,ax
|
||||
stosq
|
||||
yoink free
|
||||
.init.end 202,_init_malloc
|
33
libc/mem/hook/malloc_usable_size.S
Normal file
33
libc/mem/hook/malloc_usable_size.S
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_malloc_usable_size
|
||||
hook$malloc_usable_size:
|
||||
.quad 0
|
||||
.endobj hook$malloc_usable_size,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_malloc_usable_size
|
||||
.hidden dlmalloc_usable_size
|
||||
ezlea dlmalloc_usable_size,ax
|
||||
stosq
|
||||
.init.end 202,_init_malloc_usable_size
|
34
libc/mem/hook/memalign.S
Normal file
34
libc/mem/hook/memalign.S
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_memalign
|
||||
hook$memalign:
|
||||
.quad 0
|
||||
.endobj hook$memalign,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_memalign
|
||||
.hidden dlmemalign
|
||||
ezlea dlmemalign,ax
|
||||
stosq
|
||||
yoink free
|
||||
.init.end 202,_init_memalign
|
34
libc/mem/hook/posix_memalign.S
Normal file
34
libc/mem/hook/posix_memalign.S
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_posix_memalign
|
||||
hook$posix_memalign:
|
||||
.quad 0
|
||||
.endobj hook$posix_memalign,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_posix_memalign
|
||||
.hidden dlposix_memalign
|
||||
ezlea dlposix_memalign,ax
|
||||
stosq
|
||||
yoink free
|
||||
.init.end 202,_init_posix_memalign
|
34
libc/mem/hook/pvalloc.S
Normal file
34
libc/mem/hook/pvalloc.S
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_pvalloc
|
||||
hook$pvalloc:
|
||||
.quad 0
|
||||
.endobj hook$pvalloc,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_pvalloc
|
||||
.hidden dlpvalloc
|
||||
ezlea dlpvalloc,ax
|
||||
stosq
|
||||
yoink free
|
||||
.init.end 202,_init_pvalloc
|
34
libc/mem/hook/realloc.S
Normal file
34
libc/mem/hook/realloc.S
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_realloc
|
||||
hook$realloc:
|
||||
.quad 0
|
||||
.endobj hook$realloc,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_realloc
|
||||
.hidden dlrealloc
|
||||
ezlea dlrealloc,ax
|
||||
stosq
|
||||
yoink free
|
||||
.init.end 202,_init_realloc
|
34
libc/mem/hook/realloc_in_place.S
Normal file
34
libc/mem/hook/realloc_in_place.S
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_realloc_in_place
|
||||
hook$realloc_in_place:
|
||||
.quad 0
|
||||
.endobj hook$realloc_in_place,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_realloc_in_place
|
||||
.hidden dlrealloc_in_place
|
||||
ezlea dlrealloc_in_place,ax
|
||||
stosq
|
||||
yoink free
|
||||
.init.end 202,_init_realloc_in_place
|
34
libc/mem/hook/valloc.S
Normal file
34
libc/mem/hook/valloc.S
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
.initbss 202,_init_valloc
|
||||
hook$valloc:
|
||||
.quad 0
|
||||
.endobj hook$valloc,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 202,_init_valloc
|
||||
.hidden dlvalloc
|
||||
ezlea dlvalloc,ax
|
||||
stosq
|
||||
yoink free
|
||||
.init.end 202,_init_valloc
|
Loading…
Add table
Add a link
Reference in a new issue