* [syzbot] [kernel?] memory leak in do_timer_create
@ 2025-11-13 4:26 syzbot
2025-11-14 1:20 ` Forwarded: syzbot
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: syzbot @ 2025-11-13 4:26 UTC (permalink / raw)
To: anna-maria, frederic, linux-kernel, syzkaller-bugs, tglx
Hello,
syzbot found the following issue on:
HEAD commit: 24172e0d7990 Merge tag 'arm64-fixes' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=165417cd980000
kernel config: https://syzkaller.appspot.com/x/.config?x=cb128cd5cb439809
dashboard link: https://syzkaller.appspot.com/bug?extid=9c47ad18f978d4394986
compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15004914580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ea6b42580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ded911fa4408/disk-24172e0d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a1f3e61cb784/vmlinux-24172e0d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b92fd0e25cb7/bzImage-24172e0d.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9c47ad18f978d4394986@syzkaller.appspotmail.com
2025/11/12 09:47:51 executed programs: 5
BUG: memory leak
unreferenced object 0xffff888108465800 (size 384):
comm "syz.0.17", pid 6100, jiffies 4294944668
hex dump (first 32 bytes):
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 1025e73e):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
kmem_cache_alloc_noprof+0x397/0x5a0 mm/slub.c:5295
alloc_posix_timer kernel/time/posix-timers.c:429 [inline]
do_timer_create+0xe0/0x800 kernel/time/posix-timers.c:478
__do_sys_timer_create kernel/time/posix-timers.c:584 [inline]
__se_sys_timer_create kernel/time/posix-timers.c:573 [inline]
__x64_sys_timer_create+0xdb/0xf0 kernel/time/posix-timers.c:573
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xa4/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
BUG: memory leak
unreferenced object 0xffff8881084a0000 (size 384):
comm "syz.0.18", pid 6104, jiffies 4294944670
hex dump (first 32 bytes):
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 63c47fd0):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
kmem_cache_alloc_noprof+0x397/0x5a0 mm/slub.c:5295
alloc_posix_timer kernel/time/posix-timers.c:429 [inline]
do_timer_create+0xe0/0x800 kernel/time/posix-timers.c:478
__do_sys_timer_create kernel/time/posix-timers.c:584 [inline]
__se_sys_timer_create kernel/time/posix-timers.c:573 [inline]
__x64_sys_timer_create+0xdb/0xf0 kernel/time/posix-timers.c:573
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xa4/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
BUG: memory leak
unreferenced object 0xffff8881084a0180 (size 384):
comm "syz.0.19", pid 6107, jiffies 4294944671
hex dump (first 32 bytes):
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 d769495f):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
kmem_cache_alloc_noprof+0x397/0x5a0 mm/slub.c:5295
alloc_posix_timer kernel/time/posix-timers.c:429 [inline]
do_timer_create+0xe0/0x800 kernel/time/posix-timers.c:478
__do_sys_timer_create kernel/time/posix-timers.c:584 [inline]
__se_sys_timer_create kernel/time/posix-timers.c:573 [inline]
__x64_sys_timer_create+0xdb/0xf0 kernel/time/posix-timers.c:573
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xa4/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
BUG: memory leak
unreferenced object 0xffff888108464600 (size 384):
comm "syz.0.20", pid 6127, jiffies 4294945201
hex dump (first 32 bytes):
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 a3c907e):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
kmem_cache_alloc_noprof+0x397/0x5a0 mm/slub.c:5295
alloc_posix_timer kernel/time/posix-timers.c:429 [inline]
do_timer_create+0xe0/0x800 kernel/time/posix-timers.c:478
__do_sys_timer_create kernel/time/posix-timers.c:584 [inline]
__se_sys_timer_create kernel/time/posix-timers.c:573 [inline]
__x64_sys_timer_create+0xdb/0xf0 kernel/time/posix-timers.c:573
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xa4/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
BUG: memory leak
unreferenced object 0xffff8881084a0300 (size 384):
comm "syz.0.21", pid 6128, jiffies 4294945201
hex dump (first 32 bytes):
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 bb0da4da):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
kmem_cache_alloc_noprof+0x397/0x5a0 mm/slub.c:5295
alloc_posix_timer kernel/time/posix-timers.c:429 [inline]
do_timer_create+0xe0/0x800 kernel/time/posix-timers.c:478
__do_sys_timer_create kernel/time/posix-timers.c:584 [inline]
__se_sys_timer_create kernel/time/posix-timers.c:573 [inline]
__x64_sys_timer_create+0xdb/0xf0 kernel/time/posix-timers.c:573
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xa4/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
connection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 5+ messages in thread* Forwarded:
2025-11-13 4:26 [syzbot] [kernel?] memory leak in do_timer_create syzbot
@ 2025-11-14 1:20 ` syzbot
2025-11-14 3:54 ` Forwarded: syzbot
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2025-11-14 1:20 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject:
Author: eslam.medhat1993@gmail.com
#syz test
^ permalink raw reply [flat|nested] 5+ messages in thread* Forwarded:
2025-11-13 4:26 [syzbot] [kernel?] memory leak in do_timer_create syzbot
2025-11-14 1:20 ` Forwarded: syzbot
@ 2025-11-14 3:54 ` syzbot
2025-11-14 4:17 ` Forwarded: syzbot
2025-11-14 13:29 ` [PATCH] posix-timers: Plug a potential memory leak Thomas Gleixner
3 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2025-11-14 3:54 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject:
Author: eslam.medhat1993@gmail.com
#syz test
^ permalink raw reply [flat|nested] 5+ messages in thread
* Forwarded:
2025-11-13 4:26 [syzbot] [kernel?] memory leak in do_timer_create syzbot
2025-11-14 1:20 ` Forwarded: syzbot
2025-11-14 3:54 ` Forwarded: syzbot
@ 2025-11-14 4:17 ` syzbot
2025-11-14 13:29 ` [PATCH] posix-timers: Plug a potential memory leak Thomas Gleixner
3 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2025-11-14 4:17 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject:
Author: eslam.medhat1993@gmail.com
#syz test
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] posix-timers: Plug a potential memory leak
2025-11-13 4:26 [syzbot] [kernel?] memory leak in do_timer_create syzbot
` (2 preceding siblings ...)
2025-11-14 4:17 ` Forwarded: syzbot
@ 2025-11-14 13:29 ` Thomas Gleixner
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2025-11-14 13:29 UTC (permalink / raw)
To: syzbot, anna-maria, frederic, linux-kernel, syzkaller-bugs
When posix timer creation is set to allocate a given timer ID and the
access to the user space value faults, the function terminates without
freeing the already allocated posix timer structure.
Move the allocation after the user space access to cure that.
Fixes: ec2d0c04624b ("posix-timers: Provide a mechanism to allocate a given timer ID")
Reported-by: syzbot+9c47ad18f978d4394986@syzkaller.appspotmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Closes: https://lore.kernel.org/all/69155df4.a70a0220.3124cb.0017.GAE@google.com
---
kernel/time/posix-timers.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -475,12 +475,6 @@ static int do_timer_create(clockid_t whi
if (!kc->timer_create)
return -EOPNOTSUPP;
- new_timer = alloc_posix_timer();
- if (unlikely(!new_timer))
- return -EAGAIN;
-
- spin_lock_init(&new_timer->it_lock);
-
/* Special case for CRIU to restore timers with a given timer ID. */
if (unlikely(current->signal->timer_create_restore_ids)) {
if (copy_from_user(&req_id, created_timer_id, sizeof(req_id)))
@@ -490,6 +484,12 @@ static int do_timer_create(clockid_t whi
return -EINVAL;
}
+ new_timer = alloc_posix_timer();
+ if (unlikely(!new_timer))
+ return -EAGAIN;
+
+ spin_lock_init(&new_timer->it_lock);
+
/*
* Add the timer to the hash table. The timer is not yet valid
* after insertion, but has a unique ID allocated.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-14 13:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 4:26 [syzbot] [kernel?] memory leak in do_timer_create syzbot
2025-11-14 1:20 ` Forwarded: syzbot
2025-11-14 3:54 ` Forwarded: syzbot
2025-11-14 4:17 ` Forwarded: syzbot
2025-11-14 13:29 ` [PATCH] posix-timers: Plug a potential memory leak Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox