matrix:
name: [linux-clang, linux-clang-openssl, linux-gcc]
include:
- # llvm-symbolizer fails on Ubuntu 24.04 until we
- # can avoid using LD_LIBRARY_PATH in the test
- # suite. This causes test suite failures due to
- # SIGPIPE exits from test programs. See
- # https://github.com/llvm/llvm-project/issues/120915
- name: linux-clang
- os: ubuntu-22.04
+ os: ubuntu-latest
compiler: clang
makevars: CPPFLAGS=-Werror
configureopts: --enable-asan
import atexit
import fcntl
+import glob
import optparse
import os
import shlex
return os.path.abspath(root)
+# Look for the system LLVM symbolizer, matching the logic the asan
+# runtime would use as closely as possible.
+def _find_symbolizer():
+ if sys.platform == 'darwin':
+ f = which('atos')
+ if f is not None:
+ return f
+
+ f = which('llvm-symbolizer')
+ if f is not None:
+ return f
+
+ # Debian-derived systems have versioned symbolizer names. If any
+ # exist, pick one of them.
+ l = glob.glob('/usr/bin/llvm-symbolizer-*')
+ if l:
+ return l[0]
+
+ f = which('addr2line')
+ if f is not None:
+ return f
+
+ return None
+
+
# Parse command line arguments, setting global option variables. Also
# sets the global variable args to the positional arguments, which may
# be used by the test script.
if get_creds and create_kdb and create_user and start_kdc:
self.kinit(self.user_princ, password('user'))
self.klist(self.user_princ)
+ self._setup_symbolizer()
def _create_empty_dir(self):
dir = self.testdir
env['GSS_MECH_CONFIG'] = self.gss_mech_config
return env
+ # The krb5 libraries may be included in the dependency chain of
+ # llvm-symbolizer, which is invoked by asan when displaying stack
+ # traces. If they are, asan-compiled krb5 libraries in
+ # LD_LIBRARY_PATH (or similar) will cause a dynamic linker error
+ # for the symbolizer at startup. Work around this problem by
+ # wrapping the symbolizer in a script that unsets the dynamic
+ # linker variables before calling the real symbolizer.
+ def _setup_symbolizer(self):
+ if runenv.asan != 'yes':
+ return
+ if 'ASAN_SYMBOLIZER_PATH' in self.env:
+ return
+ symbolizer_path = _find_symbolizer()
+ if symbolizer_path is None:
+ return
+ wrapper_path = os.path.join(self.testdir, 'llvm-symbolizer')
+ with open(wrapper_path, 'w') as f:
+ f.write('#!/bin/sh\n')
+ for v in runenv.env:
+ f.write('unset %s\n' % v)
+ f.write('exec %s "$@"\n' % symbolizer_path)
+ os.chmod(wrapper_path, 0o755)
+ self.env['ASAN_SYMBOLIZER_PATH'] = wrapper_path
+
def run(self, args, env=None, **keywords):
if env is None:
env = self.env