summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/malloc.3
diff options
context:
space:
mode:
authorotto <>2023-10-22 12:19:26 +0000
committerotto <>2023-10-22 12:19:26 +0000
commitb5cf5d1cfd03d5dce101bec12c9cfb6512def233 (patch)
tree5ec26e0f9f313f1e2f4272f4fe5c220a9c209e05 /src/lib/libc/stdlib/malloc.3
parent3072adb622304d01d35bb335029a00ea2a98b8ee (diff)
downloadopenbsd-b5cf5d1cfd03d5dce101bec12c9cfb6512def233.tar.gz
openbsd-b5cf5d1cfd03d5dce101bec12c9cfb6512def233.tar.bz2
openbsd-b5cf5d1cfd03d5dce101bec12c9cfb6512def233.zip
When option D is active, store callers for all chunks; this avoids
the 0x0 call sites for leak reports. Also display more info on detected write of free chunks: print the info about where the chunk was allocated, and for the preceding chunk as well. ok asou@
Diffstat (limited to 'src/lib/libc/stdlib/malloc.3')
-rw-r--r--src/lib/libc/stdlib/malloc.338
1 files changed, 27 insertions, 11 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index b700add823..667baa9b7c 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.137 2023/07/01 18:35:14 otto Exp $ 33.\" $OpenBSD: malloc.3,v 1.138 2023/10/22 12:19:26 otto Exp $
34.\" 34.\"
35.Dd $Mdocdate: July 1 2023 $ 35.Dd $Mdocdate: October 22 2023 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -307,7 +307,7 @@ These malloc options imply
307.Cm D . 307.Cm D .
308.It Cm F 308.It Cm F
309.Dq Freecheck . 309.Dq Freecheck .
310Enable more extensive double free and use after free detection. 310Enable more extensive double free and write after free detection.
311All chunks in the delayed free list will be checked for double frees and 311All chunks in the delayed free list will be checked for double frees and
312write after frees. 312write after frees.
313Unused pages on the freelist are read and write protected to 313Unused pages on the freelist are read and write protected to
@@ -641,18 +641,34 @@ or
641reallocate an unallocated pointer was made. 641reallocate an unallocated pointer was made.
642.It Dq double free 642.It Dq double free
643There was an attempt to free an allocation that had already been freed. 643There was an attempt to free an allocation that had already been freed.
644.It Dq write after free 644.It Dq write to free mem Va address Ns [ Va start Ns .. Ns Va end Ns ]@ Ns Va size
645An allocation has been modified after it was freed. 645An allocation has been modified after it was freed,
646or a chunk that was never allocated was written to.
647The
648.Va range
649at which corruption was detected is printed between [ and ].
650.Pp
651Enabling option
652.Cm D
653allows malloc to print information about where the allocation
654was done.
646.It Dq modified chunk-pointer 655.It Dq modified chunk-pointer
647The pointer passed to 656The pointer passed to
648.Fn free 657.Fn free
649or a reallocation function has been modified. 658or a reallocation function has been modified.
650.It Dq canary corrupted address offset@length 659.It Dq canary corrupted Va address Ns [ Va offset Ns ]@ Ns Va length Ns / Ns Va size
651A byte after the requested size has been overwritten, 660A byte after the requested
661.Va length has been overwritten,
652indicating a heap overflow. 662indicating a heap overflow.
653The offset at which corruption was detected is printed before the @, 663The
654and the requested length of the allocation after the @. 664.Va offset
655.It Dq recorded size oldsize inconsistent with size 665at which corruption was detected is printed between [ and ],
666the requested
667.Va length
668of the allocation is printed before the / and the
669.Va size
670of the allocation after the /.
671.It Dq recorded size Va oldsize No inconsistent with Va size
656.Fn recallocarray 672.Fn recallocarray
657or 673or
658.Fn freezero 674.Fn freezero
@@ -676,7 +692,7 @@ functions nor utilize any other functions which may call
676(e.g., 692(e.g.,
677.Xr stdio 3 693.Xr stdio 3
678routines). 694routines).
679.It Dq unknown char in MALLOC_OPTIONS 695.It Dq unknown char in Ev MALLOC_OPTIONS
680We found something we didn't understand. 696We found something we didn't understand.
681.It any other error 697.It any other error
682.Fn malloc 698.Fn malloc