diff options
author | Edward Hill <ecgh@chromium.org> | 2020-05-28 13:11:51 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-23 08:40:31 +0000 |
commit | ee588d44e253154dce00d03d74aa568dcadef90f (patch) | |
tree | df33f89aa7bddec386713e5be7f3fb32a9457df5 | |
parent | 0204b81f09bf4042a89d5eb031bb8e767d1aff99 (diff) | |
download | chrome-ec-ee588d44e253154dce00d03d74aa568dcadef90f.tar.gz |
fuzz: Fix varargs/printf with MSAN
Remove our implementations of memcpy/memset/memmove for MSAN and ASAN
since they are intercepted by the sanitizers. This was breaking
varargs, causing va_arg() to return 0, which was most obvious in
printf() with MSAN enabled.
BUG=chromium:963303
BRANCH=none
TEST=make -j host-host_command_fuzz TEST_MSAN=1
Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: Id65d88b79bbb1834babe62c90078ec92a6aa5fba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2220160
Reviewed-by: Evgenii Stepanov <eugenis@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
-rw-r--r-- | common/util.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/util.c b/common/util.c index 48374ed08a..5a65c03e89 100644 --- a/common/util.c +++ b/common/util.c @@ -282,6 +282,7 @@ int safe_memcmp(const void *s1, const void *s2, size_t size) return result != 0; } +#if !(__has_feature(address_sanitizer) || __has_feature(memory_sanitizer)) __stdlib_compat void *memcpy(void *dest, const void *src, size_t len) { char *d = (char *)dest; @@ -324,8 +325,10 @@ __stdlib_compat void *memcpy(void *dest, const void *src, size_t len) return dest; } +#endif /* address_sanitizer || memory_sanitizer */ +#if !(__has_feature(address_sanitizer) || __has_feature(memory_sanitizer)) __stdlib_compat __visible void *memset(void *dest, int c, size_t len) { char *d = (char *)dest; @@ -362,8 +365,10 @@ __stdlib_compat __visible void *memset(void *dest, int c, size_t len) return dest; } +#endif /* address_sanitizer || memory_sanitizer */ +#if !(__has_feature(address_sanitizer) || __has_feature(memory_sanitizer)) __stdlib_compat void *memmove(void *dest, const void *src, size_t len) { if ((uintptr_t)dest <= (uintptr_t)src || @@ -414,6 +419,7 @@ __stdlib_compat void *memmove(void *dest, const void *src, size_t len) return dest; } } +#endif /* address_sanitizer || memory_sanitizer */ __stdlib_compat void *memchr(const void *buffer, int c, size_t n) |