Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xst: disable lsan when xs exit imminent #1067

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 13 additions & 8 deletions xs/tools/xst.c
Expand Up @@ -237,7 +237,16 @@ static char *gxAbortStrings[] = {
static txAgentCluster gxAgentCluster;

#if OSSFUZZ
static int lsan_disabled = 0;

// allow toggling ASAN leak-checking
__attribute__((used))
int __lsan_is_turned_off() {
return lsan_disabled;
}

int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
lsan_disabled = 0;
fuzz_oss(Data, Size);
return 0;
}
Expand Down Expand Up @@ -1966,14 +1975,6 @@ int fuzz_oss(const uint8_t *Data, size_t script_size)
return 0;
}

const char *__lsan_default_suppressions()
{
return "leak:fxStringifyJSONChars\n"
"leak:fxStringifyJSONCharacter\n"
"leak:fxStringifyJSON\n"
"leak:fxParserCode\n";
}

#endif

#if 1 || FUZZING || FUZZILLI
Expand Down Expand Up @@ -2128,6 +2129,10 @@ void fxAbort(txMachine* the, int status)
if (the->abortStatus) // xsEndHost calls fxAbort!
return;
if (status) {
// disable leak checking
#if OSSFUZZ
lsan_disabled = 1;
#endif
the->abortStatus = status;
fxExitToHost(the);
}
Expand Down