syzbot


memory leak in iovec_from_user

Status: upstream: reported C repro on 2022/04/17 01:27
Reported-by: syzbot+96b43810dfe9c3bb95ed@syzkaller.appspotmail.com
Fix commit: 323b190ba2de io_uring: free iovec if file assignment fails
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-leak ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 77d, last: 77d
Patch testing requests:
Created Duration User Patch Repo Result
2022/04/17 13:27 9m axboe@kernel.dk git://git.kernel.dk/linux-block io_uring-5.18 OK

Sample crash report:
executing program
BUG: memory leak
unreferenced object 0xffff88810d698300 (size 192):
  comm "syz-executor156", pid 3595, jiffies 4294944234 (age 12.580s)
  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:
    [<ffffffff823357be>] kmalloc_array include/linux/slab.h:621 [inline]
    [<ffffffff823357be>] iovec_from_user lib/iov_iter.c:1922 [inline]
    [<ffffffff823357be>] iovec_from_user+0x13e/0x280 lib/iov_iter.c:1905
    [<ffffffff82335945>] __import_iovec+0x45/0x250 lib/iov_iter.c:1948
    [<ffffffff81668c8e>] __io_import_iovec+0xfe/0x800 fs/io_uring.c:3497
    [<ffffffff8166d92f>] io_import_iovec fs/io_uring.c:3508 [inline]
    [<ffffffff8166d92f>] io_read+0x59f/0x880 fs/io_uring.c:3803
    [<ffffffff816727b4>] io_issue_sqe+0x364/0x3270 fs/io_uring.c:7122
    [<ffffffff816761c3>] __io_queue_sqe fs/io_uring.c:7489 [inline]
    [<ffffffff816761c3>] io_queue_sqe fs/io_uring.c:7531 [inline]
    [<ffffffff816761c3>] io_submit_sqe fs/io_uring.c:7736 [inline]
    [<ffffffff816761c3>] io_submit_sqes+0x553/0x3030 fs/io_uring.c:7842
    [<ffffffff81679390>] __do_sys_io_uring_enter+0x6f0/0x1100 fs/io_uring.c:10780
    [<ffffffff8451ca25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff8451ca25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88810d6983c0 (size 192):
  comm "syz-executor156", pid 3603, jiffies 4294944759 (age 7.330s)
  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:
    [<ffffffff823357be>] kmalloc_array include/linux/slab.h:621 [inline]
    [<ffffffff823357be>] iovec_from_user lib/iov_iter.c:1922 [inline]
    [<ffffffff823357be>] iovec_from_user+0x13e/0x280 lib/iov_iter.c:1905
    [<ffffffff82335945>] __import_iovec+0x45/0x250 lib/iov_iter.c:1948
    [<ffffffff81668c8e>] __io_import_iovec+0xfe/0x800 fs/io_uring.c:3497
    [<ffffffff8166d92f>] io_import_iovec fs/io_uring.c:3508 [inline]
    [<ffffffff8166d92f>] io_read+0x59f/0x880 fs/io_uring.c:3803
    [<ffffffff816727b4>] io_issue_sqe+0x364/0x3270 fs/io_uring.c:7122
    [<ffffffff816761c3>] __io_queue_sqe fs/io_uring.c:7489 [inline]
    [<ffffffff816761c3>] io_queue_sqe fs/io_uring.c:7531 [inline]
    [<ffffffff816761c3>] io_submit_sqe fs/io_uring.c:7736 [inline]
    [<ffffffff816761c3>] io_submit_sqes+0x553/0x3030 fs/io_uring.c:7842
    [<ffffffff81679390>] __do_sys_io_uring_enter+0x6f0/0x1100 fs/io_uring.c:10780
    [<ffffffff8451ca25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff8451ca25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae


Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-gce-leak 2022/04/13 01:22 upstream ce522ba9ef7e dacb3f1c .config log report syz C memory leak in iovec_from_user