From 9f41a64eb230fd1c343999400564e3e14747c3e9 Mon Sep 17 00:00:00 2001 From: otto <> Date: Thu, 22 Jun 2023 11:04:16 +0000 Subject: Allow to ask for deeper callers for leak reports using malloc options. ok deraadt@ --- src/lib/libc/stdlib/malloc.3 | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 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 d893626051..855f217c27 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.133 2023/06/04 06:58:33 otto Exp $ +.\" $OpenBSD: malloc.3,v 1.134 2023/06/22 11:04:16 otto Exp $ .\" -.Dd $Mdocdate: June 4 2023 $ +.Dd $Mdocdate: June 22 2023 $ .Dt MALLOC 3 .Os .Sh NAME @@ -294,6 +294,17 @@ To record the dump: To view the leak report: .Pp .Dl $ kdump -u malloc ... +.Pp +By default, the immediate caller of a +.Nm +function will be recorded. +Use malloc options +.Cm 2 +or +.Cm 3 +to record the caller one or two stack frames deeper instead. +These malloc options imply +.Cm D . .It Cm F .Dq Freecheck . Enable more extensive double free and use after free detection. @@ -813,3 +824,14 @@ and .Fn realloc to avoid these problems on .Ox . +.Pp +The mechanism to record caller functions when using malloc options +.Cm 2 +or +.Cm 3 +is not guaranteed to work for all platforms, compilers or compilation +options, +and might even crash your program. +Use +.Em only +for debugging purposes. -- cgit v1.2.3-55-g6feb