From ac668a8c556e7b3b94110bf37c0d00869e692070 Mon Sep 17 00:00:00 2001 From: Li Wei Date: Tue, 6 Aug 2024 20:22:13 +0900 Subject: [PATCH] DAOS-16251 misc: Debug memory access issues A messy hack (WIP)... Signed-off-by: Li Wei Required-githooks: true --- Jenkinsfile | 2 +- site_scons/components/__init__.py | 4 +++- site_scons/site_tools/compiler_setup.py | 5 ++++- src/control/SConscript | 4 +++- utils/build.config | 2 +- utils/rpms/daos.spec | 1 + utils/scripts/install-el8.sh | 3 ++- utils/scripts/install-el9.sh | 3 ++- utils/scripts/install-leap15.sh | 3 ++- 9 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 02bcf725c527..bf3eacd0b587 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -185,7 +185,7 @@ pipeline { // 'stages of this run (i.e. auto, auto_md_on_ssd, auto:-3DNAND, ' + // '0000:81:00.0, etc.). Does not apply to MD on SSD stages.') string(name: 'BuildType', - defaultValue: '', + defaultValue: 'debug', description: 'Type of build. Passed to scons as BUILD_TYPE. (I.e. dev, release, debug, etc.). ' + 'Defaults to release on an RC or dev otherwise.') string(name: 'TestRepeat', diff --git a/site_scons/components/__init__.py b/site_scons/components/__init__.py index 8ae538f96249..e6d178a53ac2 100644 --- a/site_scons/components/__init__.py +++ b/site_scons/components/__init__.py @@ -281,6 +281,8 @@ def define_components(reqs): if reqs.target_type == 'debug': abt_build.append('--enable-debug=most') + abt_build.append('--disable-mem-pool') + abt_build.append('--disable-aligned-alloc') else: abt_build.append('--disable-debug') @@ -295,7 +297,7 @@ def define_components(reqs): ['make'], ['make', 'install']], requires=['libunwind'], - libs=['abt'], +# libs=['abt'], headers=['abt.h']) reqs.define('fuse', libs=['fuse3'], defines=['FUSE_USE_VERSION=35'], diff --git a/site_scons/site_tools/compiler_setup.py b/site_scons/site_tools/compiler_setup.py index 9f25ccace719..d79f74f4abfc 100644 --- a/site_scons/site_tools/compiler_setup.py +++ b/site_scons/site_tools/compiler_setup.py @@ -3,6 +3,8 @@ from SCons.Script import Configure, Exit, GetOption DESIRED_FLAGS = ['-fstack-usage', + '-fsanitize=address', + '-fno-omit-frame-pointer', '-Wno-sign-compare', '-Wno-unused-parameter', '-Wno-missing-field-initializers', @@ -13,7 +15,7 @@ '-Wno-unused-command-line-argument', '-Wmismatched-dealloc', '-Wfree-nonheap-object', - '-Wframe-larger-than=4096'] + '-Wframe-larger-than=8192'] # Compiler flags to prevent optimizing out security checks DESIRED_FLAGS.extend(['-fno-strict-overflow', '-fno-delete-null-pointer-checks', '-fwrapv']) @@ -53,6 +55,7 @@ def _base_setup(env): env.Append(CCFLAGS=['-g', '-Wextra', '-Wshadow', '-Wall', '-fpic']) env.AppendIfSupported(CCFLAGS=DESIRED_FLAGS) + env.AppendIfSupported(LINKFLAGS=['-fsanitize=address']) if '-Wmismatched-dealloc' in env['CCFLAGS']: env.AppendUnique(CPPDEFINES={'HAVE_DEALLOC': '1'}) diff --git a/src/control/SConscript b/src/control/SConscript index 54ce6dd8b9dd..ca440ba2a39b 100644 --- a/src/control/SConscript +++ b/src/control/SConscript @@ -36,7 +36,7 @@ def get_build_flags(benv): if is_release_build(benv): return '-buildmode=pie' # enable race detector for non-release builds - return '-race' + return '' def gen_build_id(): @@ -127,6 +127,8 @@ def scons(): # Sets CGO_LDFLAGS for rpath options denv.d_add_rpaths("..", True, True) denv.AppendENVPath("CGO_CFLAGS", denv.subst("$_CPPINCFLAGS"), sep=" ") + denv.AppendENVPath("CGO_CFLAGS", "-fsanitize=address", sep=" ") + denv.AppendENVPath("CGO_LDFLAGS", "-fsanitize=address", sep=" ") if prereqs.client_requested(): install_go_bin(denv, "daos_agent") install_go_bin(denv, "dmg", install_man=True) diff --git a/utils/build.config b/utils/build.config index 6eff18df1fdd..e75da3b6ffff 100644 --- a/utils/build.config +++ b/utils/build.config @@ -2,7 +2,7 @@ component=daos [commit_versions] -ARGOBOTS = v1.1 +ARGOBOTS = v1.2 FUSE = fuse-3.16.2 PMDK = 2.0.0 ISAL = v2.30.0 diff --git a/utils/rpms/daos.spec b/utils/rpms/daos.spec index e4b77a88d726..b9c8bf42c64b 100644 --- a/utils/rpms/daos.spec +++ b/utils/rpms/daos.spec @@ -111,6 +111,7 @@ BuildRequires: systemd-rpm-macros %endif %endif BuildRequires: libuuid-devel +BuildRequires: libasan %if (0%{?suse_version} > 0) BuildRequires: libucp-devel diff --git a/utils/scripts/install-el8.sh b/utils/scripts/install-el8.sh index 4f2e9d8ff754..100ae8d5135f 100755 --- a/utils/scripts/install-el8.sh +++ b/utils/scripts/install-el8.sh @@ -62,7 +62,8 @@ dnf --nodocs install \ systemd \ valgrind-devel \ which \ - yasm + yasm \ + libasan # ipmctl is only available on x86_64 if [ "$arch" = x86_64 ]; then diff --git a/utils/scripts/install-el9.sh b/utils/scripts/install-el9.sh index a8dc1fc31a62..e5d5735cfb28 100755 --- a/utils/scripts/install-el9.sh +++ b/utils/scripts/install-el9.sh @@ -60,4 +60,5 @@ dnf --nodocs install \ sudo \ valgrind-devel \ which \ - yasm + yasm \ + libasan diff --git a/utils/scripts/install-leap15.sh b/utils/scripts/install-leap15.sh index 2e6766e9dade..06dda5c21692 100755 --- a/utils/scripts/install-leap15.sh +++ b/utils/scripts/install-leap15.sh @@ -59,7 +59,8 @@ dnf --nodocs install \ sudo \ valgrind-devel \ which \ - yasm + yasm \ + libasan # ipmctl is only available on x86_64 if [ "$arch" = x86_64 ]; then