-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add --enable-asan
and --enable-ubsan
switches
#12928
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -631,6 +631,8 @@ fatal(int do_perror, char *message, ...) | |
|
||
(void) fflush(stdout); | ||
buf = umem_alloc(FATAL_MSG_SZ, UMEM_NOFAIL); | ||
if (buf == NULL) | ||
goto out; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, UBSan has no way to determine that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I'm just surprised it only flagged this one case where there are clearly several others. |
||
|
||
va_start(args, message); | ||
(void) sprintf(buf, "ztest: "); | ||
|
@@ -644,6 +646,7 @@ fatal(int do_perror, char *message, ...) | |
(void) fprintf(stderr, "%s\n", buf); | ||
fatal_msg = buf; /* to ease debugging */ | ||
|
||
out: | ||
if (ztest_dump_core) | ||
abort(); | ||
else | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add the "%s" format specifier to just this one
fprintf()
? I see several others were updated as well, were warnings issues for these in particular?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it gives warnings for those (for me these were a distribution of "non-constant used as format" and "potentially NULL format", both are bogus in this case). OTOH, if there isn't anything to format here, it's better to make this a
fputs
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is GCC bug. GCC enables additional format string checks when
-fsanitize=undefined
is used. Unfortunately there are false positives here and there (tested on GCC 10 and 11), e. g. raspberrypi/userland#631 (comment)It looks incredibly lame, I did not find a better solution/workaround, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, that's unfortunate but we can live with it.