Skip to content

Commit

Permalink
DAOS-15799 build: Add libsanitize
Browse files Browse the repository at this point in the history
Add libsanitize for debugging stack smashing occuring on LRZ servers.

Skip-test: true
Required-githooks: true

Signed-off-by: Cedric Koch-Hofer <[email protected]>
  • Loading branch information
kanard38 authored and Cedric Koch-Hofer committed May 31, 2024
1 parent bf9ac88 commit aa4faec
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 11 deletions.
3 changes: 3 additions & 0 deletions site_scons/site_tools/compiler_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# Compiler flags for stack hardening
DESIRED_FLAGS.extend(['-fstack-protector-strong', '-fstack-clash-protection'])

# Compiler flags for fast memory error detector
DESIRED_FLAGS.extend(['-fsanitize=address'])

PP_ONLY_FLAGS = ['-Wno-parentheses-equality', '-Wno-builtin-requires-header',
'-Wno-unused-function']

Expand Down
2 changes: 1 addition & 1 deletion src/bio/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def scons():
libs += ['spdk_vmd', 'spdk_event_bdev', 'spdk_init']

# Other libs
libs += ['numa', 'dl', 'smd']
libs += ['numa', 'dl', 'smd', 'asan']

tgts = FILES + control_tgts
bio = denv.d_library("bio", tgts, install_off="../..", LIBS=libs)
Expand Down
2 changes: 1 addition & 1 deletion src/common/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def build_daos_common(denv, client):
ad_mem_files = []
dav_src = []

common_libs = ['isal', 'isal_crypto', 'cart', 'gurt', 'lz4', 'protobuf-c', 'uuid', 'pthread']
common_libs = ['isal', 'isal_crypto', 'cart', 'gurt', 'lz4', 'protobuf-c', 'uuid', 'pthread', 'asan']

Check failure on line 22 in src/common/SConscript

View workflow job for this annotation

GitHub Actions / Flake8 check

E501 line too long (105 > 100 characters)

Check warning on line 22 in src/common/SConscript

View workflow job for this annotation

GitHub Actions / Pylint check

line-too-long, Line too long (105/100)
if client:
libname = 'daos_common'
else:
Expand Down
2 changes: 1 addition & 1 deletion src/control/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def install_go_bin(env, name, libs=None, install_man=False):

if libs is None:
libs = []
libs.extend(['daos_common', 'cart', 'gurt'])
libs.extend(['daos_common', 'cart', 'gurt', 'asan'])

