[syzbot] memory leak in create_io_worker

18 views
Skip to first unread message

syzbot

unread,
Sep 8, 2021, 8:09:19ā€ÆPM9/8/21
to asml.s...@gmail.com, ax...@kernel.dk, io-u...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 0bcfe68b8767 Revert "memcg: enable accounting for pollfd a..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=152ccba3300000
kernel config: https://syzkaller.appspot.com/x/.config?x=c2f4c21cbd29de3d
dashboard link: https://syzkaller.appspot.com/bug?extid=65454c239241d3d647da
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=123d31b3300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+65454c...@syzkaller.appspotmail.com

2021/09/08 01:29:02 executed programs: 33
2021/09/08 01:29:08 executed programs: 42
2021/09/08 01:29:15 executed programs: 62
2021/09/08 01:29:21 executed programs: 82
BUG: memory leak
unreferenced object 0xffff888126fcd6c0 (size 192):
comm "syz-executor.1", pid 11934, jiffies 4294983026 (age 15.690s)
hex dump (first 32 bytes):
01 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:
[<ffffffff81632c91>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff81632c91>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff81632c91>] create_io_worker+0x41/0x1e0 fs/io-wq.c:739
[<ffffffff8163311e>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff8163311e>] io_wqe_enqueue+0x1fe/0x330 fs/io-wq.c:866
[<ffffffff81620b64>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162c59c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6933
[<ffffffff8162c7ab>] io_req_task_submit+0x4b/0xa0 fs/io_uring.c:2233
[<ffffffff8162cb48>] io_async_task_func+0x108/0x1c0 fs/io_uring.c:5462
[<ffffffff816259e3>] tctx_task_work+0x1b3/0x3a0 fs/io_uring.c:2158
[<ffffffff81269b43>] task_work_run+0x73/0xb0 kernel/task_work.c:164
[<ffffffff812dcdd1>] tracehook_notify_signal include/linux/tracehook.h:212 [inline]
[<ffffffff812dcdd1>] handle_signal_work kernel/entry/common.c:146 [inline]
[<ffffffff812dcdd1>] exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
[<ffffffff812dcdd1>] exit_to_user_mode_prepare+0x151/0x180 kernel/entry/common.c:209
[<ffffffff843ff25d>] __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
[<ffffffff843ff25d>] syscall_exit_to_user_mode+0x1d/0x40 kernel/entry/common.c:302
[<ffffffff843fa4a2>] do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae



---
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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Zhang, Qiang

unread,
Sep 9, 2021, 7:12:34ā€ÆAM9/9/21
to syzbot, asml.s...@gmail.com, ax...@kernel.dk, io-u...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com

________________________________________
From: syzbot <syzbot+65454c...@syzkaller.appspotmail.com>
Sent: Thursday, 9 September 2021 08:09
To: asml.s...@gmail.com; ax...@kernel.dk; io-u...@vger.kernel.org; linux-...@vger.kernel.org; syzkall...@googlegroups.com
Subject: [syzbot] memory leak in create_io_worker

[Please note: This e-mail is from an EXTERNAL e-mail address]

Hello,

Hello Pavel

This looks like io-worker create fail trigger memleak.

diff --git a/fs/io-wq.c b/fs/io-wq.c
index 35e7ee26f7ea..27fa0506c1a6 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -709,6 +709,7 @@ static void create_worker_cont(struct callback_head *cb)
}
raw_spin_unlock(&wqe->lock);
io_worker_ref_put(wqe->wq);
+ kfree(worker);
return;
}

@@ -725,6 +726,7 @@ static void io_workqueue_create(struct work_struct *work)
if (!io_queue_worker_create(worker, acct, create_worker_cont)) {
clear_bit_unlock(0, &worker->create_state);
io_worker_release(worker);
+ kfree(worker);
}
}

