[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Cleanup resources on shell exit

From: Jeffrey Walton
Subject: [Help-bash] Cleanup resources on shell exit
Date: Tue, 7 May 2019 01:40:58 -0400

Hi Everyone,

I'm having trouble testing some libraries and programs with Address
Sanitizer. I'm interested in findings that are part of Asan but not
part of Valgrind.

Asan needs to be loaded early but some build systems use an ordering
that is not conducive for Asan. For example, -lasan may be one of the
last libraries linked. A workaround is to LD_PRELOAD=<asan lib>.

When I attempt to use LD_PRELOAD Bash is producing findings that are
tainting the tests. Sometimes the tests fail to run, and other times
the tests run but report results from Bash. For example, this should
build and install OpenSSL and its dependencies with Asan, and then run
the self tests:

    LD_PRELOAD=/usr/lib64/ INSTX_ASAN=1 \
        INSTX_PREFIX=/var/sanitize ./

Each subshell in the script generates one of these:

==11296==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 23 byte(s) in 1 object(s) allocated from:
    #0 0x7f93594ddc08 in __interceptor_malloc (/usr/lib64/
    #1 0x564763da8341 in xmalloc (/usr/bin/bash+0x8a341)

SUMMARY: AddressSanitizer: 23 byte(s) leaked in 1 allocation(s).

The errors cause the script to d bad things, like mis-detect bitness,
mis-detect available options, etc.

My question is, how can I tell Bash to cleanup its resources? Is there
an envar or option to get it to run more strictly or better behaved?

Thanks in advance.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]