From f7edeced4d8d3f650c5ee32f20ba7165da4e3067 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Fri, 8 Jul 2016 13:40:08 -0400 Subject: Add "random malloc failure" tooling Still needs to be documented, somehow/somewhere. The env var OPENSSL_MALLOC_FAILURES controls how often malloc/realloc should fail. It's a set of fields separated by semicolons. Each field is a count and optional percentage (separated by @) which defaults to 100. If count is zero then it lasts "forever." For example: 100;@25 means the first 100 allocations pass, then the rest have a 25% chance of failing until the program exits or crashes. If env var OPENSSL_MALLOC_FD parses as a positive integer, a record of all malloc "shouldfail" tests is written to that file descriptor. If a malloc will fail, and OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE is not set (platform specific), then a backtrace will be written to the descriptor when a malloc fails. This can be useful because a malloc may fail but not be checked, and problems will only occur later. Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/1252) --- crypto/include/internal/cryptlib_int.h | 1 + 1 file changed, 1 insertion(+) (limited to 'crypto/include') diff --git a/crypto/include/internal/cryptlib_int.h b/crypto/include/internal/cryptlib_int.h index 8e2a7199a1..60241d15dc 100644 --- a/crypto/include/internal/cryptlib_int.h +++ b/crypto/include/internal/cryptlib_int.h @@ -29,3 +29,4 @@ int ossl_init_thread_start(uint64_t opts); # define OPENSSL_INIT_THREAD_ASYNC 0x01 # define OPENSSL_INIT_THREAD_ERR_STATE 0x02 +void ossl_malloc_setup_failures(void); -- cgit v1.2.3