Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mysql-test/lib/My/Debugger.pm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ my %debuggers = (
push @::global_suppressions, qr/InnoDB: native AIO failed/;
::mtr_error('rr requires kernel.perf_event_paranoid <= 1')
if ::mtr_grab_file('/proc/sys/kernel/perf_event_paranoid') > 1;
$ENV{LSAN_OPTIONS}= "report_objects=1:" . ($ENV{LSAN_OPTIONS} || '')
}
},
valgdb => {
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/lsan.supp
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ leak:gnutls_x509_trust_list_init
leak:gnutls_subject_alt_names_init
leak:__gmp_default_allocate
leak:__gmp_default_reallocate

# unixODBC leak
leak:save_ini_cache
3 changes: 2 additions & 1 deletion mysql-test/mariadb-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,8 @@ sub command_line_setup {
# $ENV{ASAN_OPTIONS}= "log_path=${opt_vardir}/log/asan:" . $ENV{ASAN_OPTIONS};

# Add leak suppressions
$ENV{LSAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/lsan.supp:print_suppressions=0"
$ENV{LSAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/lsan.supp:print_suppressions=0:"
. ($ENV{LSAN_OPTIONS} || '')
if -f "$glob_mysql_test_dir/lsan.supp" and not IS_WINDOWS;

mtr_verbose("ASAN_OPTIONS=$ENV{ASAN_OPTIONS}");
Expand Down
58 changes: 57 additions & 1 deletion storage/connect/mysql-test/connect/suite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,63 @@ return "No CONNECT engine" unless $ENV{HA_CONNECT_SO} or
return "Not run for embedded server" if $::opt_embedded_server and
$ENV{HA_CONNECT_SO};

sub is_default { 1 }
sub is_default { 1 }

# To allow the lsan suppression on unixodbc to work
# the llvm-symbolizer needs to be are of the address
# resolution even after the HA_CONNECT_SO has been dlclosed.

# Check OS and file existence
if ($^O =~ /linux|darwin|unix/i && -x "/usr/bin/readelf")
{
my $asan_symbols = 0;
my $file = $::plugindir . '/' . $ENV{HA_CONNECT_SO};

# Open readelf -s output and scan for __asan symbols
open(my $sh, '-|', "readelf -s '$file'")
or die "Failed to run readelf: $!\n";
while (<$sh>) { $asan_symbols = 1 if /__asan/; }
close($sh);

if ($asan_symbols && -x "/usr/bin/ldd")
{
# To allow the lsan suppression on unixodbc to work
# the llvm-symbolizer needs to be aware of the address
# resolution even after the HA_CONNECT_SO has been dlclosed.

my $lib_path;
open(my $ldd, '-|', "ldd $file") or die "Failed to run ldd: $!";

while (<$ldd>)
{
chomp;
# Example ldd line: libodbc.so.2 => /usr/lib/x86_64-linux-gnu/libodbc.so.2 (0x00007f...)
if (/libodbc\.so(?:\.\d+)*\s+=>\s+(\S+)/)
{
$lib_path = $1;
last; # stop after the first match
}
}
close $ldd;

# assuming odbcinst is in the same path so we can check
# if it has fixed version.
my $libodbcinst = $lib_path;
$libodbcinst =~ s/odbc/odbcinst/;
my $leakfixed= 0;
if ( -f $libodbcinst )
{
open(my $sh, '-|', "readelf -s '$libodbcinst'")
or die "Failed to run readelf: $!\n";
while (<$sh>) { $leakfixed = 1 if /inst_logClose/; }
close($sh);
}
if (!$leakfixed && $lib_path)
{
$ENV{LD_PRELOAD} = $ENV{LD_PRELOAD} ? "$ENV{LD_PRELOAD}:$lib_path" : $lib_path;
}
}
}
Comment thread
grooverdan marked this conversation as resolved.

bless { };