Closed Bug 1279108 Opened 4 years ago Closed 4 years ago

AddressSanitizer: 9343 byte(s) leaked in 73 allocation(s).

Categories

(Toolkit :: Application Update, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: glandium, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

This happens when switching to clang 3.8 for ASAN builds (instead of 3.5 currently):
https://treeherder.mozilla.org/logviewer.html#?job_id=22157655&repo=try

 00:10:35     INFO -  PROCESS | 25836 | =================================================================
 00:10:35     INFO -  PROCESS | 25836 | ==25854==ERROR: LeakSanitizer: detected memory leaks
 00:10:35     INFO -  PROCESS | 25836 | Direct leak of 6128 byte(s) in 5 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b1714 in calloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x7febf7eb0aa0 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4daa0)
 00:10:35     INFO -  PROCESS | 25836 | Direct leak of 2153 byte(s) in 1 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b158b in __interceptor_malloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x4ea006 in GetManifestContents(char const*) /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:4004:25
 00:10:35     INFO -  PROCESS | 25836 |     #2 0x4e6b06 in DoUpdate /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:4124:18
 00:10:35     INFO -  PROCESS | 25836 |     #3 0x4e6b06 in UpdateThreadFunc(void*) /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:2490
 00:10:35     INFO -  PROCESS | 25836 |     #4 0x7febf9d61e99 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7e99)
 00:10:35     INFO -  PROCESS | 25836 | Direct leak of 374 byte(s) in 23 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b158b in __interceptor_malloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x4e8b2c in get_quoted_path /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:474:30
 00:10:35     INFO -  PROCESS | 25836 |     #2 0x4e8b2c in add_dir_entries(char const*, ActionList*) /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:3919
 00:10:35     INFO -  PROCESS | 25836 |     #3 0x4e7794 in DoUpdate /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:4178:12
 00:10:35     INFO -  PROCESS | 25836 |     #4 0x4e7794 in UpdateThreadFunc(void*) /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:2490
 00:10:35     INFO -  PROCESS | 25836 |     #5 0x7febf9d61e99 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7e99)
 00:10:35     INFO -  PROCESS | 25836 | Direct leak of 186 byte(s) in 22 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b158b in __interceptor_malloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x4e8dec in get_quoted_path /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:474:30
 00:10:35     INFO -  PROCESS | 25836 |     #2 0x4e8dec in add_dir_entries(char const*, ActionList*) /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:3936
 00:10:35     INFO -  PROCESS | 25836 |     #3 0x4e7794 in DoUpdate /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:4178:12
 00:10:35     INFO -  PROCESS | 25836 |     #4 0x4e7794 in UpdateThreadFunc(void*) /builds/slave/try-l64-asan-00000000000000000/build/src/toolkit/mozapps/update/updater/updater.cpp:2490
 00:10:35     INFO -  PROCESS | 25836 |     #5 0x7febf9d61e99 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7e99)
 00:10:35     INFO -  PROCESS | 25836 | Direct leak of 138 byte(s) in 1 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b158b in __interceptor_malloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x7febf7eb0a38 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4da38)
 00:10:35     INFO -  PROCESS | 25836 | Direct leak of 48 byte(s) in 2 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b1714 in calloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x7febf7eb0aa0 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4daa0)
 00:10:35     INFO -  PROCESS | 25836 |     #2 0x7febf86f4bef  (/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0+0x34dbef)
 00:10:35     INFO -  PROCESS | 25836 | Direct leak of 48 byte(s) in 2 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b1714 in calloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x7febf7eb0aa0 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4daa0)
 00:10:35     INFO -  PROCESS | 25836 |     #2 0x7febf6fc8147  (/lib/x86_64-linux-gnu/libc.so.6+0x141147)
 00:10:35     INFO -  PROCESS | 25836 | Indirect leak of 128 byte(s) in 1 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b18de in realloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:71:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x7febf7eb0af6 in g_realloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4daf6)
 00:10:35     INFO -  PROCESS | 25836 | Indirect leak of 92 byte(s) in 14 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b158b in __interceptor_malloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x7febf7eb0a38 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4da38)
 00:10:35     INFO -  PROCESS | 25836 | Indirect leak of 24 byte(s) in 1 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b1714 in calloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x7febf7eb0aa0 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4daa0)
 00:10:35     INFO -  PROCESS | 25836 |     #2 0x7febf6fc8147  (/lib/x86_64-linux-gnu/libc.so.6+0x141147)
 00:10:35     INFO -  PROCESS | 25836 | Indirect leak of 24 byte(s) in 1 object(s) allocated from:
 00:10:35     INFO -  PROCESS | 25836 |     #0 0x4b1714 in calloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
 00:10:35     INFO -  PROCESS | 25836 |     #1 0x7febf7eb0aa0 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4daa0)
 00:10:35     INFO -  PROCESS | 25836 |     #2 0x7febf86f4bef  (/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0+0x34dbef)
00:10:35 INFO - PROCESS | 25836 | SUMMARY: AddressSanitizer: 9343 byte(s) leaked in 73 allocation(s).
With more recent version of ASAN, the updater program shows multiple
leaks, for different reasons.

One is that the updater code heavily relies on pointers into a large
buffer, with exceptions, making things difficult to avoid leaks of those
exceptions. At least it requires more effort than I'm willing to put for
the sake of upgrading the compiler we use for ASAN.

Another is that the leak suppressions are not currently used for
xpcshell tests, and some leaks attributed to libglib, that would
normally be suppressed, are not.

Moreover, even if the suppressions were used, it looks like some are not
rooted to already suppressed system libraries, and would require
investigation. Ideally, we'd have debug symbols installed for the system
libraries and would have full stack traces, but we don't, so this makes
the whole process harder than necessary.

All in all, the updater is a separate short-lived program, and until we
can address all the problems above, we can just ignore memory leaks in
it (which aren't new anyways and are ignored by not being detected by
the ASAN currently used on automation). We don't disable ASAN entirely,
though, only leak detection, and only for the updater program.

Review commit: https://reviewboard.mozilla.org/r/58954/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/58954/
Attachment #8762058 - Flags: review?(continuation)
Comment on attachment 8762058 [details]
Bug 1279108 - Disable leak detection for updater xpcshell tests.

https://reviewboard.mozilla.org/r/58954/#review55868

::: toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js:1639
(Diff revision 1)
>                  createInstance(Ci.nsIProcess);
>    process.init(updateBin);
>    process.run(true, args, args.length);
>  
> +  // Restore previous ASAN_OPTIONS if there were any.
> +  if (asan_options !== null) {

Shouldn't this clear ASAN_OPTIONS if asan_options is null? It seems odd to reset in one case but not the other.
Attachment #8762058 - Flags: review?(continuation) → review+
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5834abf0aebb
Disable leak detection for updater xpcshell tests. r=mccr8
https://hg.mozilla.org/mozilla-central/rev/5834abf0aebb
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Pushed by rstrong@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fde25393009b
Remove code that disables asan leak detection in app update xpcshell tests. r=mhowell
Blocks: LSan
You need to log in before you can comment on or make changes to this bug.