samples: kmemleak: print the raw pointers for debugging purposesThe kmemleak-test.c module is meant to leak some pointers for debuggingthe kmemleak detection, pointer information dumping. It's no
samples: kmemleak: print the raw pointers for debugging purposesThe kmemleak-test.c module is meant to leak some pointers for debuggingthe kmemleak detection, pointer information dumping. It's no use if itprints the hashed values of such pointers.Change the printk() format from %p to %px. While at it, also display theraw __percpu pointer rather than this_cpu_ptr() since kmemleak now trackssuch pointers independently of the standard allocations.Link: https://lkml.kernel.org/r/20250206114537.2597764-3-catalin.marinas@arm.comSigned-off-by: Catalin Marinas <catalin.marinas@arm.com>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
show more ...
kmemleak-test: add percpu leakAdd a per-CPU memory leak, which will be reported like:unreferenced object 0x3efa840195f8 (size 64): comm "modprobe", pid 4667, jiffies 4294688677 hex dump (firs
kmemleak-test: add percpu leakAdd a per-CPU memory leak, which will be reported like:unreferenced object 0x3efa840195f8 (size 64): comm "modprobe", pid 4667, jiffies 4294688677 hex dump (first 32 bytes on cpu 0): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc 0): [<ffffffffa7fa87af>] pcpu_alloc+0x3df/0x840 [<ffffffffc11642d9>] kmemleak_test_init+0x2c9/0x2f0 [kmemleak_test] [<ffffffffa7c02264>] do_one_initcall+0x44/0x300 [<ffffffffa7de9e10>] do_init_module+0x60/0x240 [<ffffffffa7deb946>] init_module_from_file+0x86/0xc0 [<ffffffffa7deba99>] idempotent_init_module+0x109/0x2a0 [<ffffffffa7debd2a>] __x64_sys_finit_module+0x5a/0xb0 [<ffffffffa88f4f3a>] do_syscall_64+0x7a/0x160 [<ffffffffa8a0012b>] entry_SYSCALL_64_after_hwframe+0x76/0x7eLink: https://lkml.kernel.org/r/20240725041223.872472-3-ptikhomirov@virtuozzo.comSigned-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>Acked-by: Catalin Marinas <catalin.marinas@arm.com>Cc: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>Cc: Chen Jun <chenjun102@huawei.com>Cc: Wei Yongjun <weiyongjun1@huawei.com>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kmemleak-test: add missing MODULE_DESCRIPTION() macromake allmodconfig && make W=1 C=1 reports:WARNING: modpost: missing MODULE_DESCRIPTION() in samples/kmemleak/kmemleak-test.oAdd the missing i
kmemleak-test: add missing MODULE_DESCRIPTION() macromake allmodconfig && make W=1 C=1 reports:WARNING: modpost: missing MODULE_DESCRIPTION() in samples/kmemleak/kmemleak-test.oAdd the missing invocation of the MODULE_DESCRIPTION() macro.Link: https://lkml.kernel.org/r/20240601-md-samples-kmemleak-v1-1-47186be7f0a8@quicinc.comSigned-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>Acked-by: Catalin Marinas <catalin.marinas@arm.com>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kmemleak-test: drop __init to get better backtraceDrop the __init on kmemleak_test_init(). With it, the storage isreclaimed, but then the symbol isn't available for "%pS" rendering,and the backt
kmemleak-test: drop __init to get better backtraceDrop the __init on kmemleak_test_init(). With it, the storage isreclaimed, but then the symbol isn't available for "%pS" rendering,and the backtrace gets a bare pointer where the actual leak happened.unreferenced object 0xffff88800a2b0800 (size 1024): comm "modprobe", pid 413, jiffies 4294953430 hex dump (first 32 bytes): 73 02 00 00 75 01 00 68 02 00 00 01 00 00 00 04 s...u..h........ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000fabad728>] kmalloc_trace+0x26/0x90 [<00000000ef738764>] 0xffffffffc02350a2 [<00000000004e5795>] do_one_initcall+0x43/0x210 [<00000000d768905e>] do_init_module+0x4a/0x210 [<0000000087135ab5>] __do_sys_finit_module+0x93/0xf0 [<000000004fcb1fa2>] do_syscall_64+0x34/0x80 [<00000000c73c8d9d>] entry_SYSCALL_64_after_hwframe+0x46/0xb0with __init gone, that trace entry renders like: [<00000000ef738764>] kmemleak_test_init+<offset>/<size>Link: https://lkml.kernel.org/r/20230525174356.69711-1-jim.cromie@gmail.comSigned-off-by: Jim Cromie <jim.cromie@gmail.com>Acked-by: Catalin Marinas <catalin.marinas@arm.com>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kmemleak-test: fix kmemleak_test.c build logickmemleak-test.c was moved to the samples directory in 1abbef4f51724("mm,kmemleak-test.c: move kmemleak-test.c to samples dir").If CONFIG_DEBUG_KMEML
kmemleak-test: fix kmemleak_test.c build logickmemleak-test.c was moved to the samples directory in 1abbef4f51724("mm,kmemleak-test.c: move kmemleak-test.c to samples dir").If CONFIG_DEBUG_KMEMLEAK_TEST=m and CONFIG_SAMPLES is unset,kmemleak-test.c will be unnecessarily compiled.So move the entry for CONFIG_DEBUG_KMEMLEAK_TEST from mm/Kconfig and add anew CONFIG_SAMPLE_KMEMLEAK in samples/ to control whether kmemleak-test.cis built or not.Link: https://lkml.kernel.org/r/20230330060904.292975-1-gehao@kylinos.cnFixes: 1abbef4f51724 ("mm,kmemleak-test.c: move kmemleak-test.c to samples dir")Signed-off-by: Hao Ge <gehao@kylinos.cn>Cc: Catalin Marinas <catalin.marinas@arm.com>Cc: Alex Gaynor <alex.gaynor@gmail.com>Cc: Alex Williamson <alex.williamson@redhat.com>Cc: Arnd Bergmann <arnd@arndb.de>Cc: Finn Behrens <me@kloenk.dev>Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>Cc: Jason Gunthorpe <jgg@ziepe.ca>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Miguel Ojeda <ojeda@kernel.org>Cc: Tony Krowiak <akrowiak@linux.ibm.com>Cc: Ye Xingchen <ye.xingchen@zte.com.cn>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm,kmemleak-test.c: move kmemleak-test.c to samples dirkmemleak-test.c is just a kmemleak test module, which also can not be usedas a built-in kernel module. Thus, i think it may should not be in
mm,kmemleak-test.c: move kmemleak-test.c to samples dirkmemleak-test.c is just a kmemleak test module, which also can not be usedas a built-in kernel module. Thus, i think it may should not be in mmdir, and move the kmemleak-test.c to samples/kmemleak/kmemleak-test.c.Fix the spelling of built-in by the way.Signed-off-by: Hui Su <sh_def@163.com>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>Cc: Catalin Marinas <catalin.marinas@arm.com>Cc: Jonathan Corbet <corbet@lwn.net>Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>Cc: David S. Miller <davem@davemloft.net>Cc: Rob Herring <robh@kernel.org>Cc: Masahiro Yamada <yamada.masahiro@socionext.com>Cc: Sam Ravnborg <sam@ravnborg.org>Cc: Josh Poimboeuf <jpoimboe@redhat.com>Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>Cc: Divya Indi <divya.indi@oracle.com>Cc: Tomas Winkler <tomas.winkler@intel.com>Cc: David Howells <dhowells@redhat.com>Link: https://lkml.kernel.org/r/20200925183729.GA172837@rlkSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>