Commit 6be56dd1 authored by Marko Mäkelä's avatar Marko Mäkelä

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?)
parent 94d0bb4d
...@@ -50,13 +50,8 @@ ...@@ -50,13 +50,8 @@
# define REDZONE_SIZE 8 # define REDZONE_SIZE 8
#elif __has_feature(memory_sanitizer) #elif __has_feature(memory_sanitizer)
# include <sanitizer/msan_interface.h> # include <sanitizer/msan_interface.h>
# if 0 /* FIXME: these reveal lots of failures */
# define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len) # define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len)
# define MEM_MAKE_DEFINED(a,len) __msan_unpoison(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_NOACCESS(a,len) ((void) 0) # define MEM_NOACCESS(a,len) ((void) 0)
# define MEM_CHECK_ADDRESSABLE(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) # define MEM_CHECK_DEFINED(a,len) __msan_check_mem_is_initialized(a,len)
......
...@@ -681,6 +681,10 @@ static my_bool pagecache_fwrite(PAGECACHE *pagecache, ...@@ -681,6 +681,10 @@ static my_bool pagecache_fwrite(PAGECACHE *pagecache,
DBUG_PRINT("error", ("write callback problem")); DBUG_PRINT("error", ("write callback problem"));
DBUG_RETURN(1); 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, res= (int)my_pwrite(filedesc->file, args.page, pagecache->block_size,
((my_off_t) pageno << pagecache->shift), flags); ((my_off_t) pageno << pagecache->shift), flags);
(*filedesc->post_write_hook)(res, &args); (*filedesc->post_write_hook)(res, &args);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment