syzbot


WARNING: kmalloc bug in btrfs_ioctl_send

Status: upstream: reported C repro on 2022/11/29 08:21
Reported-by: syzbot+4376a9a073770c173269@syzkaller.appspotmail.com
Fix commit: btrfs: send: limit number of clones and allocated memory size btrfs: send: limit number of clones and allocated memory size
Patched on: [ci-upstream-linux-next-kasan-gce-root], missing on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-qemu2-riscv64 ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 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-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb]
First crash: 68d, last: 3d14h

Cause bisection: introduced by (bisect log) :
commit 7661809d493b426e979f39ab512e3adf41fbcc69
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Wed Jul 14 16:45:49 2021 +0000

  mm: don't allow oversized kvmalloc() calls

Crash: WARNING: kmalloc bug in btrfs_ioctl_send (log)
Repro: C syz .config

Sample crash report:
BTRFS info (device loop0): enabling ssd optimizations
BTRFS info (device loop0): auto enabling async discard
BTRFS info (device loop0): checking UUID tree
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5063 at mm/util.c:596 kvmalloc_node+0x194/0x1a0 mm/util.c:596
Modules linked in:
CPU: 0 PID: 5063 Comm: syz-executor261 Not tainted 6.1.0-syzkaller-13139-gf9ff5644bcc0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:kvmalloc_node+0x194/0x1a0 mm/util.c:596
Code: 72 dd 1a 00 eb aa e8 5b da cc ff 41 81 e5 00 20 00 00 31 ff 44 89 ee e8 fa d6 cc ff 45 85 ed 0f 85 1b ff ff ff e8 3c da cc ff <0f> 0b e9 e3 fe ff ff 0f 1f 44 00 00 f3 0f 1e fa 55 48 89 fd 53 e8
RSP: 0018:ffffc90003bef898 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000400 RCX: 0000000000000000
RDX: ffff888018e70000 RSI: ffffffff81b476c4 RDI: 0000000000000005
RBP: 000fdacfcf680108 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: 0000000000000000 R14: 00000000ffffffff R15: ffff88802aad4998
FS:  0000555556ade300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055b253c7d9f0 CR3: 00000000209ee000 CR4: 0000000000350ef0
Call Trace:
 <TASK>
 kvmalloc include/linux/slab.h:737 [inline]
 kvmalloc_array include/linux/slab.h:755 [inline]
 kvcalloc include/linux/slab.h:760 [inline]
 btrfs_ioctl_send+0xb35/0x65c0 fs/btrfs/send.c:8174
 _btrfs_ioctl_send+0x231/0x2e0 fs/btrfs/ioctl.c:4343
 btrfs_ioctl+0x4026/0x5830 fs/btrfs/ioctl.c:4634
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f82b3991b49
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 14 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffca2642708 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f82b3991b49
RDX: 0000000020000040 RSI: 0000000040489426 RDI: 0000000000000003
RBP: 00007f82b3951410 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f82b39514a0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Crashes (51):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/12/18 14:26 upstream f9ff5644bcc0 05494336 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2022/11/29 07:43 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6d464646530f ca9683b8 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/02/01 21:40 upstream c0b67534c95c 9a6f477c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-kasan-gce-root 2023/02/01 20:02 upstream c0b67534c95c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/31 08:11 upstream 6d796c50f84c b68fb8d6 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/27 01:56 upstream 7c46948a6e9c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/26 19:22 upstream 7c46948a6e9c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-kasan-gce-smack-root 2023/01/26 00:41 upstream 948ef7bb70c4 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/25 22:54 upstream 948ef7bb70c4 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/24 23:35 upstream fb6e71db53f3 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/21 21:45 upstream f883675bf652 cc0f9968 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/20 21:34 upstream d368967cb103 dd15ff29 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/18 21:29 upstream c1649ec55708 4620c2d9 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/18 21:12 upstream c1649ec55708 4620c2d9 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/18 10:11 upstream 6e50979a9c87 42660d9e .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/16 10:42 upstream 5dc4c995db9e a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/15 16:10 upstream 7c6984405241 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-kasan-gce-root 2023/01/15 15:23 upstream 7c6984405241 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/15 15:07 upstream 7c6984405241 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/14 09:41 upstream d9fc1511728c 529798b0 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/12 17:56 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/09 17:33 upstream 1fe4fd6f5cad 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2023/01/04 15:22 upstream 69b41ac87e4a 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/30 10:49 upstream 2258c2dc850b 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/25 02:14 upstream 72a85e2b0a1e 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/24 04:37 upstream 51094a24b85e 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/18 22:27 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/18 11:46 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/17 16:49 upstream 77856d911a8c 05494336 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/17 10:13 upstream 84e57d292203 05494336 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/13 10:52 upstream 764822972d64 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci2-upstream-fs 2022/12/06 01:19 upstream 76dcd734eca2 045cbb84 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-qemu-upstream-386 2023/01/17 23:44 upstream c1649ec55708 42660d9e .config console log report info WARNING: kmalloc bug in btrfs_ioctl_send
ci-qemu-upstream-386 2022/12/08 06:57 upstream 479174d402bc d88f3abb .config console log report info WARNING: kmalloc bug in btrfs_ioctl_send
ci-qemu-upstream-386 2022/12/08 06:57 upstream 479174d402bc d88f3abb .config console log report info WARNING: kmalloc bug in btrfs_ioctl_send
ci-qemu-upstream-386 2022/12/08 06:38 upstream 479174d402bc d88f3abb .config console log report info WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-linux-next-kasan-gce-root 2023/01/25 23:23 linux-next 691781f561e9 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-linux-next-kasan-gce-root 2023/01/02 22:03 linux-next c76083fac3ba ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-linux-next-kasan-gce-root 2022/12/17 17:12 linux-next ca39c4daa6f7 05494336 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2023/01/30 07:13 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c62c88e05937 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2023/01/29 14:06 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c62c88e05937 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2023/01/21 17:05 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci edb2f0dc90f2 559a440a .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2023/01/21 00:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci de8041bf6ca8 559a440a .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2023/01/18 21:20 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9598c377d828 42660d9e .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2023/01/15 15:17 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9598c377d828 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2022/12/31 12:20 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a5541c0811a0 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2022/12/28 18:15 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a5541c0811a0 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2022/12/26 17:10 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a5541c0811a0 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
ci-upstream-gce-arm64 2022/12/17 17:18 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a5541c0811a0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: kmalloc bug in btrfs_ioctl_send
* Struck through repros no longer work on HEAD.