[syzbot] memory leak in netlink_policy_dump_add_policy

28 views
Skip to first unread message

syzbot

unread,
Aug 12, 2022, 1:04:27ā€ÆPM8/12/22
to da...@davemloft.net, edum...@google.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4e23eeebb2e5 Merge tag 'bitmap-6.0-rc1' of https://github...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=165f4f6a080000
kernel config: https://syzkaller.appspot.com/x/.config?x=3a433c7a2539f51c
dashboard link: https://syzkaller.appspot.com/bug?extid=dc54d9ba8153b216cae0
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=1443be71080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11e5918e080000

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

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



---
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

Jakub Kicinski

unread,
Aug 12, 2022, 5:04:43ā€ÆPM8/12/22
to syzbot, da...@davemloft.net, edum...@google.com, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
On Fri, 12 Aug 2022 10:04:26 -0700 syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 4e23eeebb2e5 Merge tag 'bitmap-6.0-rc1' of https://github...
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=165f4f6a080000
> kernel config: https://syzkaller.appspot.com/x/.config?x=3a433c7a2539f51c
> dashboard link: https://syzkaller.appspot.com/bug?extid=dc54d9ba8153b216cae0
> 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=1443be71080000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11e5918e080000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+dc54d9...@syzkaller.appspotmail.com

Let's see if attaching a patch works...

#syz test
0001-net-genl-fix-error-path-memory-leak-in-policy-dumpin.patch

syzbot

unread,
Aug 12, 2022, 5:04:43ā€ÆPM8/12/22
to Jakub Kicinski, da...@davemloft.net, edum...@google.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
want 2 args (repo, branch), got 1

syzbot

unread,
Aug 12, 2022, 5:04:45ā€ÆPM8/12/22
to Jakub Kicinski, da...@davemloft.net, edum...@google.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
want 2 args (repo, branch), got 15

>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bug...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/20220812140439.6bb2bb17%40kernel.org.

syzbot

unread,
Aug 12, 2022, 5:27:07ā€ÆPM8/12/22
to Jakub Kicinski, ku...@kernel.org, syzkall...@googlegroups.com
> On Fri, 12 Aug 2022 10:04:26 -0700 syzbot wrote:
>> Hello,
>>
>> syzbot found the following issue on:
>>
>> HEAD commit: 4e23eeebb2e5 Merge tag 'bitmap-6.0-rc1' of https://github...
>> git tree: upstream
>> console output: https://syzkaller.appspot.com/x/log.txt?x=165f4f6a080000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=3a433c7a2539f51c
>> dashboard link: https://syzkaller.appspot.com/bug?extid=dc54d9ba8153b216cae0
>> 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=1443be71080000
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11e5918e080000
>>
>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>> Reported-by: syzbot+dc54d9...@syzkaller.appspotmail.com
>
> #syz fix: https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git genl-fix

Your 'fix:' command is accepted, but please keep syzkall...@googlegroups.com mailing list in CC next time. It serves as a history of what happened with each bug report. Thank you.

syzbot

unread,
Aug 13, 2022, 12:46:08ā€ÆAM8/13/22
to rafael...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+dc54d9...@syzkaller.appspotmail.com

Tested on:

commit: 4e23eeeb Merge tag 'bitmap-6.0-rc1' of https://github...
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=10795f25080000
kernel config: https://syzkaller.appspot.com/x/.config?x=3a433c7a2539f51c
dashboard link: https://syzkaller.appspot.com/bug?extid=dc54d9ba8153b216cae0
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=11ee3d15080000

Note: testing is done by a robot and is best-effort only.

Jakub Kicinski

unread,
Aug 15, 2022, 2:48:14ā€ÆPM8/15/22
to syzbot, syzkall...@googlegroups.com
On Fri, 12 Aug 2022 14:27:06 -0700 syzbot wrote:
> #syz fix: https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git genl-fix

Oops, I meant test:

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git genl-fix

syzbot

unread,
Aug 15, 2022, 3:41:17ā€ÆPM8/15/22
to ku...@kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
memory leak in netlink_policy_dump_add_policy

