[BUG][KMEMLEAK] modprobe: unreferenced object (size 16)

From: Mirsad Todorovac
Date: Sat Mar 23 2024 - 16:40:23 EST


Hi,

On the Ubuntu 22.04 LTS system, with recent iproute2-next toolsvand build 6.8-11743-ga4145ce1e7bc,
kmemleak system reported the following memory leaks:

unreferenced object 0xffff9da692e7e920 (size 16):
comm "modprobe", pid 2248188, jiffies 4358296226
hex dump (first 16 bytes):
68 6d 6d 5f 64 6d 69 72 72 6f 72 30 00 00 00 00 hmm_dmirror0....
backtrace (crc d64cce1d):
kmemleak_alloc (/home/marvin/linux/kernel/linux_torvalds/mm/kmemleak.c:1045)
__kmalloc_node_track_caller (/home/marvin/linux/kernel/linux_torvalds/./include/linux/kmemleak.h:42 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3802 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3845 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3965 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3986)
kvasprintf (/home/marvin/linux/kernel/linux_torvalds/lib/kasprintf.c:25)
kvasprintf_const (/home/marvin/linux/kernel/linux_torvalds/lib/kasprintf.c:50)
kobject_set_name_vargs (/home/marvin/linux/kernel/linux_torvalds/lib/kobject.c:274)
dev_set_name (/home/marvin/linux/kernel/linux_torvalds/drivers/base/core.c:3445)
drr_init (/home/marvin/linux/kernel/linux_torvalds/net/sched/sch_drr.c:233) sch_drr
do_one_initcall (/home/marvin/linux/kernel/linux_torvalds/init/main.c:1238)
do_init_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:2538)
load_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3001)
init_module_from_file (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3168)
idempotent_init_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3185)
__x64_sys_finit_module (/home/marvin/linux/kernel/linux_torvalds/./include/linux/file.h:47 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3207 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3189 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3189)
do_syscall_64 (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/common.c:52 /home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/common.c:83)
entry_SYSCALL_64_after_hwframe (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/entry_64.S:129)
unreferenced object 0xffff9d9b0080bf00 (size 256):
comm "modprobe", pid 2248188, jiffies 4358296226
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 08 bf 80 00 9b 9d ff ff ................
08 bf 80 00 9b 9d ff ff 00 d9 80 af ff ff ff ff ................
backtrace (crc 31d67378):
kmemleak_alloc (/home/marvin/linux/kernel/linux_torvalds/mm/kmemleak.c:1045)
kmalloc_trace (/home/marvin/linux/kernel/linux_torvalds/./include/linux/kmemleak.h:42 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3802 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3845 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3992)
device_add (/home/marvin/linux/kernel/linux_torvalds/drivers/base/core.c:3484 /home/marvin/linux/kernel/linux_torvalds/drivers/base/core.c:3535)
cdev_device_add (/home/marvin/linux/kernel/linux_torvalds/fs/char_dev.c:557)
drr_init (/home/marvin/linux/kernel/linux_torvalds/./include/linux/list.h:195 /home/marvin/linux/kernel/linux_torvalds/./include/linux/list.h:218 /home/marvin/linux/kernel/linux_torvalds/./include/linux/list.h:229 /home/marvin/linux/kernel/linux_torvalds/net/sched/sch_drr.c:434) sch_drr
do_one_initcall (/home/marvin/linux/kernel/linux_torvalds/init/main.c:1238)
do_init_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:2538)
load_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3001)
init_module_from_file (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3168)
idempotent_init_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3185)
__x64_sys_finit_module (/home/marvin/linux/kernel/linux_torvalds/./include/linux/file.h:47 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3207 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3189 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3189)
do_syscall_64 (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/common.c:52 /home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/common.c:83)
entry_SYSCALL_64_after_hwframe (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/entry_64.S:129)
unreferenced object 0xffff9da692e7ee90 (size 16):
comm "modprobe", pid 2248188, jiffies 4358296235
hex dump (first 16 bytes):
68 6d 6d 5f 64 6d 69 72 72 6f 72 31 00 00 00 00 hmm_dmirror1....
backtrace (crc eb2ce7ad):
kmemleak_alloc (/home/marvin/linux/kernel/linux_torvalds/mm/kmemleak.c:1045)
__kmalloc_node_track_caller (/home/marvin/linux/kernel/linux_torvalds/./include/linux/kmemleak.h:42 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3802 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3845 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3965 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3986)
kvasprintf (/home/marvin/linux/kernel/linux_torvalds/lib/kasprintf.c:25)
kvasprintf_const (/home/marvin/linux/kernel/linux_torvalds/lib/kasprintf.c:50)
kobject_set_name_vargs (/home/marvin/linux/kernel/linux_torvalds/lib/kobject.c:274)
dev_set_name (/home/marvin/linux/kernel/linux_torvalds/drivers/base/core.c:3445)
drr_init (/home/marvin/linux/kernel/linux_torvalds/net/sched/sch_drr.c:233) sch_drr
do_one_initcall (/home/marvin/linux/kernel/linux_torvalds/init/main.c:1238)
do_init_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:2538)
load_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3001)
init_module_from_file (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3168)
idempotent_init_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3185)
__x64_sys_finit_module (/home/marvin/linux/kernel/linux_torvalds/./include/linux/file.h:47 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3207 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3189 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3189)
do_syscall_64 (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/common.c:52 /home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/common.c:83)
entry_SYSCALL_64_after_hwframe (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/entry_64.S:129)
unreferenced object 0xffff9d9b0080be00 (size 256):
comm "modprobe", pid 2248188, jiffies 4358296235
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 08 be 80 00 9b 9d ff ff ................
08 be 80 00 9b 9d ff ff 00 d9 80 af ff ff ff ff ................
backtrace (crc e1a8857):
kmemleak_alloc (/home/marvin/linux/kernel/linux_torvalds/mm/kmemleak.c:1045)
kmalloc_trace (/home/marvin/linux/kernel/linux_torvalds/./include/linux/kmemleak.h:42 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3802 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3845 /home/marvin/linux/kernel/linux_torvalds/mm/slub.c:3992)
device_add (/home/marvin/linux/kernel/linux_torvalds/drivers/base/core.c:3484 /home/marvin/linux/kernel/linux_torvalds/drivers/base/core.c:3535)
cdev_device_add (/home/marvin/linux/kernel/linux_torvalds/fs/char_dev.c:557)
drr_init (/home/marvin/linux/kernel/linux_torvalds/./include/linux/list.h:195 /home/marvin/linux/kernel/linux_torvalds/./include/linux/list.h:218 /home/marvin/linux/kernel/linux_torvalds/./include/linux/list.h:229 /home/marvin/linux/kernel/linux_torvalds/net/sched/sch_drr.c:434) sch_drr
do_one_initcall (/home/marvin/linux/kernel/linux_torvalds/init/main.c:1238)
do_init_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:2538)
load_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3001)
init_module_from_file (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3168)
idempotent_init_module (/home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3185)
__x64_sys_finit_module (/home/marvin/linux/kernel/linux_torvalds/./include/linux/file.h:47 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3207 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3189 /home/marvin/linux/kernel/linux_torvalds/kernel/module/main.c:3189)
do_syscall_64 (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/common.c:52 /home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/common.c:83)
entry_SYSCALL_64_after_hwframe (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/entry_64.S:129)

Unless this is a false positive (which I am unable to judge), I hope this will help catch the leak.

Best regards,
Mirsad Todorovac