Bug 161755 - Kernel fails to report negative malloc type statistics
Summary: Kernel fails to report negative malloc type statistics
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-17 21:00 UTC by Arnaud
Modified: 2017-12-31 22:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arnaud 2011-10-17 21:00:26 UTC
When malloc-type are uninit, a verification is made to ensure that no memory has been leaked, however, it fails to report if memory allocation have been badly accounted (ie `malloc(X, M_FOO)' followed by `free(Y, M_BAR)').


from `sys/kern/kern_malloc.c':
 
if (temp_allocs > 0 || temp_bytes > 0) {
    printf("Warning: memory type %s leaked memory on destroy "
        "(%ld allocations, %ld bytes leaked).\n", mtp->ks_shortdesc,

this do not report whenever `temp_allocs' or `temp_bytes' are negative, which should be reported, else, whatever is printed can not be trusted.

Fix: 

Patch available at:

https://github.com/lacombar/freebsd/commit/8b498200a0389ec48021959e32eaf198c075b6ca
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:27 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped