-
Notifications
You must be signed in to change notification settings - Fork 598
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
cmd: add support for building with address and undefined behavior sanitizers #15059
Merged
+68
−15
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2d72aa4
cmd: add support for building C code with address sanitizer
bboozzoo 3ec4af0
github: unit-tests: add a step to build with asan
bboozzoo 8928434
cmd: make: enable ubsan when building with sanitizers
bboozzoo 8b515e6
github: unit-test: tweak step name
bboozzoo 773c5c9
woke: ignore cmd/configure.ac cmd/Makefile.am
bboozzoo 76dfa04
cmd: tweak help message for --enable-sanitize
bboozzoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,6 +319,22 @@ AS_IF([test "x$with_unit_tests" = "xyes"], [ | |
AX_APPEND_COMPILE_FLAGS([-Werror], [CHECK_CFLAGS]) | ||
]) | ||
|
||
AC_ARG_ENABLE([sanitize], | ||
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. Since this is only using asan at the moment, would it be better to just call it |
||
AS_HELP_STRING([--enable-sanitize], [Build binaries with sanitizers (ASan and UBSan). | ||
Note, this will perform a partial build, skipping binaries which | ||
cannot be built with sanitizers enabled.]), | ||
[case "$enableval" in | ||
yes) | ||
enable_sanitize=yes | ||
;; | ||
no) | ||
enable_sanitize=no | ||
;; | ||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-sanitize]) | ||
esac], | ||
[enable_sanitize=no]) | ||
AM_CONDITIONAL([ENABLE_SANITIZE], [test "x$enable_sanitize" = "xyes"]) | ||
|
||
AC_SUBST([CHECK_CFLAGS]) | ||
|
||
AC_ARG_WITH([apparmorconfigdir], | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 suppose you do not add
SANITIZE_*
tosnap_gdb_shim_snap_gdb_shim_*
. So that would still build, right? Is it just to disable what we are not testing here?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.
If it is so, we should maybe document in the AS_HELP_STRING of --enable-sanitize that it gives a partial build.
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.
Bit of both. We don't test it and it won't build. Even with -static-libasan dlopen() is retained for some reason. I guess it just makes libasan parts to be linked statically, but still relies on hijacking libc's malloc dynamically.
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've tweaked the help message.