Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you need to check if a kernel module has leaked memory and your machine has x86 architecture, you can use <a href="https://github.com/euspectre/kedr" rel="noreferrer">KEDR system</a>, it includes a memory leak detector. </p> <p>KEDR does not require you to rebuild the kernel. The online docs (see "Getting Started", for example) describe how to install and use KEDR. In short, the procedure is as follows.</p> <p>Installation (from source): untar source archive - cmake &lt;...> - make - make install</p> <p>Start KEDR before you load your module:</p> <pre><code>$ kedr start &lt;name_of_the_module_to_analyze&gt; -f leak_check.conf </code></pre> <p>Then you can load your module and work with it as usual. After you unload it, KEDR will give you a report in debugfs (usually debugfs is mounted to <code>/sys/kernel/debug</code>), for example:</p> <pre><code>$ cat /sys/kernel/debug/kedr_leak_check/info Target module: "...", Memory allocations: 3 Possible leaks: 2 Unallocated frees: 0 </code></pre> <p>The file <code>possible_leaks</code> from <code>/sys/kernel/debug/kedr_leak_check/</code> provides information (address, size, call stack) about each leaked memory block.</p> <p>Finally, you can stop KEDR (note that <code>/sys/kernel/debug/kedr_leak_check/</code> will disappear):</p> <pre><code>kedr stop </code></pre> <p>If you are using a system with architecture other than x86, Kmemleak may also be helpful although it is a bit more difficult to use. You will probably need to rebuild the kernel with CONFIG_DEBUG_KMEMLEAK parameter set to 'y'. Still, Kmemleak is a very useful tool too. See <a href="http://www.mjmwired.net/kernel/Documentation/kmemleak.txt" rel="noreferrer">Documentation/kmemleak.txt</a> in the kernel sources for details.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload