summaryrefslogtreecommitdiffstats
path: root/src/ceph.in
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2018-10-22 08:06:38 +0200
committerKefu Chai <kchai@redhat.com>2018-10-22 08:40:03 +0200
commitfd58e5d4ad2035ce66b6a3de8a0967e75cb985de (patch)
treed71dc6aa2abac522482778570fc36619b56edd0f /src/ceph.in
parentceph.in: extract get_cmake_variables() (diff)
downloadceph-fd58e5d4ad2035ce66b6a3de8a0967e75cb985de.tar.xz
ceph-fd58e5d4ad2035ce66b6a3de8a0967e75cb985de.zip
cmake,ceph.in: preload libasan if WITH_ASAN
we need to preload libasan.so as the python exectuable is not likely to be compiled with ASan enabled. see: https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso#asan-and-ld_preload just to ease the use of ASan, for fine-tuned behaviour, use `ASAN_OPTIONS`. Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/ceph.in')
-rwxr-xr-xsrc/ceph.in11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ceph.in b/src/ceph.in
index 82d6239486c..7a205c38867 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -68,7 +68,7 @@ MYPDIR = os.path.dirname(MYDIR)
DEVMODEMSG = '*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***'
-def respawn_in_path(lib_path, pybind_path, pythonlib_path):
+def respawn_in_path(lib_path, pybind_path, pythonlib_path, asan_lib_path):
execv_cmd = []
if 'CEPH_DBG' in os.environ:
execv_cmd += ['@PYTHON_EXECUTABLE@', '-mpdb']
@@ -79,6 +79,8 @@ def respawn_in_path(lib_path, pybind_path, pythonlib_path):
lib_path_var = "LD_LIBRARY_PATH"
execv_cmd += sys.argv
+ if asan_lib_path:
+ os.environ['LD_PRELOAD'] = asan_lib_path
if lib_path_var in os.environ:
if lib_path not in os.environ[lib_path_var]:
os.environ[lib_path_var] += ':' + lib_path
@@ -114,8 +116,9 @@ def get_cmake_variables(names):
if os.path.exists(os.path.join(MYPDIR, "CMakeCache.txt")) \
and os.path.exists(os.path.join(MYPDIR, "bin/init-ceph")):
- src_path = get_cmake_variables(["ceph_SOURCE_DIR"])["ceph_SOURCE_DIR"]
-
+ vars = get_cmake_variables(["ceph_SOURCE_DIR", "ASAN_LIBRARY"])
+ src_path = vars["ceph_SOURCE_DIR"]
+ asan_lib_path = vars["ASAN_LIBRARY"]
if src_path is None:
# Huh, maybe we're not really in a cmake environment?
pass
@@ -128,7 +131,7 @@ if os.path.exists(os.path.join(MYPDIR, "CMakeCache.txt")) \
"cython_modules",
get_pythonlib_dir())
- respawn_in_path(lib_path, pybind_path, pythonlib_path)
+ respawn_in_path(lib_path, pybind_path, pythonlib_path, asan_lib_path)
if 'PATH' in os.environ and bin_path not in os.environ['PATH']:
os.environ['PATH'] = os.pathsep.join([bin_path, os.environ['PATH']])