Re: [PATCH 4/4] selftests: mm: test kmemleak's N-consecutive-scan leak confirmation

Catalin Marinas <[email protected]>
Newsgroups org.kernel.vger.workflows,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kvack.linux-mm
Message-ID <[email protected]>
On Mon, Jul 13, 2026 at 04:48:07AM -0700, Breno Leitao wrote:
> Add a functional test for the min_unref_scans kmemleak module parameter.
> Using samples/kmemleak's helper module it checks that min_unref_scans=1
> reports an orphan on the first scan, min_unref_scans=2 reports nothing on
> the first scan but does on the second, and that the parameter reads back
> what was written.
> 
> It counts only the helper module's own orphans (matched by their
> [kmemleak_test] backtrace, with the module kept loaded so the symbols
> resolve) so unrelated leaks already present on the system do not perturb
> the result. The test skips when run as non-root, without
> CONFIG_DEBUG_KMEMLEAK / CONFIG_SAMPLE_KMEMLEAK, on a kernel without the
> parameter, or when the helper yields no detectable orphan.
> 
> Signed-off-by: Breno Leitao <[email protected]>

Reviewed-by: Catalin Marinas <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.