mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
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:
parent
d5ff2c3fb9
commit
5e8ae2d5bc
80 changed files with 506 additions and 249 deletions
|
@ -3105,7 +3105,7 @@ static void OnlyRunOnFirstCpu(void) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!NoDebug()) showcrashreports();
|
||||
if (!NoDebug()) ShowCrashReports();
|
||||
pty = NewPty();
|
||||
pty->conf |= kPtyNocanon;
|
||||
m = NewMachine();
|
||||
|
|
|
@ -727,7 +727,7 @@ void GetOpts(int argc, char *argv[]) {
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i, rc;
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
GetOpts(argc, argv);
|
||||
xsigaction(SIGFPE, OnDivideError, 0, 0, 0);
|
||||
if (optind == argc) {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -275,7 +275,7 @@ void Disassemble(void) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
int fd;
|
||||
void *map;
|
||||
struct stat st;
|
||||
|
|
|
@ -141,7 +141,9 @@ static void FlushTables(struct ElfWriter *elf) {
|
|||
symtab = AppendSection(elf, ".symtab", SHT_SYMTAB, 0);
|
||||
for (i = 0; i < ARRAYLEN(elf->syms); ++i) {
|
||||
size = elf->syms[i]->i * sizeof(Elf64_Sym);
|
||||
memcpy(elfwriter_reserve(elf, size), elf->syms[i]->p, size);
|
||||
if (size) {
|
||||
memcpy(elfwriter_reserve(elf, size), elf->syms[i]->p, size);
|
||||
}
|
||||
elfwriter_commit(elf, size);
|
||||
}
|
||||
FinishSection(elf);
|
||||
|
|
|
@ -63,7 +63,7 @@ int main(int argc, char *argv[]) {
|
|||
int opt;
|
||||
FILE *fin, *fout;
|
||||
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
|
||||
while ((opt = getopt(argc, argv, "ho:s:z:")) != -1) {
|
||||
switch (opt) {
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
* - 1 byte exit status
|
||||
*/
|
||||
|
||||
#define DEATH_CLOCK_SECONDS 16
|
||||
#define DEATH_CLOCK_SECONDS 32
|
||||
|
||||
#define kLogFile "o/runitd.log"
|
||||
#define kLogMaxBytes (2 * 1000 * 1000)
|
||||
|
|
|
@ -302,7 +302,7 @@ static void printelfrelocations(void) {
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
int fd;
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s FILE\n", argv[0]);
|
||||
return 1;
|
||||
|
|
|
@ -150,7 +150,7 @@ static void DoIt(int y, int x) {
|
|||
int main(int argc, char *argv[]) {
|
||||
char *s;
|
||||
int y, x;
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
f = stdin;
|
||||
while ((s = chomp(xgetline(f)))) {
|
||||
n = strwidth(s, 0);
|
||||
|
|
|
@ -488,7 +488,7 @@ int main(int argc, char *argv[]) {
|
|||
int fd;
|
||||
uint8_t *map;
|
||||
struct stat st;
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
CHECK_EQ(2, argc);
|
||||
CHECK_NE(-1, (fd = open(argv[1], O_RDONLY)));
|
||||
CHECK_NE(-1, fstat(fd, &st));
|
||||
|
|
|
@ -266,7 +266,7 @@ int main(int argc, char *argv[]) {
|
|||
int fd;
|
||||
uint8_t *map;
|
||||
struct stat st;
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
CHECK_EQ(2, argc);
|
||||
CHECK_NE(-1, (fd = open(argv[1], O_RDONLY)));
|
||||
CHECK_NE(-1, fstat(fd, &st));
|
||||
|
|
|
@ -1793,7 +1793,8 @@ Keywords={
|
|||
"__PG__",
|
||||
"__MFENTRY__",
|
||||
"__MNO_VZEROUPPER__",
|
||||
"__FSANITIZE_UNDEFINED__",
|
||||
"__SANITIZE_ADDRESS__",
|
||||
"__SANITIZE_UNDEFINED__",
|
||||
"__MNOP_MCOUNT__",
|
||||
"__MRECORD_MCOUNT__",
|
||||
"__x86_64__",
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
"__INTMAX_C"
|
||||
"__UINTMAX_C"
|
||||
"__TIMESTAMP__"
|
||||
"__SANITIZE_ADDRESS__"
|
||||
"__SANITIZE_UNDEFINED__"
|
||||
"__FP_FAST_FMA"
|
||||
"__FP_FAST_FMAF"
|
||||
"__FP_FAST_FMAL"
|
||||
|
|
|
@ -158,8 +158,6 @@
|
|||
"__PG__"
|
||||
"__MFENTRY__"
|
||||
"__MNO_VZEROUPPER__"
|
||||
"__FSANITIZE_ADDRESS__"
|
||||
"__FSANITIZE_UNDEFINED__"
|
||||
"__MNO_RED_ZONE__"
|
||||
"__MNOP_MCOUNT__"
|
||||
"__MRECORD_MCOUNT__"
|
||||
|
|
|
@ -75,7 +75,7 @@ void lookup(const char *name) {
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i;
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
for (i = 1; i < argc; ++i) lookup(argv[i]);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7341,7 +7341,7 @@ void RedBean(int argc, char *argv[]) {
|
|||
int main(int argc, char *argv[]) {
|
||||
if (!IsTiny()) {
|
||||
setenv("GDB", "", true);
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
}
|
||||
RedBean(argc, argv);
|
||||
if (IsModeDbg()) {
|
||||
|
|
|
@ -588,7 +588,7 @@ int main(int argc, char *argv[]) {
|
|||
size_t size;
|
||||
char *option;
|
||||
unsigned yd, xd;
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
GetOpts(argc, argv);
|
||||
// if sizes are given, 2 cases:
|
||||
// - positive values: use that as the target size
|
||||
|
|
|
@ -306,7 +306,7 @@ void GenerateMatrix(FILE *f) {
|
|||
int main(int argc, char *argv[]) {
|
||||
int i;
|
||||
FILE *f;
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
GetOpts(argc, argv);
|
||||
CHECK_NOTNULL((f = fopen(path_, "w")));
|
||||
if (optind < argc) FATALF("TODO(jart): support input files");
|
||||
|
|
|
@ -1397,7 +1397,7 @@ static void Gui(void) {
|
|||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!NoDebug()) showcrashreports();
|
||||
if (!NoDebug()) ShowCrashReports();
|
||||
out = 1;
|
||||
speed = 1;
|
||||
tyn = right = 80;
|
||||
|
|
|
@ -465,8 +465,8 @@ static unsigned char Opacify2(unsigned yw, unsigned xw,
|
|||
}
|
||||
|
||||
static dontinline void PrintImage2(unsigned yw, unsigned xw,
|
||||
unsigned char img[4][yw][xw], unsigned yn,
|
||||
unsigned xn) {
|
||||
unsigned char img[4][yw][xw], unsigned yn,
|
||||
unsigned xn) {
|
||||
bool didhalfy;
|
||||
unsigned y, x;
|
||||
didhalfy = false;
|
||||
|
@ -501,8 +501,8 @@ static dontinline void PrintImage2(unsigned yw, unsigned xw,
|
|||
}
|
||||
|
||||
static dontinline void *DeblinterlaceRgba2(unsigned yn, unsigned xn,
|
||||
unsigned char D[4][yn][xn],
|
||||
const unsigned char S[yn][xn][4]) {
|
||||
unsigned char D[4][yn][xn],
|
||||
const unsigned char S[yn][xn][4]) {
|
||||
unsigned y, x;
|
||||
for (y = 0; y < yn; ++y) {
|
||||
for (x = 0; x < xn; ++x) {
|
||||
|
@ -588,8 +588,8 @@ void ProcessImageMagikarp(unsigned yn, unsigned xn,
|
|||
}
|
||||
|
||||
dontinline void WithImageFile(const char *path,
|
||||
void fn(unsigned yn, unsigned xn,
|
||||
unsigned char img[yn][xn][4])) {
|
||||
void fn(unsigned yn, unsigned xn,
|
||||
unsigned char img[yn][xn][4])) {
|
||||
struct stat st;
|
||||
int fd, yn, xn;
|
||||
void *map, *data;
|
||||
|
@ -634,7 +634,7 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
for (i = optind; i < argc; ++i) {
|
||||
WithImageFile(argv[i], scaler);
|
||||
}
|
||||
|
|
|
@ -926,7 +926,7 @@ static void GetOpts(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!NoDebug()) showcrashreports();
|
||||
if (!NoDebug()) ShowCrashReports();
|
||||
out = 1;
|
||||
GetOpts(argc, argv);
|
||||
Open();
|
||||
|
|
|
@ -35,7 +35,7 @@ int main(int argc, char *argv[]) {
|
|||
FILE *f;
|
||||
int i, n, t;
|
||||
char *sym, tabs[64];
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
f = fopen("/tmp/syms.txt", "r");
|
||||
memset(tabs, '\t', 64);
|
||||
while ((sym = chomp(xgetline(f)))) {
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/sysv/consts/madv.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "tool/decode/lib/flagger.h"
|
||||
#include "tool/decode/lib/idname.h"
|
||||
|
||||
|
@ -518,7 +519,6 @@ void PrintModulesMemoryOrder(void) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
showcrashreports();
|
||||
if (IsLinux()) {
|
||||
return NextBestThing();
|
||||
}
|
||||
|
|
|
@ -1536,7 +1536,7 @@ int main(int argc, char *argv[]) {
|
|||
sigaddset(&wut, SIGCHLD);
|
||||
sigaddset(&wut, SIGPIPE);
|
||||
sigprocmask(SIG_SETMASK, &wut, NULL);
|
||||
showcrashreports();
|
||||
ShowCrashReports();
|
||||
fullclear_ = true;
|
||||
GetOpts(argc, argv);
|
||||
if (!tuned_) PickDefaults();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue