Query regarding Kmemleak

Viral Mehta viral.vkm at gmail.com
Wed Feb 1 12:19:00 EST 2012


Hi,

On Tue, Jan 31, 2012 at 8:47 PM, Smital Desai
<Smital.Desai at lntinfotech.com> wrote:
>>
>>          I am  just trying to understand Kmemleak support.
>>
>>          In a test program ,  allocating some memory using and vmalloc
> () and
>> freeing it in exit () routine.
>>          But when i run a kmemleak , It reports this as a leak.
>>
>>          But isn't it a generic reuirement to allocate something for
> the lifetime of
>> the module and free when we remove the module. ?   Can somebody
>> explain ?

Can you give a real time example ?
More specifically, why a driver needs to allocate virtual memory
when still there is no user for that driver.

If driver is just loaded at boot time and unloaded at shutdown,
you cant keep memory allocated w/o any use.

Howsoever, false positives are possible in kmemleak case,
See,
http://lwn.net/Articles/187979/

"There are various other special cases which must be handled. For
example, memory obtained from vmalloc() will be pointed to by the
memory allocation code itself, but might still be leaked. In other
cases, memory is allocated which cannot be found by the scanning
algorithm; a number of special annotations are added to the kernel to
suppress the resulting false positive reports. The detector can also
be fooled by pointers which are left behind in disused memory, or by
random data which happens to look like a pointer to an allocated
block; in these cases, false-negatives will result. "

-- 
Thanks,
Viral Mehta



More information about the Kernelnewbies mailing list