aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/leak_detective.c
Commit message (Collapse)AuthorAgeFilesLines
* leak-detective: Whitelisted memory leaks in FHH IMCs and IMVsAndreas Steffen2017-05-291-0/+3
|
* leak-detective: Whitelist thread ID getterTobias Brunner2016-09-201-1/+3
| | | | | | | | In case an external thread calls into our code and logs messages, a thread object is allocated that will never be released. Even if we try to clean up the object via thread value destructor there is no guarantee that the thread actually terminates before we check for leaks, which seems to be the case for the Ada Tasking threads.
* leak-detective: Whitelist functions of the Ada runtime related to TaskingTobias Brunner2016-09-201-0/+4
|
* leak-detective: Whitelist some glib/libsoup functionsTobias Brunner2016-09-201-1/+13
| | | | | | Some of these are pretty broad, so maybe an alternative option is to not use the soup plugin in the openssl-ikev2/rw-suite-b* scenarios. But the plugin is not tested anywhere else so lets go with this for now.
* leak-detective: Whitelist leak in libldapTobias Brunner2016-09-201-0/+2
|
* leak-detective: Try to properly free allocations after deinitializationTobias Brunner2016-06-291-0/+13
| | | | | | | | If a function we whitelist allocates memory while leak detective is enabled but only frees it after LD has already been disabled, free() will get called with invalid pointers (not pointing to the actually allocated memory by LD), which will cause checks in the C library to fail and the program to crash. This tries to detect such cases and calling free with the correct pointer.
* openssl: Whitelist OPENSSL_init_crypto() and others in leak detectiveTobias Brunner2016-06-291-0/+4
| | | | | | | | | Lots of static data is allocated in this function, which isn't freed until the library is unloaded (we can't call OPENSSL_cleanup() as initialization would fail when calling it again later). When enabling the leak detective the test runner eventually crashes as all the data allocated during initialization has an invalid size when freed after leak detective has been unloaded.
* leak-detective: Make sure to actually call malloc() from calloc() hookTobias Brunner2016-06-151-3/+4
| | | | | | | | Newer versions of GCC are too "smart" and replace a call to malloc(X) followed by a call to memset(0,X) with a call co calloc(), which obviously results in an infinite loop when it does that in our own calloc() implementation. Using `volatile` for the variable storing the total size prevents the optimization and we actually call malloc().
* leak-detective: Whitelist __fprintf_chk as seen on newer systemsTobias Brunner2016-06-151-0/+1
|
* leak-detective: added _IO_file_doallocate to whitelistAndreas Steffen2016-04-241-0/+1
|
* Use standard unsigned integer typesAndreas Steffen2016-03-241-4/+4
|
* leak-detective: Use passed callback to report leaksTobias Brunner2015-04-201-2/+2
| | | | | | | | This prevented `stroke memusage` from reporting the leaks on the console. Instead, they were sent to the callbacks set up by libstrongswan. Fixes a426851f6362 ("leak-detective: Use callback functions to report leaks and usage information").
* leak-detective: Whitelist gcrypt_plugin_create()Martin Willi2015-04-151-0/+1
| | | | | | gcry_check_version() does not free statically allocated resources. However, we can't whitelist it in some versions, as it is not a resolvable symbol name. Instead, whitelist our own plugin constructor function.
* leak-detective: Whitelist libssl SSL_COMP_get_compression_methods()Martin Willi2014-09-241-0/+2
| | | | | This function is called by libcurl initialization with SSL, and uses a static allocation of compression algorithms not freed.
* windows: Add a common Windows header for platform specific wrappersMartin Willi2014-06-031-5/+3
| | | | | Include some more basic system headers in utils.h, so we can use that common header on the different platforms.
* leak-detective: LEAK_DETECTIVE_DISABLE completely disables LDTobias Brunner2014-04-031-6/+9
| | | | | If lib->leak_detective is non-null some code parts (e.g. the plugin loader) assume LD is actually used.
* utils: Move thread-safe strerror replacement to a separate fileTobias Brunner2014-02-241-1/+1
| | | | | For some utils _GNU_SOURCE might be needed but that conflicts with the signature of strerror_r(3).
* lib: All settings use configured namespaceTobias Brunner2014-02-121-3/+3
|
* leak_detective: Assign return value of realloc to bufThomas Egerer2014-02-101-1/+1
| | | | | | | If realloc return a pointer value different from the value to be reallocated, a double free can occur in this context. Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
* leak-detective: Call {gm,local}time_r() to allocate static bufferMartin Willi2013-11-061-0/+5
| | | | | On OS X Mavericks, these functions use a static allocation and are hard to whitelist using other means.
* leak-detective: Register OS X specific hooks just onceMartin Willi2013-11-061-0/+7
| | | | | If we initialize libstrongswan more than once in the same process, we may not register the hooks twice.
* leak-detective: Reset leak list during cleanupMartin Willi2013-11-061-0/+1
| | | | This resets leak detective state should it get created/destroyed more than once.
* leak-detective: Use callback functions to report leaks and usage informationMartin Willi2013-11-061-36/+53
| | | | This is more flexible than printing reports to a FILE.
* Added tzset memory leak to whitelistAndreas Steffen2013-08-281-0/+1
|
* leak-detective: remove hdr entry when reallocating zero bytesMartin Willi2013-07-121-0/+6
|
* leak-detective: print total of allocated/leaked bytes in usage/reportMartin Willi2013-07-121-5/+13
|
* leak-detective: add a usage threshold option based on the number of allocationsMartin Willi2013-07-101-6/+11
|
* leak-detective: set_state() only affects the calling threadMartin Willi2013-07-101-13/+1
| | | | | The only user (bfd backtraces) is fine with that, and we really should not mess the enable flag while doing allocations with other threads.
* leak-detective: take a copy of backtrace while printing tracesMartin Willi2013-07-101-2/+3
| | | | | As we don't want to hold the lock, we must make sure backtraces keep valid while printing them.
* leak-detective: remove hdr from the allocation list during realloc()Martin Willi2013-07-101-39/+60
| | | | | | | If realloc moves an allocation, the original allocation gets freed. We therefore must remove the hdr from the list, as it is invalid. We can add it afterwards once it has been updated, allowing us to unlock the list during reallocation.
* leak-detective: (re-)whitelist some OpenSSL functionsMartin Willi2013-06-211-0/+5
| | | | | | | Some static allocations in plugins won't get freed, because in the test case process the plugins are not destroyed. If a plugin would clean up allocations done while just using the plugin, these show up as leak in the child process, letting tests fail.
* leak-detective: Resolve hooked functions during initializationTobias Brunner2013-06-111-1/+4
| | | | | | | | | If uses of dlopen(), e.g. when loading plugins, produce errors an error string could get allocated dynamically. At this point realloc() might not yet be resolved and when dlsym() is later called by leak detective to do so the error string might get freed while leak detective is disabled and real_free() will be called with a pointer into one of leak detective's memory blocks instead of a pointer to the block itself, causing a SIGSEGV.
* Add getter for the number of leaks to leak_detective_tTobias Brunner2013-06-111-2/+16
|
* openssl: Properly cleanup OpenSSL libraryTobias Brunner2013-05-081-7/+0
|
* leak-detective: add support for OS X by hooking default malloc zoneMartin Willi2013-05-061-5/+160
|
* leak-detective: remove unused malloc call countersMartin Willi2013-05-061-7/+0
|
* leak-detective: align allocations on both 32 and 64-bit systems to 32 bytesMartin Willi2013-05-061-0/+5
|
* leak-detective: call tzset() explicitly before enabling leak detectiveMartin Willi2013-05-061-6/+11
| | | | | tzset() is hard to whitelist on some systems, as there is no symbol involved. Call tzset() explicitly before initialization to avoid false positives.
* leak-detective: override malloc functions instead of using deprecated hooksMartin Willi2013-05-061-128/+206
| | | | | | | malloc hooks have become deprecated, and their use has always been problematic, especially in multi-threaded applications. Replace the functionality by overriding all malloc functions and query the system allocator functions using dlsym() with RTLD_NEXT.
* added getpwuid_r and initgroups to whitelistAndreas Steffen2013-03-031-0/+2
|
* Moved debug.[ch] to utils folderTobias Brunner2012-10-241-1/+1
|
* Moved data structures to new collections subfolderTobias Brunner2012-10-241-1/+1
|
* Add getspnam_r() to leak detective whitelistMartin Willi2012-08-101-0/+1
|
* Increase leak detective backtrace depth by a frameMartin Willi2012-07-131-4/+4
|
* Don't access tail magic when reallocating invalid memory, as it would crashMartin Willi2012-07-131-5/+7
|
* Add an external method to disable leak detective temporarlyMartin Willi2012-07-131-0/+30
|
* Add safe_strerror() to leak detective whitelistMartin Willi2012-07-111-0/+1
| | | | | | While the thread specific strerror buffer gets cleaned up for worker threads during their termination, the main thread itself, and so its strerror buffer, is still alive during leak reports.
* Added ctime function to white listSansar Choinyambuu2011-11-281-0/+1
|
* whitelist glibc instead of TrouSerS functionsAndreas Steffen2011-09-101-3/+4
|
* added leaky TrouSerS functions to whitelistAndreas Steffen2011-09-081-0/+3
|