From 6be56dd1c8a37eb98f4b7bc1507ca5991a2a1f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 28 Mar 2020 21:05:55 +0200 Subject: MDEV-20377: Enable MemorySanitizer user-poisoning For ENGINE=Aria, we work around bugs in various tests that catch writes of uninitialized bytes from the Aria page cache. (Why do we even write anything on DROP TABLE?) --- include/my_valgrind.h | 9 ++------- storage/maria/ma_pagecache.c | 4 ++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/my_valgrind.h b/include/my_valgrind.h index 3f172831e51..2c623a044f4 100644 --- a/include/my_valgrind.h +++ b/include/my_valgrind.h @@ -50,13 +50,8 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */ # define REDZONE_SIZE 8 #elif __has_feature(memory_sanitizer) # include -# if 0 /* FIXME: these reveal lots of failures */ -# define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len) -# define MEM_MAKE_DEFINED(a,len) __msan_unpoison(a,len) -# else -# define MEM_UNDEFINED(a,len) ((void) 0) -# define MEM_MAKE_DEFINED(a,len) ((void) 0) -# endif +# define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len) +# define MEM_MAKE_DEFINED(a,len) __msan_unpoison(a,len) # define MEM_NOACCESS(a,len) ((void) 0) # define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) # define MEM_CHECK_DEFINED(a,len) __msan_check_mem_is_initialized(a,len) diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index e08c18fb579..8fa6646048d 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -681,6 +681,10 @@ static my_bool pagecache_fwrite(PAGECACHE *pagecache, DBUG_PRINT("error", ("write callback problem")); DBUG_RETURN(1); } +#if __has_feature(memory_sanitizer) /* FIXME: encryption.aria_tiny etc. fail */ + /* FIXME: ENGINE=Aria occasionally writes uninitialized data */ + __msan_unpoison(args.page, pagecache->block_size); +#endif res= (int)my_pwrite(filedesc->file, args.page, pagecache->block_size, ((my_off_t) pageno << pagecache->shift), flags); (*filedesc->post_write_hook)(res, &args); -- cgit v1.2.1