test: suppress certain leaks reported by LSan#21472
Conversation
so we can run TEST-46 under sanitizers once again. `systemd-homed` runs fsck on home directories, which reports a memory leak we're not interested in. Let's introduce an LSan suppression file to get around this. Since the patterns in the suppression file are matched using basic substring match[0], they're a bit cumbersome, but should get the work one. [0] https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions Example leaks (as reported by TEST-46): ``` systemd-homed[1333]: ================================================================= systemd-homed[1333]: ==1333==ERROR: LeakSanitizer: detected memory leaks systemd-homed[1333]: Direct leak of 24 byte(s) in 1 object(s) allocated from: systemd-homed[1333]: #0 0x7f0c8facccd1 in calloc (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xf4cd1) systemd-homed[1333]: #1 0x558d9494ff67 (/usr/bin/fsck+0x3f67) systemd-homed[1333]: Direct leak of 6 byte(s) in 1 object(s) allocated from: systemd-homed[1333]: #0 0x7f0c8fa906c1 in strdup (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xb86c1) systemd-homed[1333]: #1 0x558d949518fd (/usr/bin/fsck+0x58fd) systemd-homed[1333]: SUMMARY: AddressSanitizer: 30 byte(s) leaked in 2 allocation(s). systemd-homed[1337]: ==1337==WARNING: Symbolizer was blocked from starting itself! systemd-homed[1337]: ================================================================= systemd-homed[1337]: ==1337==ERROR: LeakSanitizer: detected memory leaks systemd-homed[1337]: Direct leak of 67584 byte(s) in 1 object(s) allocated from: systemd-homed[1337]: #0 0x7f01edb84b19 (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xf4b19) systemd-homed[1337]: #1 0x7f01e8326829 (/usr/bin/../lib/libLLVM-12.so+0xb46829) systemd-homed[1337]: SUMMARY: AddressSanitizer: 67584 byte(s) leaked in 1 allocation(s). ``` With the suppression file: ``` systemd-homed[1339]: ----------------------------------------------------- systemd-homed[1339]: Suppressions used: systemd-homed[1339]: count bytes template systemd-homed[1339]: 2 30 /bin/fsck$ systemd-homed[1339]: ----------------------------------------------------- systemd-homed[1343]: ==1343==WARNING: Symbolizer was blocked from starting itself! systemd-homed[1343]: ----------------------------------------------------- systemd-homed[1343]: Suppressions used: systemd-homed[1343]: count bytes template systemd-homed[1343]: 1 67584 /lib/libLLVM systemd-homed[1343]: ----------------------------------------------------- ```
0e05f34 to
f201f34
Compare
ASan is having a hard time to get its LD_PRELOAD= shenanigans straight with all the shells flying around. Let's make it a bit easier by using one of the nifty systemctl's features instead.
3d066bf to
c83f126
Compare
| cat >/systemd-lsan.supp <<INNER_EOF | ||
| leak:/bin/fsck$ | ||
| leak:/sbin/fsck$ | ||
| leak:/lib/libLLVM |
There was a problem hiding this comment.
I'm not sure it should be ignored. Judging by "Symbolizer was blocked from starting itself!" it seems a few sandbox features should be relaxed in systemd-homed to make it compatible with ASan
There was a problem hiding this comment.
Just to clarify, I was talking about "/lib/libLLVM"
There was a problem hiding this comment.
On second thought we're not interested in that memory leak either way so it should probably be ignored :-) I think what I was trying to say is that it's just a symptom of some sandbox setting being too strict probably
There was a problem hiding this comment.
Yeah, I wasn't completely sure where exactly it comes from, but I can't reproduce it with gcc (well, obviously, but I mean something similar), and it disappears when there are no leaks.
Nevertheless, I'll look into tweaking the sandbox restrictions as well, in case there's something else hiding.
|
|
||
| # Generic substring function. If $2 is in $1, return 0. | ||
| strstr() { [ "${1#*$2*}" != "$1" ]; } | ||
| strstr() { [ "${1#*"$2"*}" != "$1" ]; } |
|
All three Ubuntu CIs timed out on TEST-37-RUNTIMEDIRECTORYPRESERVE, unrelated (but I'll finally take a look what's going on). |
It's a recent regression, I opened: |
so we can run TEST-46 under sanitizers once again.
systemd-homedruns fsck on home directories, which reports a memoryleak we're not interested in. Let's introduce an LSan suppression file
to get around this. Since the patterns in the suppression file are
matched using basic substring match[0], they're a bit cumbersome, but
should get the work one.
[0] https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions
Example leaks (as reported by TEST-46):
With the suppression file: