Restart CI for New Technology and UBSAN hunting

Continuous Integration (via runit and runitd) is now re-enabled on win7
and win10. The `make test` command, which runs the tests on all systems
is now the fastest and most stable it's been since the project started.

UBSAN is now enabled in MODE=dbg in addition to ASAN. Many instances of
undefined behavior have been removed. Mostly things like passing a NULL
argument to memcpy(), which works fine with Cosmopolitan Libc, but that
doesn't prevents the compiler from being unhappy. There was an issue w/
GNU make where static analysis claims a sprintf() call can overflow. We
also now have nicer looking crash reports on Windows since uname should
now be supported and msys64 addr2line works reliably.
This commit is contained in:
Justine Tunney 2022-03-21 03:46:16 -07:00
parent d5ff2c3fb9
commit 5e8ae2d5bc
80 changed files with 506 additions and 249 deletions

View file

@ -101,7 +101,7 @@ FLAGS\n\
-C SECS set cpu limit [default 16]\n\
-L SECS set lat limit [default 90]\n\
-M BYTES set mem limit [default 512m]\n\
-F BYTES set fsz limit [default 100m]\n\
-F BYTES set fsz limit [default 256m]\n\
-O BYTES set out limit [default 1m]\n\
-s decrement verbosity [default 4]\n\
-v increments verbosity [default 4]\n\
@ -725,14 +725,15 @@ int main(int argc, char *argv[]) {
int ws, opt, exitcode;
char *s, *p, *q, **envp;
mode = firstnonnull(getenv("MODE"), MODE);
/*
* parse prefix arguments
*/
mode = MODE;
verbose = 4;
timeout = 90; /* secs */
cpuquota = 16; /* secs */
fszquota = 100 * 1000 * 1000; /* bytes */
fszquota = 256 * 1000 * 1000; /* bytes */
memquota = 512 * 1024 * 1024; /* bytes */
if ((s = getenv("V"))) verbose = atoi(s);
while ((opt = getopt(argc, argv, "hnvstC:M:F:A:T:V:O:L:")) != -1) {
@ -785,6 +786,16 @@ int main(int argc, char *argv[]) {
exit(1);
}
/*
* extend limits for slow UBSAN in particular
*/
if (!strcmp(mode, "dbg") || !strcmp(mode, "ubsan")) {
cpuquota *= 2;
fszquota *= 2;
memquota *= 2;
timeout *= 2;
}
cmd = argv[optind];
if (!strchr(cmd, '/')) {
if (!(cmd = commandv(cmd, ccpath))) exit(127);
@ -957,11 +968,13 @@ int main(int argc, char *argv[]) {
}
if (wantasan) {
AddArg("-fsanitize=address");
AddArg("-D__FSANITIZE_ADDRESS__");
/* compiler adds this by default */
/* AddArg("-D__SANITIZE_ADDRESS__"); */
}
if (wantubsan) {
AddArg("-fsanitize=undefined");
AddArg("-fno-data-sections");
AddArg("-D__SANITIZE_UNDEFINED__");
}
if (no_sanitize_null) {
AddArg("-fno-sanitize=null");