mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
Cleanup: Remove IF_VALGRIND
The purpose of the compress() wrapper my_compress_buffer() was twofold: silence Valgrind warnings about uninitialized memory access before zlib 1.2.4, and have PERFORMANCE_SCHEMA instrumentation of some zlib related memory allocation. Because of PERFORMANCE_SCHEMA, we cannot trivially replace my_compress_buffer() with compress(). az_open(): Remove a crc32() call. Any CRC of the empty string is 0.
This commit is contained in:
parent
232af0c7bf
commit
4faef6e240
5 changed files with 10 additions and 199 deletions
|
@ -83,12 +83,6 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
|
||||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||||
#endif /* __has_feature(memory_sanitizer) */
|
#endif /* __has_feature(memory_sanitizer) */
|
||||||
|
|
||||||
#ifdef HAVE_valgrind
|
|
||||||
#define IF_VALGRIND(A,B) A
|
|
||||||
#else
|
|
||||||
#define IF_VALGRIND(A,B) B
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TRASH_FREED_MEMORY
|
#ifdef TRASH_FREED_MEMORY
|
||||||
/*
|
/*
|
||||||
_TRASH_FILL() has to call MEM_MAKE_ADDRESSABLE() to cancel any effect of
|
_TRASH_FILL() has to call MEM_MAKE_ADDRESSABLE() to cancel any effect of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) 2005, 2015, Oracle and/or its affiliates.
|
# Copyright (c) 2005, 2015, Oracle and/or its affiliates.
|
||||||
# Copyright (c) 2008, 2019, MariaDB
|
# Copyright (c) 2008, 2022, MariaDB
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Library General Public
|
# modify it under the terms of the GNU Library General Public
|
||||||
|
@ -100,137 +100,6 @@
|
||||||
fun:_dl_start
|
fun:_dl_start
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Warnings in libz becasue it works with aligned memory(?)
|
|
||||||
#
|
|
||||||
|
|
||||||
{
|
|
||||||
libz tr_flush_block
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:_tr_flush_block
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:do_flush
|
|
||||||
fun:gzclose
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz tr_flush_block2
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:_tr_flush_block
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:compress2
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz longest_match
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:longest_match
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:do_flush
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz longest_match called from btr_store_big_rec_extern_fields
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:longest_match
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:btr_store_big_rec_extern_fields
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz longest_match called from page_zip_compress
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:longest_match
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:page_zip_compress
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz longest_match2
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:longest_match
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:compress2
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz longest_match 3
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:longest_match
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:gzclose
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz longest_match 4
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:longest_match
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:gzflush
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz longest_match3
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:longest_match
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:azflush
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz longest_match3
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:longest_match
|
|
||||||
fun:deflate_slow
|
|
||||||
fun:deflate
|
|
||||||
fun:azclose
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz deflate
|
|
||||||
Memcheck:Cond
|
|
||||||
obj:*/libz.so.*
|
|
||||||
obj:*/libz.so.*
|
|
||||||
fun:deflate
|
|
||||||
fun:compress2
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz deflate2
|
|
||||||
Memcheck:Cond
|
|
||||||
obj:*/libz.so.*
|
|
||||||
obj:*/libz.so.*
|
|
||||||
fun:deflate
|
|
||||||
obj:*/libz.so.*
|
|
||||||
fun:gzflush
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz deflate3
|
|
||||||
Memcheck:Cond
|
|
||||||
obj:*/libz.so.*
|
|
||||||
obj:*/libz.so.*
|
|
||||||
fun:deflate
|
|
||||||
fun:do_flush
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
libz inflatereset2
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:inflateReset2
|
|
||||||
fun:inflateInit2_
|
|
||||||
fun:uncompress
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Warning from my_thread_init becasue mysqld dies before kill thread exists
|
# Warning from my_thread_init becasue mysqld dies before kill thread exists
|
||||||
|
@ -705,39 +574,6 @@
|
||||||
fun:buf_buddy_relocate
|
fun:buf_buddy_relocate
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
Bug 59874 Valgrind warning in InnoDB compression code
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:deflate
|
|
||||||
fun:btr_store_big_rec_extern_fields_func
|
|
||||||
fun:row_ins_index_entry_low
|
|
||||||
fun:row_ins_index_entry
|
|
||||||
fun:row_ins_index_entry_step
|
|
||||||
fun:row_ins
|
|
||||||
fun:row_ins_step
|
|
||||||
fun:row_insert_for_mysql
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
In page0zip.c we have already checked that the memory is initialized before calling deflate()
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:deflate
|
|
||||||
fun:page_zip_compress
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
In page0zip.c we have already checked that the memory is initialized before calling deflate()
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:deflate
|
|
||||||
fun:page_zip_compress_deflate
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Bug 59875 Valgrind warning in buf0buddy.c
|
Bug 59875 Valgrind warning in buf0buddy.c
|
||||||
Memcheck:Addr1
|
Memcheck:Addr1
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
Copyright (c) 2022, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -57,35 +58,11 @@ my_bool my_compress(uchar *packet, size_t *len, size_t *complen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Valgrind normally gives false alarms for zlib operations, in the form of
|
|
||||||
"conditional jump depends on uninitialised values" etc. The reason is
|
|
||||||
explained in the zlib FAQ (http://www.zlib.net/zlib_faq.html#faq36):
|
|
||||||
|
|
||||||
"That is intentional for performance reasons, and the output of deflate
|
|
||||||
is not affected."
|
|
||||||
|
|
||||||
Also discussed on a blog
|
|
||||||
(http://www.sirena.org.uk/log/2006/02/19/zlib-generating-valgrind-warnings/):
|
|
||||||
|
|
||||||
"...loop unrolling in the zlib library causes the mentioned
|
|
||||||
“Conditional jump or move depends on uninitialised value(s)”
|
|
||||||
warnings. These are safe since the results of the comparison are
|
|
||||||
subsequently ignored..."
|
|
||||||
|
|
||||||
"the results of the calculations are discarded by bounds checking done
|
|
||||||
after the loop exits"
|
|
||||||
|
|
||||||
Fix by initializing the memory allocated by zlib when running under Valgrind.
|
|
||||||
|
|
||||||
This fix is safe, since such memory is only used internally by zlib, so we
|
|
||||||
will not hide any bugs in mysql this way.
|
|
||||||
*/
|
|
||||||
void *my_az_allocator(void *dummy __attribute__((unused)), unsigned int items,
|
void *my_az_allocator(void *dummy __attribute__((unused)), unsigned int items,
|
||||||
unsigned int size)
|
unsigned int size)
|
||||||
{
|
{
|
||||||
return my_malloc(key_memory_my_compress_alloc, (size_t)items*(size_t)size,
|
return my_malloc(key_memory_my_compress_alloc, (size_t)items*(size_t)size,
|
||||||
IF_VALGRIND(MY_ZEROFILL, MYF(0)));
|
MYF(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void my_az_free(void *dummy __attribute__((unused)), void *address)
|
void my_az_free(void *dummy __attribute__((unused)), void *address)
|
||||||
|
|
|
@ -8706,12 +8706,16 @@ void set_server_version(char *buf, size_t size)
|
||||||
{
|
{
|
||||||
bool is_log= opt_log || global_system_variables.sql_log_slow || opt_bin_log;
|
bool is_log= opt_log || global_system_variables.sql_log_slow || opt_bin_log;
|
||||||
bool is_debug= IF_DBUG(!strstr(MYSQL_SERVER_SUFFIX_STR, "-debug"), 0);
|
bool is_debug= IF_DBUG(!strstr(MYSQL_SERVER_SUFFIX_STR, "-debug"), 0);
|
||||||
bool is_valgrind= IF_VALGRIND(!strstr(MYSQL_SERVER_SUFFIX_STR, "-valgrind"), 0);
|
const char *is_valgrind=
|
||||||
|
#ifdef HAVE_VALGRIND
|
||||||
|
!strstr(MYSQL_SERVER_SUFFIX_STR, "-valgrind") ? "-valgrind" :
|
||||||
|
#endif
|
||||||
|
"";
|
||||||
strxnmov(buf, size - 1,
|
strxnmov(buf, size - 1,
|
||||||
MYSQL_SERVER_VERSION,
|
MYSQL_SERVER_VERSION,
|
||||||
MYSQL_SERVER_SUFFIX_STR,
|
MYSQL_SERVER_SUFFIX_STR,
|
||||||
IF_EMBEDDED("-embedded", ""),
|
IF_EMBEDDED("-embedded", ""),
|
||||||
is_valgrind ? "-valgrind" : "",
|
is_valgrind,
|
||||||
is_debug ? "-debug" : "",
|
is_debug ? "-debug" : "",
|
||||||
is_log ? "-log" : "",
|
is_log ? "-log" : "",
|
||||||
NullS);
|
NullS);
|
||||||
|
|
|
@ -71,7 +71,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
|
||||||
s->in = 0;
|
s->in = 0;
|
||||||
s->out = 0;
|
s->out = 0;
|
||||||
s->back = EOF;
|
s->back = EOF;
|
||||||
s->crc = crc32(0L, Z_NULL, 0);
|
s->crc = 0;
|
||||||
s->transparent = 0;
|
s->transparent = 0;
|
||||||
s->mode = 'r';
|
s->mode = 'r';
|
||||||
s->version = (unsigned char)az_magic[1]; /* this needs to be a define to version */
|
s->version = (unsigned char)az_magic[1]; /* this needs to be a define to version */
|
||||||
|
|
Loading…
Reference in a new issue