From db3d36558deff54e8a47e96933acd4543d7eb05f Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Fri, 23 May 2025 00:40:05 +0000 Subject: When commons were deprecated, noone noticed that malloc_options in static binaries had become unlinkable. Change the libc definition to weak to solve that, and to "const char * const" so that noone will try to set it late. It must be stable before the first malloc() call, which could be before main()... discussion with otto, kettenis, tedu --- src/lib/libc/stdlib/malloc.3 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/lib/libc/stdlib/malloc.3') diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index bea5575bf8..b0c6fb782b 100644 --- a/src/lib/libc/stdlib/malloc.3 +++ b/src/lib/libc/stdlib/malloc.3 @@ -30,9 +30,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: malloc.3,v 1.142 2024/08/03 20:09:24 guenther Exp $ +.\" $OpenBSD: malloc.3,v 1.143 2025/05/23 00:40:05 deraadt Exp $ .\" -.Dd $Mdocdate: August 3 2024 $ +.Dd $Mdocdate: May 23 2025 $ .Dt MALLOC 3 .Os .Sh NAME @@ -69,7 +69,8 @@ .Fn malloc_conceal "size_t size" .Ft void * .Fn calloc_conceal "size_t nmemb" "size_t size" -.Vt char *malloc_options ; +.Vt const char * const +.Va malloc_options ; .Sh DESCRIPTION The standard functions .Fn malloc , @@ -265,7 +266,7 @@ value of the .Xr sysctl 2 , next checks the environment for a variable called .Ev MALLOC_OPTIONS , -and finally looks at the global variable +and finally looks at the pre-initialized global variable .Va malloc_options in the program. Each is scanned for the flags documented below. -- cgit v1.2.3-55-g6feb