cosmopolitan/tool/build/lib
Justine Tunney 226aaf3547 Improve memory safety
This commit makes numerous refinements to cosmopolitan memory handling.

The default stack size has been reduced from 2mb to 128kb. A new macro
is now provided so you can easily reconfigure the stack size to be any
value you want. Work around the breaking change by adding to your main:

    STATIC_STACK_SIZE(0x00200000);  // 2mb stack

If you're not sure how much stack you need, then you can use:

    STATIC_YOINK("stack_usage_logging");

After which you can `sort -nr o/$MODE/stack.log`. Based on the unit test
suite, nothing in the Cosmopolitan repository (except for Python) needs
a stack size greater than 30kb. There are also new macros for detecting
the size and address of the stack at runtime, e.g. GetStackAddr(). We
also now support sigaltstack() so if you want to see nice looking crash
reports whenever a stack overflow happens, you can put this in main():

    ShowCrashReports();

Under `make MODE=dbg` and `make MODE=asan` the unit testing framework
will now automatically print backtraces of memory allocations when
things like memory leaks happen. Bugs are now fixed in ASAN global
variable overrun detection. The memtrack and asan runtimes also handle
edge cases now. The new tools helped to identify a few memory leaks,
which are fixed by this change.

This change should fix an issue reported in #288 with ARG_MAX limits.
Fixing this doubled the performance of MKDEPS.COM and AR.COM yet again.
2021-10-13 17:27:13 -07:00
..
abp.h Add x86_64-linux-gnu emulator 2020-08-25 04:43:42 -07:00
address.c Change license 2020-12-27 17:18:44 -08:00
address.h Add The LISP Challenge 2020-10-01 01:20:13 -07:00
alu.c Change license 2020-12-27 17:18:44 -08:00
alu.h Add minor improvements and cleanup 2020-10-27 03:39:46 -07:00
argv.c Remove garbage collector macro from header (#114) 2021-03-07 20:23:29 -08:00
argv.h Make terminal ui binaries work well everywhere 2020-10-19 06:38:31 -07:00
asmdown.c Change license 2020-12-27 17:18:44 -08:00
asmdown.h Improve documentation 2020-12-27 07:02:35 -08:00
bcd.c Change license 2020-12-27 17:18:44 -08:00
bcd.h Make improvements 2020-09-14 00:02:34 -07:00
bitscan.c Improve signal handling and math 2021-02-25 18:33:33 -08:00
bitscan.h Make improvements 2020-09-14 00:02:34 -07:00
breakpoint.c Change license 2020-12-27 17:18:44 -08:00
breakpoint.h Add pseudoteletypewriter to emulator 2020-08-29 23:51:09 -07:00
breg.c Change license 2020-12-27 17:18:44 -08:00
buffer.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
buffer.h Get binaries closer to running without an o/s 2020-11-02 19:12:47 -08:00
buildlib.mk Introduce Python objectifier (#259) 2021-09-04 15:44:00 -07:00
case.h Fix bugs and have emulator emulate itself 2020-08-31 05:17:31 -07:00
cga.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cga.h Make more improvements 2020-09-28 01:20:34 -07:00
clmul.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
clmul.h Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
cpuid.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
cpuid.h Make improvements 2020-09-14 00:02:34 -07:00
cvt.c Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
cvt.h Make improvements 2020-09-14 00:02:34 -07:00
debug.c Make numerous improvements 2021-09-28 01:52:34 -07:00
demangle.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
demangle.h Add fixes performance and static web server 2020-10-05 23:11:49 -07:00
dis.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
dis.h Add minor improvements and cleanup 2020-10-27 03:39:46 -07:00
disarg.c Make improvements to redbean 2021-07-10 15:19:37 -07:00
diself.c Make %p consistent with glibc and musl 2021-03-06 14:36:44 -08:00
disinst.c Change license 2020-12-27 17:18:44 -08:00
disspec.c Improve signal handling and math 2021-02-25 18:33:33 -08:00
divmul.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
divmul.h Add pseudoteletypewriter to emulator 2020-08-29 23:51:09 -07:00
elfwriter.c Make mappings unlimited on NT 2021-09-04 13:20:47 -07:00
elfwriter.h Implement tree-shaking for Python sources 2021-09-05 01:20:03 -07:00
elfwriter_cargoculting.c Change license 2020-12-27 17:18:44 -08:00
elfwriter_yoink.c Implement tree-shaking for Python sources 2021-09-05 01:20:03 -07:00
elfwriter_zip.c Introduce Python objectifier (#259) 2021-09-04 15:44:00 -07:00
endian.h Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
errnos.S Make redbean StoreAsset() work better 2021-05-14 05:44:37 -07:00
eztls.c Refactor out some duplicated code 2021-08-14 06:17:56 -07:00
eztls.h Refactor out some duplicated code 2021-08-14 06:17:56 -07:00
fds.c Change license 2020-12-27 17:18:44 -08:00
fds.h finish intellisense support and sync with upstream 2021-02-03 13:50:08 -05:00
flags.c Change license 2020-12-27 17:18:44 -08:00
flags.h Add minor improvements and cleanup 2020-10-27 03:39:46 -07:00
fpu.c Make numerous improvements 2021-09-28 01:52:34 -07:00
fpu.h Make improvements 2020-09-14 00:02:34 -07:00
getargs.c Improve memory safety 2021-10-13 17:27:13 -07:00
getargs.h Improve memory safety 2021-10-13 17:27:13 -07:00
high.c Change license 2020-12-27 17:18:44 -08:00
high.h Make more improvements 2020-09-28 01:20:34 -07:00
instruction.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
interner.c Improve Python tree-shaking 2021-09-06 19:24:10 -07:00
interner.h Improve Python tree-shaking 2021-09-06 19:24:10 -07:00
ioports.c Change license 2020-12-27 17:18:44 -08:00
ioports.h Add x86_64-linux-gnu emulator 2020-08-25 04:43:42 -07:00
iovs.c Change license 2020-12-27 17:18:44 -08:00
iovs.h Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
isnocompressext.c Undiamond Python headers 2021-08-12 14:07:40 -07:00
isnocompressext.h Undiamond Python headers 2021-08-12 14:07:40 -07:00
javadown.c Make numerous improvements 2021-09-28 01:52:34 -07:00
javadown.h finish intellisense support and sync with upstream 2021-02-03 13:50:08 -05:00
lines.c Add help dialog to Blinkenlights emulator 2021-02-19 17:16:17 -08:00
lines.h Add help dialog to Blinkenlights emulator 2021-02-19 17:16:17 -08:00
loader.c Make numerous improvements 2021-09-28 01:52:34 -07:00
loader.h Make improvements 2020-09-14 00:02:34 -07:00
machine.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
machine.h Make numerous improvements 2021-09-28 01:52:34 -07:00
mda.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
mda.h Make improvements 2020-09-14 00:02:34 -07:00
memory.c Refactor some Blinkenlights code 2021-03-03 13:09:06 -08:00
memory.h Refactor some Blinkenlights code 2021-03-03 13:09:06 -08:00
memorymalloc.c Make numerous improvements 2021-09-28 01:52:34 -07:00
message.c Make numerous improvements 2021-09-28 01:52:34 -07:00
modrm.c Remove undefined behaviors 2021-05-16 11:16:28 -07:00
modrm.h Perform some code cleanup 2021-02-27 10:33:32 -08:00
op101.c Improve logger API (#262) 2021-09-03 21:14:26 -07:00
op101.h Add minor improvements and cleanup 2020-10-27 03:39:46 -07:00
panel.c Productionize new APE loader and more 2021-10-02 08:27:03 -07:00
panel.h Add minor improvements and cleanup 2020-10-27 03:39:46 -07:00
persist.c Remove garbage collector macro from header (#114) 2021-03-07 20:23:29 -08:00
persist.h finish intellisense support and sync with upstream 2021-02-03 13:50:08 -05:00
pml4t.c Change license 2020-12-27 17:18:44 -08:00
pml4t.h Fix missing header include 2020-11-07 00:05:25 -08:00
pml4tfmt.c Make %p consistent with glibc and musl 2021-03-06 14:36:44 -08:00
psk.c Improve linenoise and get it working on Windows 2021-08-15 14:34:05 -07:00
psk.h Secure the testing infrastructure 2021-08-07 13:22:35 -07:00
pty.c Make numerous improvements 2021-09-28 01:52:34 -07:00
pty.h Add minor improvements and cleanup 2020-10-27 03:39:46 -07:00
reset.c Make numerous improvements 2021-09-28 01:52:34 -07:00
sse.c Make numerous improvements 2021-09-28 01:52:34 -07:00
sse.h Make more improvements 2020-09-28 01:20:34 -07:00
ssefloat.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ssefloat.h Add chibicc 2020-12-06 16:20:21 -08:00
ssemov.c Change license 2020-12-27 17:18:44 -08:00
ssemov.h Make improvements 2020-09-14 00:02:34 -07:00
stack.c Make numerous improvements 2021-09-28 01:52:34 -07:00
stack.h Get binaries closer to running without an o/s 2020-11-02 19:12:47 -08:00
stats.c Change license 2020-12-27 17:18:44 -08:00
stats.h Add minor improvements and cleanup 2020-10-27 03:39:46 -07:00
string.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
string.h Make improvements 2020-09-14 00:02:34 -07:00
stripcomponents.c Experiment with making Python go faster 2021-08-18 21:57:11 -07:00
stripcomponents.h Undiamond Python headers 2021-08-12 14:07:40 -07:00
syscall.c Improve memory safety 2021-10-13 17:27:13 -07:00
syscall.h Make improvements 2020-09-14 00:02:34 -07:00
throw.c Make numerous improvements 2021-09-28 01:52:34 -07:00
throw.h Add chibicc 2020-12-06 16:20:21 -08:00
time.c Change license 2020-12-27 17:18:44 -08:00
time.h Get binaries closer to running without an o/s 2020-11-02 19:12:47 -08:00
word.c Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
word.h Fix bugs and have emulator emulate itself 2020-08-31 05:17:31 -07:00
xlaterrno.c Make numerous improvements 2021-09-28 01:52:34 -07:00
xlaterrno.h Add x86_64-linux-gnu emulator 2020-08-25 04:43:42 -07:00
xmmtype.c Change license 2020-12-27 17:18:44 -08:00
xmmtype.h Add tool for viewing memory 2020-11-06 20:20:10 -08:00