BUG: memory leak
unreferenced object 0xffff8881150d8c00 (size 192):
comm "syz-executor.0", pid 4094, jiffies 4294944950 (age 13.410s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 ................
e0 64 fd 84 ff ff ff ff 40 01 00 00 00 00 00 00 .d......@.......
backtrace:
[<ffffffff83a14e98>] kmalloc include/linux/slab.h:600 [inline]
[<ffffffff83a14e98>] kzalloc include/linux/slab.h:733 [inline]
[<ffffffff83a14e98>] alloc_state net/netlink/policy.c:104 [inline]
[<ffffffff83a14e98>] netlink_policy_dump_add_policy+0x198/0x1f0 net/netlink/policy.c:135
[<ffffffff83a1428d>] ctrl_dumppolicy_start+0x15d/0x2b0 net/netlink/genetlink.c:1173
[<ffffffff83a116f8>] genl_start+0x148/0x210 net/netlink/genetlink.c:596
[<ffffffff83a0e06a>] __netlink_dump_start+0x20a/0x440 net/netlink/af_netlink.c:2370
[<ffffffff83a10e8e>] genl_family_rcv_msg_dumpit+0x15e/0x190 net/netlink/genetlink.c:678
[<ffffffff83a11cd5>] genl_family_rcv_msg net/netlink/genetlink.c:772 [inline]
[<ffffffff83a11cd5>] genl_rcv_msg+0x225/0x2c0 net/netlink/genetlink.c:792
[<ffffffff83a10307>] netlink_rcv_skb+0x87/0x1d0 net/netlink/af_netlink.c:2501
[<ffffffff83a10d14>] genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
[<ffffffff83a0f477>] netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
[<ffffffff83a0f477>] netlink_unicast+0x397/0x4c0 net/netlink/af_netlink.c:1345
[<ffffffff83a0f936>] netlink_sendmsg+0x396/0x710 net/netlink/af_netlink.c:1921
[<ffffffff83861796>] sock_sendmsg_nosec net/socket.c:714 [inline]
[<ffffffff83861796>] sock_sendmsg+0x56/0x80 net/socket.c:734
[<ffffffff83861cfc>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2482
[<ffffffff838665f8>] ___sys_sendmsg+0xa8/0x110 net/socket.c:2536
[<ffffffff83866788>] __sys_sendmsg+0x88/0x100 net/socket.c:2565
[<ffffffff845e0645>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff845e0645>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff888114a7e240 (size 192):
comm "syz-executor.0", pid 4097, jiffies 4294945519 (age 7.720s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 ................
e0 64 fd 84 ff ff ff ff 40 01 00 00 00 00 00 00 .d......@.......
backtrace:
[<ffffffff83a14e98>] kmalloc include/linux/slab.h:600 [inline]
[<ffffffff83a14e98>] kzalloc include/linux/slab.h:733 [inline]
[<ffffffff83a14e98>] alloc_state net/netlink/policy.c:104 [inline]
[<ffffffff83a14e98>] netlink_policy_dump_add_policy+0x198/0x1f0 net/netlink/policy.c:135
[<ffffffff83a1428d>] ctrl_dumppolicy_start+0x15d/0x2b0 net/netlink/genetlink.c:1173
[<ffffffff83a116f8>] genl_start+0x148/0x210 net/netlink/genetlink.c:596
[<ffffffff83a0e06a>] __netlink_dump_start+0x20a/0x440 net/netlink/af_netlink.c:2370
[<ffffffff83a10e8e>] genl_family_rcv_msg_dumpit+0x15e/0x190 net/netlink/genetlink.c:678
[<ffffffff83a11cd5>] genl_family_rcv_msg net/netlink/genetlink.c:772 [inline]
[<ffffffff83a11cd5>] genl_rcv_msg+0x225/0x2c0 net/netlink/genetlink.c:792
[<ffffffff83a10307>] netlink_rcv_skb+0x87/0x1d0 net/netlink/af_netlink.c:2501
[<ffffffff83a10d14>] genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
[<ffffffff83a0f477>] netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
[<ffffffff83a0f477>] netlink_unicast+0x397/0x4c0 net/netlink/af_netlink.c:1345
[<ffffffff83a0f936>] netlink_sendmsg+0x396/0x710 net/netlink/af_netlink.c:1921
[<ffffffff83861796>] sock_sendmsg_nosec net/socket.c:714 [inline]
[<ffffffff83861796>] sock_sendmsg+0x56/0x80 net/socket.c:734
[<ffffffff83861cfc>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2482
[<ffffffff838665f8>] ___sys_sendmsg+0xa8/0x110 net/socket.c:2536
[<ffffffff83866788>] __sys_sendmsg+0x88/0x100 net/socket.c:2565
[<ffffffff845e0645>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff845e0645>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd



Tested on:

commit: 7b3f410d net: genl: fix error path memory leak in poli..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git genl-fix
console output: https://syzkaller.appspot.com/x/log.txt?x=13393d15080000
kernel config: https://syzkaller.appspot.com/x/.config?x=181546538a43e305
dashboard link: https://syzkaller.appspot.com/bug?extid=dc54d9ba8153b216cae0
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Note: no patches were applied.

Jakub Kicinski

unread,
Aug 15, 2022, 9:42:58ā€ÆPM8/15/22
to syzbot, syzkall...@googlegroups.com
On Mon, 15 Aug 2022 11:48:11 -0700 Jakub Kicinski wrote:
> #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git genl-fix

Again:

syzbot

unread,
Aug 16, 2022, 3:26:09ā€ÆAM8/16/22
to ku...@kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+dc54d9...@syzkaller.appspotmail.com

Tested on:

commit: 66f01a66 net: genl: fix error path memory leak in poli..
console output: https://syzkaller.appspot.com/x/log.txt?x=159120f3080000
kernel config: https://syzkaller.appspot.com/x/.config?x=181546538a43e305
dashboard link: https://syzkaller.appspot.com/bug?extid=dc54d9ba8153b216cae0
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Note: no patches were applied.
Reply all
Reply to author
Forward
0 new messages