ASAN tests do not work because of umockdev-wrapper
What problem did you encounter
With feedbackd
as a subproject, ASAN tests fail with this error:
ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
How to reproduce
- Remove any
feedbackd
packages through other sources. - Clone Phosh and set it up with
-Dsanitize=address
. - It should clone
feedbackd
as a subproject. - Run tests, like
meson test -C _build_asan quick-setting
. - It should fail.
What is the (wrong) result?
It fails with error (check _build_asan/meson-logs/testlog.txt
):
ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
What is the expected behaviour?
Tests should run smoothly.
Context
feedbackd
should be a subproject than be procured through package manager etc.
My analysis of why this happening is, if we look at the command used to run the tests, it is:
MALLOC_CHECK_=2 G_DEBUG=gc-friendly,fatal-warnings XDG_DATA_HOME=/home/arun-mani-j/Projects/phosh/tests/user/share/ G_TEST_BUILDDIR=/home/arun-mani-j/Projects/phosh/_build_asan/tests PYTHONDONTWRITEBYTECODE=yes NO_AT_BRIDGE=1 ASAN_OPTIONS=fast_unwind_on_malloc=0 XDG_CONFIG_HOME=/home/arun-mani-j/Projects/phosh/tests/user/config/ GSETTINGS_BACKEND=memory LSAN_OPTIONS=suppressions=/home/arun-mani-j/Projects/phosh/data/leak-suppress.txt MALLOC_PERTURB_=18 LD_LIBRARY_PATH=/home/arun-mani-j/Projects/phosh/_build_asan/subprojects/feedbackd/libfeedback UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 G_TEST_SRCDIR=/home/arun-mani-j/Projects/phosh/tests GTK_A11Y=none XDG_CONFIG_DIRS=/home/arun-mani-j/Projects/phosh/tests/system/config/ XDG_DATA_DIRS=/home/arun-mani-j/Projects/phosh/tests/system/share/:/usr/local/share/:/usr/share/ GSETTINGS_SCHEMA_DIR=/home/arun-mani-j/Projects/phosh/_build_asan/data:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/calendar:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/emergency-info:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/launcher-box:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/ticket-box:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/upcoming-events:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/caffeine-quick-setting:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/dark-mode-quick-setting:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/mobile-data-quick-setting:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/night-light-quick-setting:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/simple-custom-quick-setting:/home/arun-mani-j/Projects/phosh/_build_asan/plugins/wifi-hotspot-quick-setting umockdev-wrapper /home/arun-mani-j/Projects/phosh/_build_asan/tests/test-quick-setting
At the last, you can see that the tests are executed under umockdev-wrapper
. So ASAN complains that it is not the runtime it expected...
If you remove umockdev-wrapper
line, then the command runs fine.
This wrapper is set by the tests of feedbackd
subproject - https://source.puri.sm/Librem5/feedbackd/-/blob/main/tests/meson.build?ref_type=heads#L5.
If the is_default: true
is turned off, then the configuration would not leak outside the subproject.
I'm not sure if we can do anything on Phosh side or I don't think if Meson supports any isolation to prevent such issue. May be Phosh can do another call to add_test_setup
to undo the changes by feedbackd
or better feedbackd
turns off the default flag?
Which version did you encounter the bug in?
-
I Compiled it myself. If you compiled phosh from source please provide the git revision via e.g. by running git log -1 --pretty=oneline
and pasting the output below. -
I used the precompiled Debian package (e.g. by running a prebuilt image). Please paste the output oof dpkg -s phosh
below.
d727417c9f4f47aff583cc88169ef462b7fbe5b6 (HEAD -> quick-settings, origin/quick-settings) tools: Add PhoshQuickSettingsBoxStandalone
How are you running phosh?
-
PureOS amd64 qemu image -
Mobile phone (model: ... , operating system version: ... ) -
Librem5 devkit -
nested compositor. If so please give the full command you start phosh with. -
other (please elaborate)