From b645f2b4bb773550337fd6ab6965c7fc96dc9c62 Mon Sep 17 00:00:00 2001
From: deraadt <>
Date: Fri, 14 Oct 2022 04:38:39 +0000
Subject: put the malloc_readonly struct into the "openbsd.mutable" section, so
 that the kernel and ld.so will know not to mark it immutable.  malloc handles
 the read/write transitions by itself.

---
 src/lib/libc/stdlib/malloc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index b12c89aca0..a0ee04f821 100644
--- a/src/lib/libc/stdlib/malloc.c
+++ b/src/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: malloc.c,v 1.274 2022/06/30 17:15:48 guenther Exp $	*/
+/*	$OpenBSD: malloc.c,v 1.275 2022/10/14 04:38:39 deraadt Exp $	*/
 /*
  * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
  * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -228,7 +228,8 @@ struct malloc_readonly {
 static union {
 	struct malloc_readonly mopts;
 	u_char _pad[MALLOC_PAGESIZE];
-} malloc_readonly __attribute__((aligned(MALLOC_PAGESIZE)));
+} malloc_readonly __attribute__((aligned(MALLOC_PAGESIZE)))
+		__attribute__((section(".openbsd.mutable")));
 #define mopts	malloc_readonly.mopts
 
 char		*malloc_options;	/* compile-time options */
-- 
cgit v1.2.3-55-g6feb