linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] memory leak in blk_iolatency_init
@ 2021-09-13 23:28 syzbot
  2021-09-14  3:13 ` Xu, Yanfei
  2021-10-23 18:58 ` syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2021-09-13 23:28 UTC (permalink / raw)
  To: axboe, cgroups, linux-block, linux-kernel, syzkaller-bugs, tj

Hello,

syzbot found the following issue on:

HEAD commit:    a3fa7a101dcf Merge branches 'akpm' and 'akpm-hotfixes' (pa..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12b4a5b3300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9ee3a4c022ccbbca
dashboard link: https://syzkaller.appspot.com/bug?extid=01321b15cc98e6bf96d6
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=148c170b300000

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

2021/09/09 22:14:31 executed programs: 444
BUG: memory leak
unreferenced object 0xffff888129acdb80 (size 96):
  comm "syz-executor.1", pid 12661, jiffies 4294962682 (age 15.220s)
  hex dump (first 32 bytes):
    20 47 c9 85 ff ff ff ff 20 d4 8e 29 81 88 ff ff   G...... ..)....
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff82264ec8>] kmalloc include/linux/slab.h:591 [inline]
    [<ffffffff82264ec8>] kzalloc include/linux/slab.h:721 [inline]
    [<ffffffff82264ec8>] blk_iolatency_init+0x28/0x190 block/blk-iolatency.c:724
    [<ffffffff8225b8c4>] blkcg_init_queue+0xb4/0x1c0 block/blk-cgroup.c:1185
    [<ffffffff822253da>] blk_alloc_queue+0x22a/0x2e0 block/blk-core.c:566
    [<ffffffff8223b175>] blk_mq_init_queue_data block/blk-mq.c:3100 [inline]
    [<ffffffff8223b175>] __blk_mq_alloc_disk+0x25/0xd0 block/blk-mq.c:3124
    [<ffffffff826a9303>] loop_add+0x1c3/0x360 drivers/block/loop.c:2344
    [<ffffffff826a966e>] loop_control_get_free drivers/block/loop.c:2501 [inline]
    [<ffffffff826a966e>] loop_control_ioctl+0x17e/0x2e0 drivers/block/loop.c:2516
    [<ffffffff81597eec>] vfs_ioctl fs/ioctl.c:51 [inline]
    [<ffffffff81597eec>] __do_sys_ioctl fs/ioctl.c:874 [inline]
    [<ffffffff81597eec>] __se_sys_ioctl fs/ioctl.c:860 [inline]
    [<ffffffff81597eec>] __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:860
    [<ffffffff843fa745>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff843fa745>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
    [<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 syzkaller@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] memory leak in blk_iolatency_init
  2021-09-13 23:28 [syzbot] memory leak in blk_iolatency_init syzbot
@ 2021-09-14  3:13 ` Xu, Yanfei
  2021-10-23 18:58 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: Xu, Yanfei @ 2021-09-14  3:13 UTC (permalink / raw)
  To: syzbot, axboe, cgroups, linux-block, linux-kernel, syzkaller-bugs, tj



On 9/14/21 7:28 AM, syzbot wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> 
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    a3fa7a101dcf Merge branches 'akpm' and 'akpm-hotfixes' (pa..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=12b4a5b3300000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=9ee3a4c022ccbbca
> dashboard link: https://syzkaller.appspot.com/bug?extid=01321b15cc98e6bf96d6
> 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=148c170b300000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+01321b15cc98e6bf96d6@syzkaller.appspotmail.com
> 
> 2021/09/09 22:14:31 executed programs: 444
> BUG: memory leak
> unreferenced object 0xffff888129acdb80 (size 96):
>    comm "syz-executor.1", pid 12661, jiffies 4294962682 (age 15.220s)
>    hex dump (first 32 bytes):
>      20 47 c9 85 ff ff ff ff 20 d4 8e 29 81 88 ff ff   G...... ..)....
>      01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>    backtrace:
>      [<ffffffff82264ec8>] kmalloc include/linux/slab.h:591 [inline]
>      [<ffffffff82264ec8>] kzalloc include/linux/slab.h:721 [inline]
>      [<ffffffff82264ec8>] blk_iolatency_init+0x28/0x190 block/blk-iolatency.c:724
>      [<ffffffff8225b8c4>] blkcg_init_queue+0xb4/0x1c0 block/blk-cgroup.c:1185
>      [<ffffffff822253da>] blk_alloc_queue+0x22a/0x2e0 block/blk-core.c:566
>      [<ffffffff8223b175>] blk_mq_init_queue_data block/blk-mq.c:3100 [inline]
>      [<ffffffff8223b175>] __blk_mq_alloc_disk+0x25/0xd0 block/blk-mq.c:3124
>      [<ffffffff826a9303>] loop_add+0x1c3/0x360 drivers/block/loop.c:2344
>      [<ffffffff826a966e>] loop_control_get_free drivers/block/loop.c:2501 [inline]
>      [<ffffffff826a966e>] loop_control_ioctl+0x17e/0x2e0 drivers/block/loop.c:2516
>      [<ffffffff81597eec>] vfs_ioctl fs/ioctl.c:51 [inline]
>      [<ffffffff81597eec>] __do_sys_ioctl fs/ioctl.c:874 [inline]
>      [<ffffffff81597eec>] __se_sys_ioctl fs/ioctl.c:860 [inline]
>      [<ffffffff81597eec>] __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:860
>      [<ffffffff843fa745>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
>      [<ffffffff843fa745>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
>      [<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> 

Hi Jens,

How about this fix?

    Once blk_throtl_init() queue init failed, blkcg_iolatency_exit() will
     not be invoked for cleanup. That leads a memory leak. Swap the
     blk_throtl_init() and blk_iolatency_init() calls can solve this.

     Reported-by: syzbot+01321b15cc98e6bf96d6@syzkaller.appspotmail.com
     Fixes: 19688d7f9592 (block/blk-cgroup: Swap the blk_throtl_init() 
and blk_iolatency_init() calls)
     Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 3c88a79a319b..1ded4181a6de 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1182,10 +1182,6 @@ int blkcg_init_queue(struct request_queue *q)
         if (preloaded)
                 radix_tree_preload_end();

-       ret = blk_iolatency_init(q);
-       if (ret)
-               goto err_destroy_all;
-
         ret = blk_ioprio_init(q);
         if (ret)
                 goto err_destroy_all;
@@ -1194,6 +1190,12 @@ int blkcg_init_queue(struct request_queue *q)
         if (ret)
                 goto err_destroy_all;

+       ret = blk_iolatency_init(q);
+       if (ret) {
+               blk_throtl_exit(q);
+               goto err_destroy_all;
+       }
+
         return 0;



> 
> ---
> 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.
> syzbot can test patches for this issue, for details see:
> https://goo.gl/tpsmEJ#testing-patches
> 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [syzbot] memory leak in blk_iolatency_init
  2021-09-13 23:28 [syzbot] memory leak in blk_iolatency_init syzbot
  2021-09-14  3:13 ` Xu, Yanfei
@ 2021-10-23 18:58 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2021-10-23 18:58 UTC (permalink / raw)
  To: axboe, cgroups, gregkh, linux-block, linux-kernel, noreply,
	sashal, stable, syzkaller-bugs, tj, yanfei.xu

syzbot has found a reproducer for the following issue on:

HEAD commit:    9c0c4d24ac00 Merge tag 'block-5.15-2021-10-22' of git://gi..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1709f5c4b00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d25eeb482b0f99b
dashboard link: https://syzkaller.appspot.com/bug?extid=01321b15cc98e6bf96d6
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=102280acb00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=144b96f8b00000

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

BUG: memory leak
unreferenced object 0xffff888104729800 (size 96):
  comm "kworker/u4:2", pid 156, jiffies 4294937755 (age 219.670s)
  hex dump (first 32 bytes):
    00 49 c9 85 ff ff ff ff e0 b0 8b 03 81 88 ff ff  .I..............
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff82268cf8>] kmalloc include/linux/slab.h:591 [inline]
    [<ffffffff82268cf8>] kzalloc include/linux/slab.h:721 [inline]
    [<ffffffff82268cf8>] blk_iolatency_init+0x28/0x190 block/blk-iolatency.c:724
    [<ffffffff8225f71e>] blkcg_init_queue+0xee/0x1c0 block/blk-cgroup.c:1193
    [<ffffffff82228fca>] blk_alloc_queue+0x22a/0x2e0 block/blk-core.c:584
    [<ffffffff8223ee35>] blk_mq_init_queue_data block/blk-mq.c:3119 [inline]
    [<ffffffff8223ee35>] __blk_mq_alloc_disk+0x25/0xd0 block/blk-mq.c:3143
    [<ffffffff826a187f>] floppy_alloc_disk+0x2f/0x130 drivers/block/floppy.c:4495
    [<ffffffff86f2aaa9>] do_floppy_init drivers/block/floppy.c:4566 [inline]
    [<ffffffff86f2aaa9>] floppy_async_init+0x10f/0x1329 drivers/block/floppy.c:4731
    [<ffffffff81277354>] async_run_entry_fn+0x24/0xf0 kernel/async.c:127
    [<ffffffff81265dbf>] process_one_work+0x2cf/0x620 kernel/workqueue.c:2297
    [<ffffffff812666c9>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2444
    [<ffffffff8126fc48>] kthread+0x188/0x1d0 kernel/kthread.c:319
    [<ffffffff810022cf>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

BUG: memory leak
unreferenced object 0xffff888104729400 (size 96):
  comm "kworker/u4:2", pid 156, jiffies 4294937755 (age 219.670s)
  hex dump (first 32 bytes):
    00 49 c9 85 ff ff ff ff 90 a8 8b 03 81 88 ff ff  .I..............
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff82268cf8>] kmalloc include/linux/slab.h:591 [inline]
    [<ffffffff82268cf8>] kzalloc include/linux/slab.h:721 [inline]
    [<ffffffff82268cf8>] blk_iolatency_init+0x28/0x190 block/blk-iolatency.c:724
    [<ffffffff8225f71e>] blkcg_init_queue+0xee/0x1c0 block/blk-cgroup.c:1193
    [<ffffffff82228fca>] blk_alloc_queue+0x22a/0x2e0 block/blk-core.c:584
    [<ffffffff8223ee35>] blk_mq_init_queue_data block/blk-mq.c:3119 [inline]
    [<ffffffff8223ee35>] __blk_mq_alloc_disk+0x25/0xd0 block/blk-mq.c:3143
    [<ffffffff826a187f>] floppy_alloc_disk+0x2f/0x130 drivers/block/floppy.c:4495
    [<ffffffff86f2aaa9>] do_floppy_init drivers/block/floppy.c:4566 [inline]
    [<ffffffff86f2aaa9>] floppy_async_init+0x10f/0x1329 drivers/block/floppy.c:4731
    [<ffffffff81277354>] async_run_entry_fn+0x24/0xf0 kernel/async.c:127
    [<ffffffff81265dbf>] process_one_work+0x2cf/0x620 kernel/workqueue.c:2297
    [<ffffffff812666c9>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2444
    [<ffffffff8126fc48>] kthread+0x188/0x1d0 kernel/kthread.c:319
    [<ffffffff810022cf>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

BUG: memory leak
unreferenced object 0xffff888104767e00 (size 96):
  comm "kworker/u4:2", pid 156, jiffies 4294937755 (age 219.670s)
  hex dump (first 32 bytes):
    00 49 c9 85 ff ff ff ff 40 a0 8b 03 81 88 ff ff  .I......@.......
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff82268cf8>] kmalloc include/linux/slab.h:591 [inline]
    [<ffffffff82268cf8>] kzalloc include/linux/slab.h:721 [inline]
    [<ffffffff82268cf8>] blk_iolatency_init+0x28/0x190 block/blk-iolatency.c:724
    [<ffffffff8225f71e>] blkcg_init_queue+0xee/0x1c0 block/blk-cgroup.c:1193
    [<ffffffff82228fca>] blk_alloc_queue+0x22a/0x2e0 block/blk-core.c:584
    [<ffffffff8223ee35>] blk_mq_init_queue_data block/blk-mq.c:3119 [inline]
    [<ffffffff8223ee35>] __blk_mq_alloc_disk+0x25/0xd0 block/blk-mq.c:3143
    [<ffffffff826a187f>] floppy_alloc_disk+0x2f/0x130 drivers/block/floppy.c:4495
    [<ffffffff86f2aaa9>] do_floppy_init drivers/block/floppy.c:4566 [inline]
    [<ffffffff86f2aaa9>] floppy_async_init+0x10f/0x1329 drivers/block/floppy.c:4731
    [<ffffffff81277354>] async_run_entry_fn+0x24/0xf0 kernel/async.c:127
    [<ffffffff81265dbf>] process_one_work+0x2cf/0x620 kernel/workqueue.c:2297
    [<ffffffff812666c9>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2444
    [<ffffffff8126fc48>] kthread+0x188/0x1d0 kernel/kthread.c:319
    [<ffffffff810022cf>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

BUG: memory leak
unreferenced object 0xffff888104767500 (size 96):
  comm "kworker/u4:2", pid 156, jiffies 4294937755 (age 219.670s)
  hex dump (first 32 bytes):
    00 49 c9 85 ff ff ff ff 60 31 88 03 81 88 ff ff  .I......`1......
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff82268cf8>] kmalloc include/linux/slab.h:591 [inline]
    [<ffffffff82268cf8>] kzalloc include/linux/slab.h:721 [inline]
    [<ffffffff82268cf8>] blk_iolatency_init+0x28/0x190 block/blk-iolatency.c:724
    [<ffffffff8225f71e>] blkcg_init_queue+0xee/0x1c0 block/blk-cgroup.c:1193
    [<ffffffff82228fca>] blk_alloc_queue+0x22a/0x2e0 block/blk-core.c:584
    [<ffffffff8223ee35>] blk_mq_init_queue_data block/blk-mq.c:3119 [inline]
    [<ffffffff8223ee35>] __blk_mq_alloc_disk+0x25/0xd0 block/blk-mq.c:3143
    [<ffffffff826a187f>] floppy_alloc_disk+0x2f/0x130 drivers/block/floppy.c:4495
    [<ffffffff86f2aaa9>] do_floppy_init drivers/block/floppy.c:4566 [inline]
    [<ffffffff86f2aaa9>] floppy_async_init+0x10f/0x1329 drivers/block/floppy.c:4731
    [<ffffffff81277354>] async_run_entry_fn+0x24/0xf0 kernel/async.c:127
    [<ffffffff81265dbf>] process_one_work+0x2cf/0x620 kernel/workqueue.c:2297
    [<ffffffff812666c9>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2444
    [<ffffffff8126fc48>] kthread+0x188/0x1d0 kernel/kthread.c:319
    [<ffffffff810022cf>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-23 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 23:28 [syzbot] memory leak in blk_iolatency_init syzbot
2021-09-14  3:13 ` Xu, Yanfei
2021-10-23 18:58 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).