[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Tue May 14 07:21:03 UTC 2019
The branch, master has been updated
via b1a32dd7f50 selftest: enable undefined behaviour sanitizer
via b0cc6d21748 s4 dsdb: fix use after free in samldb_rename_search_base_callback
from c75fbeaa961 ctdb-tests: Remove old socket wrapper state directory during setup
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b1a32dd7f50ed0aee3d0eea5a124cb8ddfa417ad
Author: Gary Lockyer <gary at catalyst.net.nz>
Date: Tue May 14 11:25:07 2019 +1200
selftest: enable undefined behaviour sanitizer
Add a --undefined-sanitizer option to configure, this causes the tests
to be run with the undefined behaviout sanitizer enabled.
Errors can be suppressed by adding entries to selftest/ubsan.supp
Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue May 14 07:20:28 UTC 2019 on sn-devel-184
commit b0cc6d217485c317b2138347216fac5d74684328
Author: Gary Lockyer <gary at catalyst.net.nz>
Date: Tue May 14 13:10:22 2019 +1200
s4 dsdb: fix use after free in samldb_rename_search_base_callback
Fix use after free detected by AddressSanitizer
AddressSanitizer: heap-use-after-free on address 0x60f0002b2738
at pc 0x7f89b1a213b5 bp 0x7ffce9528810 sp 0x7ffce9528800
READ of size 8 at 0x60f0002b2738 thread T0
#0 0x7f89b1a213b4 in samldb_rename_search_base_callback
../../source4/dsdb/samdb/ldb_modules/samldb.c:4203
#1 0x7f89d3a0db4a in ldb_module_send_entry
../../lib/ldb/common/ldb_modules.c:793
#2 0x7f89b6f27356 in es_callback
../../source4/dsdb/samdb/ldb_modules/encrypted_secrets.c:1418
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13942
Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
-----------------------------------------------------------------------
Summary of changes:
buildtools/wafsamba/samba_autoconf.py | 9 ++++++++-
buildtools/wafsamba/wscript | 5 +++++
selftest/ubsan.supp | 6 ++++++
selftest/wscript | 11 +++++++++--
source4/dsdb/samdb/ldb_modules/samldb.c | 1 -
5 files changed, 28 insertions(+), 4 deletions(-)
create mode 100644 selftest/ubsan.supp
Changeset truncated at 500 lines:
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 0dbfd54393f..be179d8b29b 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -793,10 +793,17 @@ int main(void) {
if Options.options.pedantic:
conf.ADD_CFLAGS('-W', testflags=True)
+ if (Options.options.address_sanitizer or
+ Options.options.undefined_sanitizer):
+ conf.ADD_CFLAGS('-fno-omit-frame-pointer -O1', testflags=True)
if Options.options.address_sanitizer:
- conf.ADD_CFLAGS('-fno-omit-frame-pointer -O1 -fsanitize=address', testflags=True)
+ conf.ADD_CFLAGS('-fsanitize=address', testflags=True)
conf.ADD_LDFLAGS('-fsanitize=address', testflags=True)
conf.env['ADDRESS_SANITIZER'] = True
+ if Options.options.undefined_sanitizer:
+ conf.ADD_CFLAGS('-fsanitize=undefined', testflags=True)
+ conf.ADD_LDFLAGS('-fsanitize=undefined', testflags=True)
+ conf.env['UNDEFINED_SANITIZER'] = True
# Let people pass an additional ADDITIONAL_{CFLAGS,LDFLAGS}
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 2e14a326cb8..8014716e64e 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -128,6 +128,11 @@ def options(opt):
gr.add_option('--address-sanitizer',
help=("Enable address sanitizer compile and linker flags"),
action="store_true", dest='address_sanitizer', default=False)
+ gr.add_option('--undefined-sanitizer',
+ help=("Enable undefined behaviour sanitizer compile and linker flags"),
+ action="store_true",
+ dest='undefined_sanitizer',
+ default=False)
gr.add_option('--abi-check',
help=("Check ABI signatures for libraries"),
diff --git a/selftest/ubsan.supp b/selftest/ubsan.supp
new file mode 100644
index 00000000000..423e0838690
--- /dev/null
+++ b/selftest/ubsan.supp
@@ -0,0 +1,6 @@
+# Suppress the
+# "left shift of x by y places cannot be represented in type 'int'"
+# in the heimdal code for now.
+shift-base:../../source4/heimdal/lib/hcrypto/des.c
+shift-base:../../source4/heimdal/lib/krb5/crypto.c
+
diff --git a/selftest/wscript b/selftest/wscript
index 5116d7ee31b..5c864ebed96 100644
--- a/selftest/wscript
+++ b/selftest/wscript
@@ -265,8 +265,9 @@ def cmd_testonly(opt):
if env.ADDRESS_SANITIZER:
# We try to find the correct libasan automatically
- libasan = Utils.cmd_output('ldd bin/texpect | grep libasan| cut -f 3 -d \ ',
- silent=True).strip()
+ libasan = Utils.cmd_output(
+ 'ldd bin/texpect | grep libasan| cut -f 3 -d \ ',
+ silent=True).strip()
libasan = libasan.decode('utf8')
# Have the selftest.pl LD_PRELOAD libasan in the right spot
@@ -290,6 +291,12 @@ def cmd_testonly(opt):
env.FILTER_OPTIONS = asan_envs + env.FILTER_OPTIONS
env.SUBUNIT_FORMATTER = asan_envs + env.SUBUNIT_FORMATTER
+ if env.UNDEFINED_SANITIZER:
+ # print a stack trace with the error.
+ print_stack_trace = "UBSAN_OPTIONS=print_stacktrace=1"
+ print_stack_trace += ",suppressions=${srcdir}/selftest/ubsan.supp"
+ env.CORE_COMMAND = print_stack_trace + " " + env.CORE_COMMAND
+
if Options.options.LIST:
cmd = '${CORE_COMMAND} --list'
else:
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 4c773da5b19..094f254c8fc 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -4064,7 +4064,6 @@ static int check_rename_constraints(struct ldb_message *msg,
if (samdb_find_attribute(ldb, msg, "objectclass", "subnet") != NULL) {
ret = samldb_verify_subnet(ac, newdn);
if (ret != LDB_SUCCESS) {
- talloc_free(ac);
return ret;
}
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list