mirror of
https://github.com/MariaDB/server.git
synced 2025-12-28 08:10:14 +00:00
MDEV-37019 MSAN_STAT_WORKAROUND macro remove
MSAN has been updated since 2022 when this macro was added and as such the working around MSAN's deficient understanding of the fstat/stat syscall behaviour at the time is no longer required. As an effective no-op a straight removal is sufficient.
This commit is contained in:
parent
4be442ec35
commit
3944655357
@ -186,7 +186,6 @@ xb_fil_cur_open(
|
||||
}
|
||||
#else
|
||||
err = fstat(cursor->file.m_file, &cursor->statinfo);
|
||||
MSAN_STAT_WORKAROUND(&cursor->statinfo);
|
||||
#endif
|
||||
if (max_file_size < (ulonglong)cursor->statinfo.st_size) {
|
||||
cursor->statinfo.st_size = (ulonglong)max_file_size;
|
||||
|
||||
@ -4160,7 +4160,6 @@ next_file:
|
||||
return(-1);
|
||||
}
|
||||
|
||||
MSAN_STAT_WORKAROUND(&statinfo);
|
||||
info->size = statinfo.st_size;
|
||||
|
||||
if (S_ISDIR(statinfo.st_mode)) {
|
||||
|
||||
@ -37,11 +37,6 @@
|
||||
# define MEM_GET_VBITS(a,b,len) __msan_copy_shadow(b,a,len)
|
||||
# define MEM_SET_VBITS(a,b,len) __msan_copy_shadow(a,b,len)
|
||||
# define REDZONE_SIZE 8
|
||||
# ifdef __linux__
|
||||
# define MSAN_STAT_WORKAROUND(st) MEM_MAKE_DEFINED(st, sizeof(*st))
|
||||
# else
|
||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||
# endif
|
||||
#elif defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind)
|
||||
# include <valgrind/memcheck.h>
|
||||
# define HAVE_MEM_CHECK
|
||||
@ -54,7 +49,6 @@
|
||||
# define MEM_GET_VBITS(a,b,len) VALGRIND_GET_VBITS(a,b,len)
|
||||
# define MEM_SET_VBITS(a,b,len) VALGRIND_SET_VBITS(a,b,len)
|
||||
# define REDZONE_SIZE 8
|
||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||
#elif defined(__SANITIZE_ADDRESS__) && (!defined(_MSC_VER) || defined (__clang__))
|
||||
# include <sanitizer/asan_interface.h>
|
||||
/* How to do manual poisoning:
|
||||
@ -68,7 +62,6 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
|
||||
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
|
||||
# define MEM_GET_VBITS(a,b,len) ((void) 0)
|
||||
# define MEM_SET_VBITS(a,b,len) ((void) 0)
|
||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||
# define REDZONE_SIZE 8
|
||||
#else
|
||||
# define MEM_UNDEFINED(a,len) ((void) 0)
|
||||
@ -80,7 +73,6 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
|
||||
# define MEM_GET_VBITS(a,b,len) ((void) 0)
|
||||
# define MEM_SET_VBITS(a,b,len) ((void) 0)
|
||||
# define REDZONE_SIZE 0
|
||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||
#endif /* __has_feature(memory_sanitizer) */
|
||||
|
||||
#ifdef TRASH_FREED_MEMORY
|
||||
|
||||
@ -334,13 +334,6 @@ int my_fstat(File Filedes, MY_STAT *stat_area,
|
||||
DBUG_PRINT("my",("fd: %d MyFlags: %lu", Filedes, MyFlags));
|
||||
#ifdef _WIN32
|
||||
DBUG_RETURN(my_win_fstat(Filedes, stat_area));
|
||||
#elif defined HAVE_valgrind
|
||||
{
|
||||
int s= fstat(Filedes, stat_area);
|
||||
if (!s)
|
||||
MSAN_STAT_WORKAROUND(stat_area);
|
||||
DBUG_RETURN(s);
|
||||
}
|
||||
#else
|
||||
DBUG_RETURN(fstat(Filedes, (struct stat *) stat_area));
|
||||
#endif
|
||||
@ -361,7 +354,6 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
|
||||
#ifndef _WIN32
|
||||
if (!stat((char *) path, (struct stat *) stat_area))
|
||||
{
|
||||
MSAN_STAT_WORKAROUND(stat_area);
|
||||
DBUG_RETURN(stat_area);
|
||||
}
|
||||
#else
|
||||
|
||||
@ -115,7 +115,6 @@ int my_is_symlink(const char *filename __attribute__((unused)))
|
||||
struct stat stat_buff;
|
||||
if (lstat(filename, &stat_buff))
|
||||
return 0;
|
||||
MSAN_STAT_WORKAROUND(&stat_buff);
|
||||
return !!S_ISLNK(stat_buff.st_mode);
|
||||
#elif defined (_WIN32)
|
||||
DWORD dwAttr = GetFileAttributes(filename);
|
||||
|
||||
@ -162,8 +162,6 @@ cont:
|
||||
if (mysql_file_fstat(file, &state, MYF(MY_WME)))
|
||||
goto err;
|
||||
|
||||
MSAN_STAT_WORKAROUND(&state);
|
||||
|
||||
if (mysql_file_seek(file, 0, SEEK_SET, MYF(MY_WME)))
|
||||
goto err;
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ int readfrm(const char *name, const uchar **frmdata, size_t *len)
|
||||
error= 2;
|
||||
if (mysql_file_fstat(file, &state, MYF(0)))
|
||||
goto err;
|
||||
MSAN_STAT_WORKAROUND(&state);
|
||||
|
||||
read_len= (size_t)MY_MIN(FRM_MAX_SIZE, state.st_size); // safety
|
||||
|
||||
// Read whole frm file
|
||||
|
||||
@ -465,8 +465,6 @@ sql_parse_prepare(const LEX_CSTRING *file_name, MEM_ROOT *mem_root,
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
MSAN_STAT_WORKAROUND(&stat_info);
|
||||
|
||||
if (stat_info.st_size > INT_MAX-1)
|
||||
{
|
||||
my_error(ER_FPARSER_TOO_BIG_FILE, MYF(0), file_name->str);
|
||||
|
||||
@ -284,11 +284,9 @@ remap:
|
||||
struct stat st;
|
||||
if (!fstat(file, &st))
|
||||
{
|
||||
MSAN_STAT_WORKAROUND(&st);
|
||||
const auto st_dev= st.st_dev;
|
||||
if (!stat("/dev/shm", &st))
|
||||
{
|
||||
MSAN_STAT_WORKAROUND(&st);
|
||||
is_pmem= st.st_dev == st_dev;
|
||||
if (!is_pmem)
|
||||
return ptr; /* MAP_FAILED */
|
||||
|
||||
@ -865,7 +865,6 @@ os_file_status_posix(
|
||||
|
||||
if (!ret) {
|
||||
/* file exists, everything OK */
|
||||
MSAN_STAT_WORKAROUND(&statinfo);
|
||||
} else if (errno == ENOENT || errno == ENOTDIR || errno == ENAMETOOLONG) {
|
||||
/* file does not exist */
|
||||
return(true);
|
||||
@ -1039,7 +1038,6 @@ static ATTRIBUTE_COLD void os_file_log_buffered()
|
||||
/** @return whether the log file may work with unbuffered I/O. */
|
||||
static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st)
|
||||
{
|
||||
MSAN_STAT_WORKAROUND(&st);
|
||||
char b[20 + sizeof "/sys/dev/block/" ":" "/../queue/physical_block_size"];
|
||||
if (snprintf(b, sizeof b, "/sys/dev/block/%u:%u/queue/physical_block_size",
|
||||
major(st.st_dev), minor(st.st_dev)) >=
|
||||
@ -1443,7 +1441,6 @@ os_file_size_t os_file_get_size(const char *filename) noexcept
|
||||
int ret = stat(filename, &s);
|
||||
|
||||
if (ret == 0) {
|
||||
MSAN_STAT_WORKAROUND(&s);
|
||||
file_size.m_total_size = s.st_size;
|
||||
/* st_blocks is in 512 byte sized blocks */
|
||||
file_size.m_alloc_size = s.st_blocks * 512;
|
||||
@ -1488,8 +1485,6 @@ os_file_get_status_posix(
|
||||
return(DB_FAIL);
|
||||
}
|
||||
|
||||
MSAN_STAT_WORKAROUND(statinfo);
|
||||
|
||||
switch (statinfo->st_mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
stat_info->type = OS_FILE_TYPE_DIR;
|
||||
@ -3754,7 +3749,6 @@ void fil_node_t::find_metadata(IF_WIN(,bool create)) noexcept
|
||||
struct stat statbuf;
|
||||
if (!fstat(file, &statbuf))
|
||||
{
|
||||
MSAN_STAT_WORKAROUND(&statbuf);
|
||||
block_size= statbuf.st_blksize;
|
||||
# ifdef __linux__
|
||||
on_ssd= fil_system.is_ssd(statbuf.st_dev);
|
||||
|
||||
@ -87,10 +87,7 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
|
||||
x->index_file_name = share->index_file_name;
|
||||
}
|
||||
if ((flag & HA_STATUS_TIME) && !mysql_file_fstat(info->dfile, &state, MYF(0)))
|
||||
{
|
||||
MSAN_STAT_WORKAROUND(&state);
|
||||
x->update_time=state.st_mtime;
|
||||
}
|
||||
else
|
||||
x->update_time=0;
|
||||
if (flag & HA_STATUS_AUTO)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user