[syzbot] memory leak in j1939_sk_sendmsg

4 views
Skip to first unread message

David Kahurani

unread,
Apr 18, 2022, 3:10:17ā€ÆAM4/18/22
to syzkall...@googlegroups.com, syzbot+085305...@syzkaller.appspotmail.com
Hello,

syzbot found the following issue on:

HEAD commit: 7266f203 Merge tag 'pm-5.13-rc8' of git://git.kernel.org/p..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16e22d34300000
kernel config: https://syzkaller.appspot.com/x/.config?x=3aac8c6ef370586a
dashboard link: https://syzkaller.appspot.com/bug?extid=085305c4b952053c9437
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11e0d6a4300000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13528400300000

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

BUG: memory leak
unreferenced object 0xffff888112d44400 (size 232):
comm "syz-executor006", pid 8628, jiffies 4294942391 (age 8.470s)

---------

Check whether this bug still exists.

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master

syzbot

unread,
Apr 18, 2022, 3:18:11ā€ÆAM4/18/22
to k.kah...@gmail.com, syzkall...@googlegroups.com
Hello,

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

BUG: memory leak
unreferenced object 0xffff88810bc03800 (size 232):
comm "syz-executor164", pid 4072, jiffies 4294943485 (age 8.120s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 c0 0d 81 88 ff ff 00 44 5e 0c 81 88 ff ff .........D^.....
backtrace:
[<ffffffff837dcf86>] __alloc_skb+0x216/0x290 net/core/skbuff.c:414
[<ffffffff837e29aa>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e29aa>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4cd3>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd3fff>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd3fff>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd3fff>] j1939_sk_sendmsg+0x2cf/0x810 net/can/j1939/socket.c:1253
[<ffffffff837cb406>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb406>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb96c>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cf9db>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfad8>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da45>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da45>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff888110c14800 (size 512):
comm "syz-executor164", pid 4072, jiffies 4294943485 (age 8.120s)
hex dump (first 32 bytes):
0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 64 00 00 00 00 00 00 00 ........d.......
backtrace:
[<ffffffff837dce53>] kmalloc_reserve net/core/skbuff.c:354 [inline]
[<ffffffff837dce53>] __alloc_skb+0xe3/0x290 net/core/skbuff.c:426
[<ffffffff837e29aa>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e29aa>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4cd3>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd3fff>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd3fff>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd3fff>] j1939_sk_sendmsg+0x2cf/0x810 net/can/j1939/socket.c:1253
[<ffffffff837cb406>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb406>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb96c>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cf9db>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfad8>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da45>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da45>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae



Tested on:

commit: b2d229d4 Linux 5.18-rc3
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=132439b8f00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2197cd22d3971cc5
dashboard link: https://syzkaller.appspot.com/bug?extid=085305c4b952053c9437
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.

David Kahurani

unread,
Apr 19, 2022, 3:11:17ā€ÆAM4/19/22
to syzbot, syzkall...@googlegroups.com
0001-fix-a-memory-leak.patch

syzbot

unread,
Apr 19, 2022, 4:54:10ā€ÆAM4/19/22
to k.kah...@gmail.com, syzkall...@googlegroups.com
Hello,

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

BUG: memory leak
unreferenced object 0xffff88810e44b500 (size 232):
comm "syz-executor902", pid 4077, jiffies 4294943610 (age 8.100s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 80 d1 0d 81 88 ff ff 00 10 56 13 81 88 ff ff ..........V.....
backtrace:
[<ffffffff837dcf76>] __alloc_skb+0x216/0x290 net/core/skbuff.c:414
[<ffffffff837e299a>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e299a>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4cc3>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd4003>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd4003>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd4003>] j1939_sk_sendmsg+0x2e3/0x830 net/can/j1939/socket.c:1255
[<ffffffff837cb3f6>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb3f6>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb95c>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cf9cb>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfac8>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da45>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da45>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff888104b83200 (size 512):
comm "syz-executor902", pid 4077, jiffies 4294943610 (age 8.100s)
hex dump (first 32 bytes):
0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 64 00 00 00 00 00 00 00 ........d.......
backtrace:
[<ffffffff837dce43>] kmalloc_reserve net/core/skbuff.c:354 [inline]
[<ffffffff837dce43>] __alloc_skb+0xe3/0x290 net/core/skbuff.c:426
[<ffffffff837e299a>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e299a>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4cc3>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd4003>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd4003>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd4003>] j1939_sk_sendmsg+0x2e3/0x830 net/can/j1939/socket.c:1255
[<ffffffff837cb3f6>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb3f6>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb95c>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cf9cb>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfac8>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da45>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da45>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae



Tested on:

commit: b2d229d4 Linux 5.18-rc3
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=161da694f00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2197cd22d3971cc5
dashboard link: https://syzkaller.appspot.com/bug?extid=085305c4b952053c9437
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=16371ff0f00000

David Kahurani

unread,
Apr 22, 2022, 12:07:18ā€ÆAM4/22/22
to syzbot, syzkall...@googlegroups.com
Check if this is caused by a pointer overwrite.
0001-possibly-fix-a-memory-leak.patch

syzbot

unread,
Apr 22, 2022, 5:03:11ā€ÆAM4/22/22
to k.kah...@gmail.com, syzkall...@googlegroups.com
Hello,

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

BUG: memory leak
unreferenced object 0xffff8881191b5100 (size 232):
comm "syz-executor.5", pid 4213, jiffies 4294942958 (age 10.400s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 ad 0e 81 88 ff ff 00 a0 02 19 81 88 ff ff ................
backtrace:
[<ffffffff837dcff6>] __alloc_skb+0x216/0x290 net/core/skbuff.c:414
[<ffffffff837e2a1a>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e2a1a>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4d43>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd440f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd440f>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd440f>] j1939_sk_sendmsg+0x2cf/0x810 net/can/j1939/socket.c:1253
[<ffffffff837cb476>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb476>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb9dc>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cfa4b>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfb48>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff8881191bae00 (size 512):
comm "syz-executor.5", pid 4213, jiffies 4294942958 (age 10.400s)
hex dump (first 32 bytes):
0e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 64 00 00 00 00 00 00 00 ........d.......
backtrace:
[<ffffffff837dcec3>] kmalloc_reserve net/core/skbuff.c:354 [inline]
[<ffffffff837dcec3>] __alloc_skb+0xe3/0x290 net/core/skbuff.c:426
[<ffffffff837e2a1a>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e2a1a>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4d43>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd440f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd440f>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd440f>] j1939_sk_sendmsg+0x2cf/0x810 net/can/j1939/socket.c:1253
[<ffffffff837cb476>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb476>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb9dc>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cfa4b>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfb48>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88811924a400 (size 1024):
comm "syz-executor.5", pid 4215, jiffies 4294942962 (age 10.360s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1d 00 07 41 00 00 00 00 00 00 00 00 00 00 00 00 ...A............
backtrace:
[<ffffffff837d1a72>] kmalloc include/linux/slab.h:586 [inline]
[<ffffffff837d1a72>] sk_prot_alloc+0xd2/0x1b0 net/core/sock.c:1936
[<ffffffff837d5652>] sk_alloc+0x32/0x2e0 net/core/sock.c:1989
[<ffffffff83dc56a8>] can_create+0x108/0x300 net/can/af_can.c:158
[<ffffffff837ca28b>] __sock_create+0x1ab/0x2b0 net/socket.c:1468
[<ffffffff837cd20f>] sock_create net/socket.c:1519 [inline]
[<ffffffff837cd20f>] __sys_socket+0x6f/0x140 net/socket.c:1561
[<ffffffff837cd2fa>] __do_sys_socket net/socket.c:1570 [inline]
[<ffffffff837cd2fa>] __se_sys_socket net/socket.c:1568 [inline]
[<ffffffff837cd2fa>] __x64_sys_socket+0x1a/0x20 net/socket.c:1568
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff8881191b1500 (size 32):
comm "syz-executor.5", pid 4215, jiffies 4294942962 (age 10.360s)
hex dump (first 32 bytes):
b0 2e 04 40 81 88 ff ff 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:
[<ffffffff822050b3>] kmalloc include/linux/slab.h:581 [inline]
[<ffffffff822050b3>] kzalloc include/linux/slab.h:714 [inline]
[<ffffffff822050b3>] apparmor_sk_alloc_security+0x53/0xd0 security/apparmor/lsm.c:792
[<ffffffff821cac71>] security_sk_alloc+0x31/0x70 security/security.c:2279
[<ffffffff837d1a8d>] sk_prot_alloc+0xed/0x1b0 net/core/sock.c:1939
[<ffffffff837d5652>] sk_alloc+0x32/0x2e0 net/core/sock.c:1989
[<ffffffff83dc56a8>] can_create+0x108/0x300 net/can/af_can.c:158
[<ffffffff837ca28b>] __sock_create+0x1ab/0x2b0 net/socket.c:1468
[<ffffffff837cd20f>] sock_create net/socket.c:1519 [inline]
[<ffffffff837cd20f>] __sys_socket+0x6f/0x140 net/socket.c:1561
[<ffffffff837cd2fa>] __do_sys_socket net/socket.c:1570 [inline]
[<ffffffff837cd2fa>] __se_sys_socket net/socket.c:1568 [inline]
[<ffffffff837cd2fa>] __x64_sys_socket+0x1a/0x20 net/socket.c:1568
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff8881191c2d00 (size 232):
comm "syz-executor.5", pid 4215, jiffies 4294942962 (age 10.360s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 ad 0e 81 88 ff ff 00 a4 24 19 81 88 ff ff ..........$.....
backtrace:
[<ffffffff837dcff6>] __alloc_skb+0x216/0x290 net/core/skbuff.c:414
[<ffffffff837e2a1a>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e2a1a>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4d43>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd440f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd440f>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd440f>] j1939_sk_sendmsg+0x2cf/0x810 net/can/j1939/socket.c:1253
[<ffffffff837cb476>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb476>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb9dc>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cfa4b>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfb48>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae



Tested on:

commit: d569e869 Merge tag 'drm-fixes-2022-04-22' of git://ano..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=127876e8f00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2e0170f940d4be96
dashboard link: https://syzkaller.appspot.com/bug?extid=085305c4b952053c9437
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=15f0200cf00000

Reply all
Reply to author
Forward
0 new messages