summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/malloc.3
diff options
context:
space:
mode:
authorotto <>2023-04-16 19:46:17 +0000
committerotto <>2023-04-16 19:46:17 +0000
commit11a95a5b8faa561cf3182b895a1cd7fc19d2fa34 (patch)
treee11ef197e01c1f2b19b11f987cbdb6e428fc6ad0 /src/lib/libc/stdlib/malloc.3
parent32ccf96bd2ca5101f81e5f580e844876e75150d3 (diff)
downloadopenbsd-11a95a5b8faa561cf3182b895a1cd7fc19d2fa34.tar.gz
openbsd-11a95a5b8faa561cf3182b895a1cd7fc19d2fa34.tar.bz2
openbsd-11a95a5b8faa561cf3182b895a1cd7fc19d2fa34.zip
Dump (leak) info using utrace(2) and compile the code always in
except for bootblocks. This way we have built-in leak detecction always (if enable by malloc flags). See man pages for details.
Diffstat (limited to 'src/lib/libc/stdlib/malloc.3')
-rw-r--r--src/lib/libc/stdlib/malloc.324
1 files changed, 17 insertions, 7 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index b35b9220f6..e69e7c065f 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.130 2023/04/01 18:47:51 otto Exp $ 33.\" $OpenBSD: malloc.3,v 1.131 2023/04/16 19:46:17 otto Exp $
34.\" 34.\"
35.Dd $Mdocdate: April 1 2023 $ 35.Dd $Mdocdate: April 16 2023 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -284,12 +284,17 @@ If it has been corrupted, the process is aborted.
284.It Cm D 284.It Cm D
285.Dq Dump . 285.Dq Dump .
286.Fn malloc 286.Fn malloc
287will dump statistics to the file 287will dump a leak report using
288.Pa ./malloc.out , 288.Xr utrace 2
289if it already exists,
290at exit. 289at exit.
291This option requires the library to have been compiled with -DMALLOC_STATS in 290To record the dump:
292order to have any effect. 291.Pp
292.Dl $ MALLOC_OPTIONS=D ktrace -tu program ...
293.Pp
294To view the leak report:
295.Pp
296.Dl $ kdump -u malloc ...
297.Pp
293.It Cm F 298.It Cm F
294.Dq Freecheck . 299.Dq Freecheck .
295Enable more extensive double free and use after free detection. 300Enable more extensive double free and use after free detection.
@@ -340,6 +345,11 @@ Enable all options suitable for security auditing.
340Enable use after free protection for larger allocations. 345Enable use after free protection for larger allocations.
341Unused pages on the freelist are read and write protected to 346Unused pages on the freelist are read and write protected to
342cause a segmentation fault upon access. 347cause a segmentation fault upon access.
348.It Cm V
349.Dq Verbose .
350Use with
351.Cm D
352to get a verbose dump of malloc's internal state.
343.It Cm X 353.It Cm X
344.Dq xmalloc . 354.Dq xmalloc .
345Rather than return failure, 355Rather than return failure,