From b4b1e10364c8737a632be61582e05a8d3acf5690 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 19 Apr 2018 22:19:29 -0400 Subject: reintroduce hardening against partially-replaced allocator commit 618b18c78e33acfe54a4434e91aa57b8e171df89 removed the previous detection and hardening since it was incorrect. commit 72141795d4edd17f88da192447395a48444afa10 already handled all that remained for hardening the static-linked case. in the dynamic-linked case, have the dynamic linker check whether malloc was replaced and make that information available. with these changes, the properties documented in commit c9f415d7ea2dace5bf77f6518b6afc36bb7a5732 are restored: if calloc is not provided, it will behave as malloc+memset, and any of the memalign-family functions not provided will fail with ENOMEM. --- src/internal/malloc_impl.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/internal/malloc_impl.h') diff --git a/src/internal/malloc_impl.h b/src/internal/malloc_impl.h index 4c4a4b46..5d025b06 100644 --- a/src/internal/malloc_impl.h +++ b/src/internal/malloc_impl.h @@ -39,4 +39,7 @@ struct bin { __attribute__((__visibility__("hidden"))) void __bin_chunk(struct chunk *); +__attribute__((__visibility__("hidden"))) +extern int __malloc_replaced; + #endif -- cgit v1.2.1