From 1bd5483e104c8bde6e61dc5e3f8a848bc861872d Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 29 Dec 2015 20:32:35 +0100 Subject: malloc: Test various special cases related to allocation failures This test case exercises unusual code paths in allocation functions, related to allocation failures. Specifically, the test can reveal the following bugs: (a) calloc returns non-zero memory on fallback to sysmalloc. (b) calloc can self-deadlock because it fails to release the arena lock on certain allocation failures. (c) pvalloc can dereference a NULL arena pointer. (a) and (b) appear specific to a faulty downstream backport. (c) was fixed as part of commit 10ad46bc6526edc5c7afcc57112da96917ff3629. The test for (a) was inspired by a reproducer supplied by Jeff Layton. --- malloc/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'malloc/Makefile') diff --git a/malloc/Makefile b/malloc/Makefile index aa0579cb98..3b2b4bebc9 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -28,7 +28,8 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \ tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 \ tst-malloc-usable tst-realloc tst-posix_memalign \ tst-pvalloc tst-memalign tst-mallopt tst-scratch_buffer \ - tst-malloc-backtrace tst-malloc-thread-exit + tst-malloc-backtrace tst-malloc-thread-exit \ + tst-malloc-thread-fail test-srcs = tst-mtrace routines = malloc morecore mcheck mtrace obstack \ @@ -49,6 +50,8 @@ $(objpfx)tst-malloc-backtrace: $(common-objpfx)nptl/libpthread.so \ $(common-objpfx)nptl/libpthread_nonshared.a $(objpfx)tst-malloc-thread-exit: $(common-objpfx)nptl/libpthread.so \ $(common-objpfx)nptl/libpthread_nonshared.a +$(objpfx)tst-malloc-thread-fail: $(common-objpfx)nptl/libpthread.so \ + $(common-objpfx)nptl/libpthread_nonshared.a # These should be removed by `make clean'. extra-objs = mcheck-init.o libmcheck.a -- cgit v1.2.3-70-g09d2