@@ -759,6 +761,7 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index)
if (!IS_ERR(tsk)) {
io_init_new_worker(wqe, worker, tsk);
} else if (!io_should_retry_thread(PTR_ERR(tsk))) {
+ kfree(worker);

syzbot

unread,
Sep 13, 2021, 4:04:33ā€ÆAM9/13/21
to Qiang...@windriver.com, asml.s...@gmail.com, ax...@kernel.dk, io-u...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: f306b90c69ce Merge tag 'smp-urgent-2021-09-12' of git://gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14bc2715300000
kernel config: https://syzkaller.appspot.com/x/.config?x=bb1c2ff5ae428ca6
dashboard link: https://syzkaller.appspot.com/bug?extid=65454c239241d3d647da
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=171d8963300000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15b9ccdd300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+65454c...@syzkaller.appspotmail.com

BUG: memory leak
unreferenced object 0xffff88811953fa80 (size 192):
comm "syz-executor248", pid 6847, jiffies 4294979550 (age 31.120s)
hex dump (first 32 bytes):
01 00 00 00 08 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:
[<ffffffff8162fbb1>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff8162fbb1>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff8162fbb1>] create_io_worker+0x41/0x1f0 fs/io-wq.c:741
[<ffffffff81630067>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff81630067>] io_wqe_enqueue+0x217/0x3a0 fs/io-wq.c:873
[<ffffffff8161e3a4>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162944c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6940
[<ffffffff8162a6e6>] io_queue_sqe fs/io_uring.c:6958 [inline]
[<ffffffff8162a6e6>] io_submit_sqe fs/io_uring.c:7134 [inline]
[<ffffffff8162a6e6>] io_submit_sqes+0xc36/0x2ec0 fs/io_uring.c:7240
[<ffffffff8162cf6f>] __do_sys_io_uring_enter+0x5ff/0xf80 fs/io_uring.c:9882
[<ffffffff843faa25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff843faa25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88811953fa80 (size 192):
comm "syz-executor248", pid 6847, jiffies 4294979550 (age 31.180s)
hex dump (first 32 bytes):
01 00 00 00 08 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:
[<ffffffff8162fbb1>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff8162fbb1>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff8162fbb1>] create_io_worker+0x41/0x1f0 fs/io-wq.c:741
[<ffffffff81630067>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff81630067>] io_wqe_enqueue+0x217/0x3a0 fs/io-wq.c:873
[<ffffffff8161e3a4>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162944c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6940
[<ffffffff8162a6e6>] io_queue_sqe fs/io_uring.c:6958 [inline]
[<ffffffff8162a6e6>] io_submit_sqe fs/io_uring.c:7134 [inline]
[<ffffffff8162a6e6>] io_submit_sqes+0xc36/0x2ec0 fs/io_uring.c:7240
[<ffffffff8162cf6f>] __do_sys_io_uring_enter+0x5ff/0xf80 fs/io_uring.c:9882
[<ffffffff843faa25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff843faa25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88811953fa80 (size 192):
comm "syz-executor248", pid 6847, jiffies 4294979550 (age 31.230s)
hex dump (first 32 bytes):
01 00 00 00 08 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:
[<ffffffff8162fbb1>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff8162fbb1>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff8162fbb1>] create_io_worker+0x41/0x1f0 fs/io-wq.c:741
[<ffffffff81630067>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff81630067>] io_wqe_enqueue+0x217/0x3a0 fs/io-wq.c:873
[<ffffffff8161e3a4>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162944c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6940
[<ffffffff8162a6e6>] io_queue_sqe fs/io_uring.c:6958 [inline]
[<ffffffff8162a6e6>] io_submit_sqe fs/io_uring.c:7134 [inline]
[<ffffffff8162a6e6>] io_submit_sqes+0xc36/0x2ec0 fs/io_uring.c:7240
[<ffffffff8162cf6f>] __do_sys_io_uring_enter+0x5ff/0xf80 fs/io_uring.c:9882
[<ffffffff843faa25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff843faa25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88811953fa80 (size 192):
comm "syz-executor248", pid 6847, jiffies 4294979550 (age 31.290s)
hex dump (first 32 bytes):
01 00 00 00 08 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:
[<ffffffff8162fbb1>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff8162fbb1>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff8162fbb1>] create_io_worker+0x41/0x1f0 fs/io-wq.c:741
[<ffffffff81630067>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff81630067>] io_wqe_enqueue+0x217/0x3a0 fs/io-wq.c:873
[<ffffffff8161e3a4>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162944c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6940
[<ffffffff8162a6e6>] io_queue_sqe fs/io_uring.c:6958 [inline]
[<ffffffff8162a6e6>] io_submit_sqe fs/io_uring.c:7134 [inline]
[<ffffffff8162a6e6>] io_submit_sqes+0xc36/0x2ec0 fs/io_uring.c:7240
[<ffffffff8162cf6f>] __do_sys_io_uring_enter+0x5ff/0xf80 fs/io_uring.c:9882
[<ffffffff843faa25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff843faa25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88811953fa80 (size 192):
comm "syz-executor248", pid 6847, jiffies 4294979550 (age 31.340s)
hex dump (first 32 bytes):
01 00 00 00 08 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:
[<ffffffff8162fbb1>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff8162fbb1>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff8162fbb1>] create_io_worker+0x41/0x1f0 fs/io-wq.c:741
[<ffffffff81630067>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff81630067>] io_wqe_enqueue+0x217/0x3a0 fs/io-wq.c:873
[<ffffffff8161e3a4>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162944c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6940
[<ffffffff8162a6e6>] io_queue_sqe fs/io_uring.c:6958 [inline]
[<ffffffff8162a6e6>] io_submit_sqe fs/io_uring.c:7134 [inline]
[<ffffffff8162a6e6>] io_submit_sqes+0xc36/0x2ec0 fs/io_uring.c:7240
[<ffffffff8162cf6f>] __do_sys_io_uring_enter+0x5ff/0xf80 fs/io_uring.c:9882
[<ffffffff843faa25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff843faa25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88811953fa80 (size 192):
comm "syz-executor248", pid 6847, jiffies 4294979550 (age 31.400s)
hex dump (first 32 bytes):
01 00 00 00 08 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:
[<ffffffff8162fbb1>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff8162fbb1>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff8162fbb1>] create_io_worker+0x41/0x1f0 fs/io-wq.c:741
[<ffffffff81630067>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff81630067>] io_wqe_enqueue+0x217/0x3a0 fs/io-wq.c:873
[<ffffffff8161e3a4>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162944c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6940
[<ffffffff8162a6e6>] io_queue_sqe fs/io_uring.c:6958 [inline]
[<ffffffff8162a6e6>] io_submit_sqe fs/io_uring.c:7134 [inline]
[<ffffffff8162a6e6>] io_submit_sqes+0xc36/0x2ec0 fs/io_uring.c:7240
[<ffffffff8162cf6f>] __do_sys_io_uring_enter+0x5ff/0xf80 fs/io_uring.c:9882
[<ffffffff843faa25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff843faa25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88811953fa80 (size 192):
comm "syz-executor248", pid 6847, jiffies 4294979550 (age 31.450s)
hex dump (first 32 bytes):
01 00 00 00 08 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:
[<ffffffff8162fbb1>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff8162fbb1>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff8162fbb1>] create_io_worker+0x41/0x1f0 fs/io-wq.c:741
[<ffffffff81630067>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff81630067>] io_wqe_enqueue+0x217/0x3a0 fs/io-wq.c:873
[<ffffffff8161e3a4>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162944c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6940
[<ffffffff8162a6e6>] io_queue_sqe fs/io_uring.c:6958 [inline]
[<ffffffff8162a6e6>] io_submit_sqe fs/io_uring.c:7134 [inline]
[<ffffffff8162a6e6>] io_submit_sqes+0xc36/0x2ec0 fs/io_uring.c:7240
[<ffffffff8162cf6f>] __do_sys_io_uring_enter+0x5ff/0xf80 fs/io_uring.c:9882
[<ffffffff843faa25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff843faa25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88811953fa80 (size 192):
comm "syz-executor248", pid 6847, jiffies 4294979550 (age 31.500s)
hex dump (first 32 bytes):
01 00 00 00 08 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:
[<ffffffff8162fbb1>] kmalloc_node include/linux/slab.h:609 [inline]
[<ffffffff8162fbb1>] kzalloc_node include/linux/slab.h:732 [inline]
[<ffffffff8162fbb1>] create_io_worker+0x41/0x1f0 fs/io-wq.c:741
[<ffffffff81630067>] io_wqe_create_worker fs/io-wq.c:267 [inline]
[<ffffffff81630067>] io_wqe_enqueue+0x217/0x3a0 fs/io-wq.c:873
[<ffffffff8161e3a4>] io_queue_async_work+0xc4/0x200 fs/io_uring.c:1473
[<ffffffff8162944c>] __io_queue_sqe+0x34c/0x510 fs/io_uring.c:6940
[<ffffffff8162a6e6>] io_queue_sqe fs/io_uring.c:6958 [inline]
[<ffffffff8162a6e6>] io_submit_sqe fs/io_uring.c:7134 [inline]
[<ffffffff8162a6e6>] io_submit_sqes+0xc36/0x2ec0 fs/io_uring.c:7240
[<ffffffff8162cf6f>] __do_sys_io_uring_enter+0x5ff/0xf80 fs/io_uring.c:9882
[<ffffffff843faa25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff843faa25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory

Reply all
Reply to author
Forward
0 new messages