test-network: fix issues when running with sanitizers (#39572)

This commit is contained in:
Luca Boccassi
2025-11-05 17:40:29 +00:00
committed by GitHub

View File

@@ -81,10 +81,10 @@ valgrind_cmd = ''
enable_debug = True
env = {}
wait_online_env = {}
asan_options = None
lsan_options = None
ubsan_options = None
with_coverage = False
asan_options = os.getenv('ASAN_OPTIONS')
lsan_options = os.getenv('LSAN_OPTIONS')
ubsan_options = os.getenv('UBSAN_OPTIONS')
with_coverage = os.getenv('COVERAGE_BUILD_DIR') != None
show_journal = True # When true, show journal on stopping networkd.
active_units = []
@@ -487,7 +487,19 @@ def create_service_dropin(service, command, additional_settings=None):
if ubsan_options:
drop_in += [f'Environment=UBSAN_OPTIONS="{ubsan_options}"']
if asan_options or lsan_options or ubsan_options:
drop_in += ['SystemCallFilter=']
# Disable system call filter when running with sanitizers, as they seem to call filtered syscall at
# the very end of the execution and stuck the process. See issue #39567.
drop_in += [
'LockPersonality=no',
'ProtectClock=no',
'ProtectKernelLogs=no',
'RestrictAddressFamilies=',
'RestrictNamespaces=no',
'RestrictRealtime=no',
'RestrictSUIDSGID=no',
'SystemCallArchitectures=',
'SystemCallFilter=',
]
if use_valgrind or asan_options or lsan_options or ubsan_options:
drop_in += ['MemoryDenyWriteExecute=no']
if use_valgrind: