libp11
libp11 copied to clipboard
How to properly set up mem leak detection?
I did not find a configuration option (in the doc or configure script) on building with memory leak detection and using it. Would be good to add a hint on this at least to the Unix section of the build documentation.
Adding -fsanitize=leak
to the CFLAGS
was promising,
but when using pkcs11.so
as crypto engine with the current OpenSSL master I get
Invalid engine "pkcs11"
C0470945E67F0000:error::DSO support routines:could not load the shared library:crypto/dso/dso_dlfcn.c:118:filename(/usr/local/lib64/engines-3/pkcs11.so): /lib/x86_64-linux-gnu/liblsan.so.0: cannot allocate memory in static TLS block
C0470945E67F0000:error::DSO support routines:could not load the shared library:crypto/dso/dso_lib.c:162:
I don't think our code uses Thread-local storage (TLS) directly, but some libraries may use it. Have you tried using a different compiler (e.g., clang instead of gcc or gcc instead of clang)?
There should not be anything special about memory leak detection in our code. Generic techniques should be applicable.