mirror of
https://github.com/brazilofmux/tinymux
synced 2026-08-13 00:23:11 -04:00
`make test-asan` could not get past its second leg. tests/netaddr is the only
island that links an object built by the MAIN build --
NETADDR_O = ../../mux/src/netmux-netaddr.o
-- and on a tree configured --enable-sanitizers that object is instrumented,
so it carries undefined sanitizer-runtime references while the island itself
compiles and links without -fsanitize. The failure is in ld, before anything
runs, which is why the LD_PRELOAD from #1471 cannot help: that is a runtime
remedy for a link-time problem.
tests/format, tests/alarm and tests/dbt build every object themselves and link
libmux as a shared library, so they never see undefined sanitizer symbols.
That is why the leg ordering hid this -- test-format passes first and looks
like evidence the preload worked.
Fixed by reading the flags out of the tree's own config.status, which is the
same file test-asan already greps to decide whether the tree is instrumented
at all. An ordinary tree yields an empty string and builds exactly as before;
a tree configured with a different sanitizer selection gets that selection.
Instrumenting the island is also the more useful answer, since the code under
test (mux_subnet::compare_to, parse_subnet) then runs instrumented, which is
the point of a sanitizer run.
## Verified before and after, on macOS arm64
Reproduced first, so the fix is not being credited for a green that was
already there. The symptom differs by platform -- the report was
`__asan_stack_malloc_1` on aarch64/gcc, here it is the UBSan handlers:
__ubsan_handle_type_mismatch_v1
__ubsan_handle_sub_overflow
__ubsan_handle_shift_out_of_bounds
Same class, same cause.
One thing worth recording so the next reader is not sent chasing it: the
macOS linker also prints `cf_log_syntax(...) in netmux-netaddr.o` 32 times in
that error, which reads like a second missing symbol. It is not. ld names
the *referencing* function under each undefined symbol, and cf_log_syntax is
defined in that very object (`nm` shows it as T). Only the sanitizer handlers
are actually undefined.
With the fix, `make test-asan` runs to completion:
format 31744 passed, 0 failed
netaddr 61 passed, 0 failed <- previously failed to link
alarm 8 passed, 0 failed
dbt chain 48 / cache 14 / interp 593 / exec 960+2, all passed
ganl 14 passed, 0 failed, 5 skipped
jit-qreg, jit-ifelse, lua-ecall, scenario all passed
smoke (compiled route) 1509 passed, 315/315 dispatched
smoke (AST route) 1509 passed, 315/315 dispatched
rc=0, and ZERO sanitizer reports in the entire run.
(315 rather than 316 is ASAN_SMOKE_EXCLUDE dropping rvbench_fn, by design.)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| .gitignore | ||
| Makefile | ||
| test_netaddr.cpp | ||