syzbot


memory leak in netlink_policy_dump_add_policy

Status: upstream: reported C repro on 2022/08/12 17:04
Reported-by: syzbot+dc54d9ba8153b216cae0@syzkaller.appspotmail.com
Fix commit: 249801360db3 net: genl: fix error path memory leak in policy dumping
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-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-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 182d, last: 182d
Last patch testing requests:
Created Duration User Patch Repo Result
2022/08/16 01:42 16m kuba@kernel.org https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git genl-fix OK log
2022/08/15 18:48 8m kuba@kernel.org https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git genl-fix report log
2022/08/12 19:21 16m rafaelmendsr@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 4e23eeebb2e5 OK log

Sample crash report:
executing program
executing program
executing program
BUG: memory leak
unreferenced object 0xffff888113093f00 (size 192):
  comm "syz-executor228", pid 3636, jiffies 4294947950 (age 12.750s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 0a 00 00 00 00 00 00 00  ................
    40 53 fd 84 ff ff ff ff 40 01 00 00 00 00 00 00  @S......@.......
  backtrace:
    [<ffffffff83a0e378>] kmalloc include/linux/slab.h:600 [inline]
    [<ffffffff83a0e378>] kzalloc include/linux/slab.h:733 [inline]
    [<ffffffff83a0e378>] alloc_state net/netlink/policy.c:104 [inline]
    [<ffffffff83a0e378>] netlink_policy_dump_add_policy+0x198/0x1f0 net/netlink/policy.c:135
    [<ffffffff83a0d78d>] ctrl_dumppolicy_start+0x15d/0x290 net/netlink/genetlink.c:1173
    [<ffffffff83a0abf8>] genl_start+0x148/0x210 net/netlink/genetlink.c:596
    [<ffffffff83a0756a>] __netlink_dump_start+0x20a/0x440 net/netlink/af_netlink.c:2370
    [<ffffffff83a0a38e>] genl_family_rcv_msg_dumpit+0x15e/0x190 net/netlink/genetlink.c:678
    [<ffffffff83a0b1d5>] genl_family_rcv_msg net/netlink/genetlink.c:772 [inline]
    [<ffffffff83a0b1d5>] genl_rcv_msg+0x225/0x2c0 net/netlink/genetlink.c:792
    [<ffffffff83a09807>] netlink_rcv_skb+0x87/0x1d0 net/netlink/af_netlink.c:2501
    [<ffffffff83a0a214>] genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
    [<ffffffff83a08977>] netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
    [<ffffffff83a08977>] netlink_unicast+0x397/0x4c0 net/netlink/af_netlink.c:1345
    [<ffffffff83a08e36>] netlink_sendmsg+0x396/0x710 net/netlink/af_netlink.c:1921
    [<ffffffff8385aea6>] sock_sendmsg_nosec net/socket.c:714 [inline]
    [<ffffffff8385aea6>] sock_sendmsg+0x56/0x80 net/socket.c:734
    [<ffffffff8385b40c>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2482
    [<ffffffff8385fd08>] ___sys_sendmsg+0xa8/0x110 net/socket.c:2536
    [<ffffffff8385fe98>] __sys_sendmsg+0x88/0x100 net/socket.c:2565
    [<ffffffff845d8535>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff845d8535>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd


Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-gce-leak 2022/08/08 16:57 upstream 4e23eeebb2e5 88e3a122 .config console log report syz C memory leak in netlink_policy_dump_add_policy
* Struck through repros no longer work on HEAD.