diff options
author | otto <> | 2023-04-16 19:46:17 +0000 |
---|---|---|
committer | otto <> | 2023-04-16 19:46:17 +0000 |
commit | 11a95a5b8faa561cf3182b895a1cd7fc19d2fa34 (patch) | |
tree | e11ef197e01c1f2b19b11f987cbdb6e428fc6ad0 /src/lib/libc/stdlib/malloc.3 | |
parent | 32ccf96bd2ca5101f81e5f580e844876e75150d3 (diff) | |
download | openbsd-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.3 | 24 |
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 |
287 | will dump statistics to the file | 287 | will dump a leak report using |
288 | .Pa ./malloc.out , | 288 | .Xr utrace 2 |
289 | if it already exists, | ||
290 | at exit. | 289 | at exit. |
291 | This option requires the library to have been compiled with -DMALLOC_STATS in | 290 | To record the dump: |
292 | order to have any effect. | 291 | .Pp |
292 | .Dl $ MALLOC_OPTIONS=D ktrace -tu program ... | ||
293 | .Pp | ||
294 | To 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 . |
295 | Enable more extensive double free and use after free detection. | 300 | Enable more extensive double free and use after free detection. |
@@ -340,6 +345,11 @@ Enable all options suitable for security auditing. | |||
340 | Enable use after free protection for larger allocations. | 345 | Enable use after free protection for larger allocations. |
341 | Unused pages on the freelist are read and write protected to | 346 | Unused pages on the freelist are read and write protected to |
342 | cause a segmentation fault upon access. | 347 | cause a segmentation fault upon access. |
348 | .It Cm V | ||
349 | .Dq Verbose . | ||
350 | Use with | ||
351 | .Cm D | ||
352 | to get a verbose dump of malloc's internal state. | ||
343 | .It Cm X | 353 | .It Cm X |
344 | .Dq xmalloc . | 354 | .Dq xmalloc . |
345 | Rather than return failure, | 355 | Rather than return failure, |