target = env.d_run_command(name, sources, libs,
f'cd {gosrc}; {env.d_go_bin} build -mod vendor '
Expand Down
2 changes: 1 addition & 1 deletion src/control/lib/spdk/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def scons():
libs += ['rte_mempool_ring', 'rte_bus_pci']

# Other libs
libs += ['numa', 'dl']
libs += ['numa', 'dl', 'asan']

nc_obj = senv.Object("src/nvme_control.c")
ncc_obj = senv.Object("src/nvme_control_common.c")
Expand Down
2 changes: 1 addition & 1 deletion src/control/lib/spdk/ctests/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def scons():
libs += ['rte_mempool_ring', 'rte_bus_pci', 'nvme_control']

# Other libs
libs += ['numa', 'dl', 'isal', 'cmocka', 'pthread']
libs += ['numa', 'dl', 'isal', 'cmocka', 'pthread', 'asan']

if GetOption('help'):
return
Expand Down
2 changes: 1 addition & 1 deletion src/tests/drpc/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def scons():
"""Execute build"""
Import('env')

libs = ['daos_common', 'gurt', 'protobuf-c']
libs = ['daos_common', 'gurt', 'protobuf-c', 'asan']
sources = ['drpc_test.c', 'drpc_test.pb-c.c']

denv = env.Clone()
Expand Down
2 changes: 1 addition & 1 deletion src/tests/rpc/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def scons():
"""Execute build"""
Import('env')

libs = ['daos', 'daos_common', 'cmocka', 'gurt']
libs = ['daos', 'daos_common', 'cmocka', 'gurt', 'asan']
sources = ['rpc_tests.c']

denv = env.Clone()
Expand Down
2 changes: 1 addition & 1 deletion src/tests/security/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def scons():
"""Execute build"""
Import('env', 'dc_sectest_tgts')

libs = ['$LIBS', 'daos', 'daos_common', 'gurt']
libs = ['$LIBS', 'daos', 'daos_common', 'gurt', 'asan']
sec_sources = ['security_test.c', dc_sectest_tgts]
acl_sources = ['acl_dump_test.c']

Expand Down
2 changes: 1 addition & 1 deletion src/utils/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def scons():
denv = env.Clone()
denv.AppendUnique(LIBPATH=[Dir('../client/dfs')])
denv.AppendUnique(CPPPATH=[Dir('../client/dfs').srcnode()])
libs = ['daos', 'daos_common', 'uuid', 'dfs', 'duns', 'gurt', 'cart', 'dl']
libs = ['daos', 'daos_common', 'uuid', 'dfs', 'duns', 'gurt', 'cart', 'dl', 'asan']

daos_hdlrs_src = ['daos_hdlr.c', 'daos_autotest.c', 'daos_dfs_hdlr.c']
daos_hdlrs_lib = denv.d_library('daos_cmd_hdlrs', daos_hdlrs_src, LIBS=libs)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/crt_launch/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def scons():

tenv = env.Clone()

libs = ['dpar', 'cart', 'gurt', 'pthread', 'm']
libs = ['dpar', 'cart', 'gurt', 'pthread', 'm', 'asan']

tenv.AppendUnique(LIBS=libs)
tenv.require('mercury')
Expand Down
8 changes: 7 additions & 1 deletion utils/rpms/daos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

Name: daos
Version: 2.4.2
Release: 4%{?relval}%{?dist}
Release: 5%{?relval}%{?dist}
Summary: DAOS Storage Engine

License: BSD-2-Clause-Patent
Expand Down Expand Up @@ -114,6 +114,9 @@ BuildRequires: libuct-devel
BuildRequires: ucx-devel
%endif

# Needed for support tasks
BuildRequires: libasan

Requires: openssl
# This should only be temporary until we can get a stable upstream release
# of mercury, at which time the autoprov shared library version should
Expand Down Expand Up @@ -555,6 +558,9 @@ getent passwd daos_agent >/dev/null || useradd -s /sbin/nologin -r -g daos_agent
# No files in a shim package

%changelog
* Fri May 31 2024 Cedric Koch-Hofer <[email protected]> 2.4.2-5
- Support release candidate for 2.4.2

* Mon Mar 04 2024 Phillip Henderson <[email protected]> 2.4.2-4
- Third release candidate for 2.4.2

Expand Down
1 change: 1 addition & 0 deletions utils/scripts/install-el8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dnf --nodocs install \
java-1.8.0-openjdk \
json-c-devel \
libaio-devel \
lbasan \
libcmocka-devel \
libevent-devel \
libiscsi-devel \
Expand Down
1 change: 1 addition & 0 deletions utils/scripts/install-el9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dnf --nodocs install \
java-1.8.0-openjdk \
json-c-devel \
libaio-devel \
libasan \
libcmocka-devel \
libevent-devel \
libipmctl-devel \
Expand Down
1 change: 1 addition & 0 deletions utils/scripts/install-leap15.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dnf --nodocs install \
hwloc-devel \
java-1_8_0-openjdk-devel \
libaio-devel \
libasan \
libcmocka-devel \
libcapstone-devel \
libevent-devel \
Expand Down
1 change: 1 addition & 0 deletions utils/scripts/install-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ apt-get install \
golang-go \
kmod \
libaio-dev \
libasan8 \
libboost-dev \
libcapstone-dev \
libcmocka-dev \
Expand Down

0 comments on commit aa4faec

Please sign in to comment.