Re: [PATCH] kmemleak: Always register debugfs file

From: Catalin Marinas
Date: Fri Aug 24 2018 - 11:23:55 EST

On Fri, Aug 24, 2018 at 03:12:20PM +0200, Vincent Whitchurch wrote:
> If kmemleak built in to the kernel, but is disabled by default, the
> debugfs file is never registered. Because of this, it is not possible
> to find out if the kernel is built with kmemleak support by checking for
> the presence of this file. To allow this, always register the file.
> After this patch, if the file doesn't exist, kmemleak is not available
> in the kernel. If writing "scan" or any other value than "clear" to
> this file results in EBUSY, then kmemleak is available but is disabled
> by default and can be activated via the kernel command line.
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@xxxxxxxx>

I think that's also consistent with a late disabling of kmemleak when
the debugfs entry sticks around.

Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx>