Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LeakSanitizer has encountered a fatal error #764

Closed
ttaubert opened this issue Feb 1, 2017 · 6 comments
Closed

LeakSanitizer has encountered a fatal error #764

ttaubert opened this issue Feb 1, 2017 · 6 comments

Comments

@ttaubert
Copy link

ttaubert commented Feb 1, 2017

When trying to build NSPR (the portable runtime lib used by NSS) on a docker machine we see the following:

==21==AddressSanitizer: failed to intercept '__isoc99_printf'
==21==AddressSanitizer: failed to intercept '__isoc99_sprintf'
==21==AddressSanitizer: failed to intercept '__isoc99_snprintf'
==21==AddressSanitizer: failed to intercept '__isoc99_fprintf'
==21==AddressSanitizer: failed to intercept '__isoc99_vprintf'
==21==AddressSanitizer: failed to intercept '__isoc99_vsprintf'
==21==AddressSanitizer: failed to intercept '__isoc99_vsnprintf'
==21==AddressSanitizer: failed to intercept '__isoc99_vfprintf'
==21==AddressSanitizer: failed to intercept '__cxa_throw'
==21==AddressSanitizer: libc interceptors initialized
|| `[0x10007fff8000, 0x7fffffffffff]` || HighMem    ||
|| `[0x02008fff7000, 0x10007fff7fff]` || HighShadow ||
|| `[0x00008fff7000, 0x02008fff6fff]` || ShadowGap  ||
|| `[0x00007fff8000, 0x00008fff6fff]` || LowShadow  ||
|| `[0x000000000000, 0x00007fff7fff]` || LowMem     ||
MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff
redzone=16
max_redzone=2048
quarantine_size_mb=256M
malloc_context_size=30
SHADOW_SCALE: 3
SHADOW_GRANULARITY: 8
SHADOW_OFFSET: 0x7fff8000
==21==Installed the sigaction for signal 11
==21==Installed the sigaction for signal 7
==21==Installed the sigaction for signal 8
==21==T0: stack [0x7ffe690b4000,0x7ffe698b4000) size 0x800000; local=0x7ffe698b2a0c
==21==LeakSanitizer: Dynamic linker not found. TLS will not be handled correctly.
==21==AddressSanitizer Init done
==22==Could not attach to thread 21 (errno 1).
==22==Failed suspending threads.
==21==LeakSanitizer has encountered a fatal error.
==21==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==21==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)

./conftest was compiled with:

clang -o conftest -fsanitize=address conftest.c

This is basically a pre-build config test done by NSPR to check that we can build at all. Our clang version should be recent, we're using the Chromium pre-built binaries:

clang version 4.0.0 (trunk 289944)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/worker/third_party/llvm-build/Release+Asserts/bin

conftest.c looks as follows:

#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define DEBUG 1
/* end confdefs.h.  */
#include <stdio.h>
int
main ()
{
FILE *f = fopen ("conftest.out", "w");
 return ferror (f) || fclose (f) != 0;

  ;
  return 0;
}

Any idea what's going on here? Not sure if this is related to #723, but it might be?

@ttaubert
Copy link
Author

ttaubert commented Feb 1, 2017

BTW, it seems to work if I use docker run --privileged. We don't have those problems with clang 3.9 afaik.

@chefmax
Copy link

chefmax commented Feb 1, 2017

Well, before performing actual leak check, LSan spawns a 'tracer' thread that tries to attach to the program under test via ptrace. It seems that without docker run --privileged ptrace call fails with EPERM (Operation not permitted), see ==22==Could not attach to thread 21 (errno 1). error message.

@ttaubert
Copy link
Author

ttaubert commented Feb 1, 2017

That makes sense. Are you running docker containers in "privileged mode" on CF?

@ttaubert
Copy link
Author

ttaubert commented Feb 1, 2017

Looks like it? Building conftest.c locally on a ossfuzz/base-builder machine yields the same error. So I guess we simply have to look into doing the same thing on our CI then.

@mikea
Copy link
Contributor

mikea commented Feb 1, 2017

We don't run it privileged (lots of capabilities). For LSan it should be enough only to enable ptrace: --cap-add SYS_PTRACE

@ttaubert
Copy link
Author

ttaubert commented Feb 1, 2017

Ok, this is what I'm going to do. Thanks! I'll close this as it's not LSan's fault.

@ttaubert ttaubert closed this as completed Feb 1, 2017
justinmk added a commit to justinmk/neovim that referenced this issue Jan 10, 2018
Workaround for this fun new issue:

    ==27404==LeakSanitizer has encountered a fatal error.
    ==27404==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
    ==27404==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
    Failed: E /build|logs :: Runtime errors detected.

travis-ci/travis-ci#9033
google/sanitizers#764
dschlaep added a commit to DrylandEcology/SOILWAT2 that referenced this issue Jul 13, 2018
We want to run the `*_severe` debug and test targets; thus, we need to enable ptrace capability for (L/A)SAN which is currently not possible
with container-based builds on travis-ci

TODO: revert to `sudo: false` (i.e., container-based builds) once the following are fixed/made possible
 - google/sanitizers#764
 - travis-ci/travis-ci#9033
fwalch added a commit to fwalch/libfranka that referenced this issue Nov 12, 2018
gkrizek added a commit to gkrizek/bitcoin that referenced this issue Dec 28, 2018
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this issue Jan 8, 2019
Enlightenment-bot pushed a commit to Enlightenment/efl that referenced this issue Jan 8, 2020
ASAN leak sanitizer needs ptrace capabilities to run. It seems the
removal sudo true brings up this issue for us.

google/sanitizers#764
travis-ci/travis-ci#9033

It fixes the recent breaks in our ASAN enabled job durign our cron
builds.
Enlightenment-bot pushed a commit to Enlightenment/efl that referenced this issue Jan 8, 2020
ASAN leak sanitizer needs ptrace capabilities to run. It seems the
removal sudo true brings up this issue for us.

google/sanitizers#764
travis-ci/travis-ci#9033

It fixes the recent breaks in our ASAN enabled job durign our cron
builds.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11041
iakov added a commit to iakov/trik-studio that referenced this issue Aug 6, 2020
Linux: docker requires additional capabilities:
google/sanitizers#764

macOS: detect_leaks=1 is unsupported as of Jul 2020
iakov added a commit to trikset/trik-studio that referenced this issue Aug 6, 2020
* Fix memory leaks for trikV62QtsGeneratorTest

* Fix leaking BrickFacktory

* TravisCI: run ASan/LSan

* lupdate translations

* Fix memleak in b2d wrapper

* Fix leaking QActions and few widgets

* Turn off LSan annoying verbosity

* Additional small fixes

* lupdate translations

* TravisCI: use default LSAN_OPTIONS

Linux: docker requires additional capabilities:
google/sanitizers#764

macOS: detect_leaks=1 is unsupported as of Jul 2020

* TravisCI: set QT_QPA_PLATFORM

* Update recommended LSAN suppressions

* gnore singletones

* Fix small leaks
iakov added a commit to trikset/trik-studio that referenced this issue Aug 8, 2020
* Fix memory leaks for trikV62QtsGeneratorTest
* Fix leaking BrickFacktory
* Fix memleak in b2d wrapper
* Fix leaking QActions and few widgets
* TravisCI: use default LSAN_OPTIONS

Linux: docker requires additional capabilities:
google/sanitizers#764

macOS: detect_leaks=1 is unsupported as of Jul 2020

* Rename confusing imageRect()
* Remove strange oveloaded function,
we do not need selection when clicking outside of the box
* Repo: loadFromDisk always return correct empty repo
and no memory leaks occure

* Fix memleak when closing editor scene
When closing soon after opening, memory leaks and read-freed happen

* Avoid pointers to arrays
iakov added a commit to trikset/trik-studio that referenced this issue Aug 9, 2020
* Fix memory leaks for trikV62QtsGeneratorTest

* Fix leaking BrickFacktory

* TravisCI: run ASan/LSan

* lupdate translations

* Fix memleak in b2d wrapper

* Fix leaking QActions and few widgets

* Turn off LSan annoying verbosity

* Additional small fixes

* lupdate translations

* TravisCI: use default LSAN_OPTIONS

Linux: docker requires additional capabilities:
google/sanitizers#764

macOS: detect_leaks=1 is unsupported as of Jul 2020

* Rename confusing imageRect()

* Remove strange oveloaded function,

we do not need selection when clicking outside of the box

* Repo: loadFromDisk always return correct empty repo

and no memory leaks occure

* Fix memleak when closing editor scene

When closing soon after opening, memory leaks and read-freed happen

* Avoid pointers to arrays

* Fix build

* Use new Singleton implementation

With weak reference instead of strong one

* Fix few  memory leaks

* Fix pointer usage

* Tune LSan suppressions to be useful without fast_unwind_on_malloc=0

* lupdate translations

* 2D-model memleaks

Now it runs free of memleaks

* Enable LSAN in tests

* Codestyle fixes

* Fix memleak in property editor

* Fix memleak in generator

* Add aggressive sanitizing in debug mode

* Fix access to incorrect tab object
khodand pushed a commit to khodand/trik-studio that referenced this issue Oct 25, 2020
* Fix memory leaks for trikV62QtsGeneratorTest

* Fix leaking BrickFacktory

* TravisCI: run ASan/LSan

* lupdate translations

* Fix memleak in b2d wrapper

* Fix leaking QActions and few widgets

* Turn off LSan annoying verbosity

* Additional small fixes

* lupdate translations

* TravisCI: use default LSAN_OPTIONS

Linux: docker requires additional capabilities:
google/sanitizers#764

macOS: detect_leaks=1 is unsupported as of Jul 2020

* TravisCI: set QT_QPA_PLATFORM

* Update recommended LSAN suppressions

* gnore singletones

* Fix small leaks
khodand pushed a commit to khodand/trik-studio that referenced this issue Oct 25, 2020
* Fix memory leaks for trikV62QtsGeneratorTest
* Fix leaking BrickFacktory
* Fix memleak in b2d wrapper
* Fix leaking QActions and few widgets
* TravisCI: use default LSAN_OPTIONS

Linux: docker requires additional capabilities:
google/sanitizers#764

macOS: detect_leaks=1 is unsupported as of Jul 2020

* Rename confusing imageRect()
* Remove strange oveloaded function,
we do not need selection when clicking outside of the box
* Repo: loadFromDisk always return correct empty repo
and no memory leaks occure

* Fix memleak when closing editor scene
When closing soon after opening, memory leaks and read-freed happen

* Avoid pointers to arrays
khodand pushed a commit to khodand/trik-studio that referenced this issue Oct 25, 2020
* Fix memory leaks for trikV62QtsGeneratorTest

* Fix leaking BrickFacktory

* TravisCI: run ASan/LSan

* lupdate translations

* Fix memleak in b2d wrapper

* Fix leaking QActions and few widgets

* Turn off LSan annoying verbosity

* Additional small fixes

* lupdate translations

* TravisCI: use default LSAN_OPTIONS

Linux: docker requires additional capabilities:
google/sanitizers#764

macOS: detect_leaks=1 is unsupported as of Jul 2020

* Rename confusing imageRect()

* Remove strange oveloaded function,

we do not need selection when clicking outside of the box

* Repo: loadFromDisk always return correct empty repo

and no memory leaks occure

* Fix memleak when closing editor scene

When closing soon after opening, memory leaks and read-freed happen

* Avoid pointers to arrays

* Fix build

* Use new Singleton implementation

With weak reference instead of strong one

* Fix few  memory leaks

* Fix pointer usage

* Tune LSan suppressions to be useful without fast_unwind_on_malloc=0

* lupdate translations

* 2D-model memleaks

Now it runs free of memleaks

* Enable LSAN in tests

* Codestyle fixes

* Fix memleak in property editor

* Fix memleak in generator

* Add aggressive sanitizing in debug mode

* Fix access to incorrect tab object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants