mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
selftest: Fix address sanitizer with python3
==9542==AddressSanitizer: failed to intercept 'crypt' ==9542==AddressSanitizer: failed to intercept 'crypt_r' [..] AddressSanitizer:DEADLYSIGNAL ================================================================= ==29768==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x7ffcec4bf3c0 sp 0x7ffcec4beb58 T0) ==29768==Hint: pc points to the zero page. ==29768==The signal is caused by a READ memory access. ==29768==Hint: address points to the zero page. #0 0x0 (<unknown module>) #1 0x7f052cca4129 in crypt_crypt_impl /usr/src/debug/python310-core-3.10.6-3.1.x86_64/Modules/_cryptmodule.c:44 We would need to build python without --as-needed as we can't so that we need to preload the library to avoid a segfault. See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98669 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
08dda9cefd
commit
1591d7bdbf
@ -62,6 +62,7 @@ my $opt_libresolv_wrapper_so_path = "";
|
||||
my $opt_libsocket_wrapper_so_path = "";
|
||||
my $opt_libuid_wrapper_so_path = "";
|
||||
my $opt_libasan_so_path = "";
|
||||
my $opt_libcrypt_so_path = "";
|
||||
my $opt_use_dns_faking = 0;
|
||||
my @testlists = ();
|
||||
|
||||
@ -248,6 +249,7 @@ my $result = GetOptions (
|
||||
'socket_wrapper_so_path=s' => \$opt_libsocket_wrapper_so_path,
|
||||
'uid_wrapper_so_path=s' => \$opt_libuid_wrapper_so_path,
|
||||
'asan_so_path=s' => \$opt_libasan_so_path,
|
||||
'crypt_so_path=s' => \$opt_libcrypt_so_path,
|
||||
'use-dns-faking' => \$opt_use_dns_faking
|
||||
);
|
||||
|
||||
@ -346,9 +348,17 @@ my $ld_preload = $ENV{LD_PRELOAD};
|
||||
|
||||
if ($opt_libasan_so_path) {
|
||||
if ($ld_preload) {
|
||||
$ld_preload = "$opt_libasan_so_path:$ld_preload";
|
||||
if ($opt_libcrypt_so_path) {
|
||||
$ld_preload = "$opt_libasan_so_path:$opt_libcrypt_so_path:$ld_preload";
|
||||
} else {
|
||||
$ld_preload = "$opt_libasan_so_path:$ld_preload";
|
||||
}
|
||||
} else {
|
||||
$ld_preload = "$opt_libasan_so_path";
|
||||
if ($opt_libcrypt_so_path) {
|
||||
$ld_preload = "$opt_libasan_so_path:$opt_libcrypt_so_path";
|
||||
} else {
|
||||
$ld_preload = "$opt_libasan_so_path";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,6 +291,14 @@ def cmd_testonly(opt):
|
||||
# Have the selftest.pl LD_PRELOAD libasan in the right spot
|
||||
env.OPTIONS += " --asan_so_path=" + libasan
|
||||
|
||||
if CONFIG_SET(opt, 'HAVE_CRYPT_R'):
|
||||
# We try to find the correct libcrypt automatically
|
||||
libcrypt = Utils.cmd_output(
|
||||
'ldd bin/modules/ldb/password_hash.so | awk \'/libcrypt.so/ { print $3 }\'',
|
||||
silent=True).strip()
|
||||
libcrypt = libcrypt.decode('utf8')
|
||||
env.OPTIONS += " --crypt_so_path=" + libcrypt
|
||||
|
||||
subunit_cache = None
|
||||
# We use the full path rather than relative path to avoid problems on some platforms (ie. solaris 8).
|
||||
env.CORE_COMMAND = '${PERL} ${srcdir}/selftest/selftest.pl --target=${SELFTEST_TARGET} --prefix=${SELFTEST_PREFIX} --srcdir=${srcdir} --exclude=${srcdir}/selftest/skip ${TESTLISTS} ${OPTIONS} ${TESTS}'
|
||||
|
Loading…
x
Reference in New Issue
Block a user