cosmopolitan/libc/testlib
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
..
thunks Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
almostequal.c Change license 2020-12-27 17:18:44 -08:00
almostequalf.c Change license 2020-12-27 17:18:44 -08:00
almostequallongdouble.c Change license 2020-12-27 17:18:44 -08:00
bench.h Make numerous improvements 2021-09-28 01:52:34 -07:00
bench.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
benchrunner.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
binequals.c Change license 2020-12-27 17:18:44 -08:00
blocktronics.h Improve performance of bitscanning intrinsics 2021-06-15 06:29:51 -07:00
blocktronics.S Improve performance of bitscanning intrinsics 2021-06-15 06:29:51 -07:00
blocktronics.txt Improve performance of bitscanning intrinsics 2021-06-15 06:29:51 -07:00
clearxmmregisters.c Change license 2020-12-27 17:18:44 -08:00
combo.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
comborunner.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
contains.c Change license 2020-12-27 17:18:44 -08:00
endswith.c Change license 2020-12-27 17:18:44 -08:00
ezbench.h Make numerous improvements 2021-09-28 01:52:34 -07:00
ezbenchcontrol.c Make numerous improvements 2021-09-28 01:52:34 -07:00
ezbenchreport.c Make numerous improvements 2021-09-28 01:52:34 -07:00
ezbenchwarn.c Make numerous improvements 2021-09-28 01:52:34 -07:00
fastrandomstring.h Improve Python tree-shaking 2021-09-06 19:24:10 -07:00
fixture.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
fixturerunner.c Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
formatbinaryasglyphs.c Change license 2020-12-27 17:18:44 -08:00
formatbinaryashex.c Change license 2020-12-27 17:18:44 -08:00
formatbool.c Change license 2020-12-27 17:18:44 -08:00
formatfloat.c Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
formatint.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
formatrange.c Apply some touchups 2021-02-07 07:02:46 -08:00
formatstr.c Add SSL to redbean 2021-06-24 13:20:50 -07:00
getcore.c Make numerous improvements 2021-09-28 01:52:34 -07:00
getinterrupts.c Make numerous improvements 2021-09-28 01:52:34 -07:00
globals.c Change license 2020-12-27 17:18:44 -08:00
hexequals.c Change license 2020-12-27 17:18:44 -08:00
hyperion.h Make improvements to redbean 2021-07-10 15:19:37 -07:00
hyperion.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
hyperion.txt Initial import 2020-06-15 07:18:57 -07:00
incrementfailed.c Change license 2020-12-27 17:18:44 -08:00
leaks.c Improve memory safety 2021-10-13 17:27:13 -07:00
moby.h Make improvements to redbean 2021-07-10 15:19:37 -07:00
moby.S Make improvements to redbean 2021-07-10 15:19:37 -07:00
moby.txt Make improvements to redbean 2021-07-10 15:19:37 -07:00
polluteregisters.S Make numerous improvements 2021-09-28 01:52:34 -07:00
quota.c Improve memory safety 2021-10-13 17:27:13 -07:00
runner.c Change license 2020-12-27 17:18:44 -08:00
shoulddebugbreak.c Change license 2020-12-27 17:18:44 -08:00
showerror.c Improve memory safety 2021-10-13 17:27:13 -07:00
startswith.c Change license 2020-12-27 17:18:44 -08:00
strcaseequals.c Change license 2020-12-27 17:18:44 -08:00
strequals.c Change license 2020-12-27 17:18:44 -08:00
testcase.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
testlib.h Improve memory safety 2021-10-13 17:27:13 -07:00
testlib.mk Improve memory safety 2021-10-13 17:27:13 -07:00
testmain.c Improve memory safety 2021-10-13 17:27:13 -07:00
testrunner.c Make numerous improvements 2021-09-28 01:52:34 -07:00
thrashcodecache.S Make numerous improvements 2021-09-28 01:52:34 -07:00
ugly.h Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
yield.c Make numerous improvements 2021-09-28 01:52:34 -07:00