kern/161755: Kernel fails to report negative malloc type statistics

Arnaud Lacombe lacombar at gmail.com
Mon Oct 17 20:00:30 UTC 2011


>Number:         161755
>Category:       kern
>Synopsis:       Kernel fails to report negative malloc type statistics
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 17 20:00:26 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Arnaud Lacombe
>Release:        10-current
>Organization:
n/a
>Environment:
>Description:
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.
>How-To-Repeat:

>Fix:
Patch available at:

https://github.com/lacombar/freebsd/commit/8b498200a0389ec48021959e32eaf198c075b6ca

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list