netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
@ 2025-06-12 23:41 syzbot
  2025-06-12 23:49 ` Kuniyuki Iwashima
  0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2025-06-12 23:41 UTC (permalink / raw)
  To: 3chas3, linux-atm-general, linux-kernel, netdev, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    2c4a1f3fe03e Merge tag 'bpf-fixes' of git://git.kernel.org..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1787d9d4580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=42d51b7b9f9e61d
dashboard link: https://syzkaller.appspot.com/bug?extid=1d3c235276f62963e93a
compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1195ed70580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16187682580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1313b3ad2bf4/disk-2c4a1f3f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/15f719cfdf88/vmlinux-2c4a1f3f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e7f531b0bef6/bzImage-2c4a1f3f.xz

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

=====================================================
BUG: KMSAN: uninit-value in atmtcp_c_send+0x255/0xed0 drivers/atm/atmtcp.c:294
 atmtcp_c_send+0x255/0xed0 drivers/atm/atmtcp.c:294
 vcc_sendmsg+0xd7c/0xff0 net/atm/common.c:644
 sock_sendmsg_nosec net/socket.c:712 [inline]
 __sock_sendmsg+0x330/0x3d0 net/socket.c:727
 ____sys_sendmsg+0x7e0/0xd80 net/socket.c:2566
 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2620
 __sys_sendmsg net/socket.c:2652 [inline]
 __do_sys_sendmsg net/socket.c:2657 [inline]
 __se_sys_sendmsg net/socket.c:2655 [inline]
 __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2655
 x64_sys_call+0x32fb/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:47
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was created at:
 slab_post_alloc_hook mm/slub.c:4154 [inline]
 slab_alloc_node mm/slub.c:4197 [inline]
 kmem_cache_alloc_node_noprof+0x818/0xf00 mm/slub.c:4249
 kmalloc_reserve+0x13c/0x4b0 net/core/skbuff.c:579
 __alloc_skb+0x347/0x7d0 net/core/skbuff.c:670
 alloc_skb include/linux/skbuff.h:1336 [inline]
 vcc_sendmsg+0xb40/0xff0 net/atm/common.c:628
 sock_sendmsg_nosec net/socket.c:712 [inline]
 __sock_sendmsg+0x330/0x3d0 net/socket.c:727
 ____sys_sendmsg+0x7e0/0xd80 net/socket.c:2566
 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2620
 __sys_sendmsg net/socket.c:2652 [inline]
 __do_sys_sendmsg net/socket.c:2657 [inline]
 __se_sys_sendmsg net/socket.c:2655 [inline]
 __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2655
 x64_sys_call+0x32fb/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:47
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 1 UID: 0 PID: 5798 Comm: syz-executor192 Not tainted 6.16.0-rc1-syzkaller-00010-g2c4a1f3fe03e #0 PREEMPT(undef) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
=====================================================


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
  2025-06-12 23:41 [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send syzbot
@ 2025-06-12 23:49 ` Kuniyuki Iwashima
  2025-06-13  2:40   ` syzbot
  0 siblings, 1 reply; 7+ messages in thread
From: Kuniyuki Iwashima @ 2025-06-12 23:49 UTC (permalink / raw)
  To: syzbot+1d3c235276f62963e93a
  Cc: 3chas3, linux-atm-general, linux-kernel, netdev, syzkaller-bugs,
	kuniyu

From: syzbot <syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com>
Date: Thu, 12 Jun 2025 16:41:26 -0700
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    2c4a1f3fe03e Merge tag 'bpf-fixes' of git://git.kernel.org..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1787d9d4580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=42d51b7b9f9e61d
> dashboard link: https://syzkaller.appspot.com/bug?extid=1d3c235276f62963e93a
> compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1195ed70580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16187682580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/1313b3ad2bf4/disk-2c4a1f3f.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/15f719cfdf88/vmlinux-2c4a1f3f.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/e7f531b0bef6/bzImage-2c4a1f3f.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com
> 
> =====================================================
> BUG: KMSAN: uninit-value in atmtcp_c_send+0x255/0xed0 drivers/atm/atmtcp.c:294
>  atmtcp_c_send+0x255/0xed0 drivers/atm/atmtcp.c:294
>  vcc_sendmsg+0xd7c/0xff0 net/atm/common.c:644
>  sock_sendmsg_nosec net/socket.c:712 [inline]
>  __sock_sendmsg+0x330/0x3d0 net/socket.c:727
>  ____sys_sendmsg+0x7e0/0xd80 net/socket.c:2566
>  ___sys_sendmsg+0x271/0x3b0 net/socket.c:2620
>  __sys_sendmsg net/socket.c:2652 [inline]
>  __do_sys_sendmsg net/socket.c:2657 [inline]
>  __se_sys_sendmsg net/socket.c:2655 [inline]
>  __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2655
>  x64_sys_call+0x32fb/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:47
>  do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>  do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> Uninit was created at:
>  slab_post_alloc_hook mm/slub.c:4154 [inline]
>  slab_alloc_node mm/slub.c:4197 [inline]
>  kmem_cache_alloc_node_noprof+0x818/0xf00 mm/slub.c:4249
>  kmalloc_reserve+0x13c/0x4b0 net/core/skbuff.c:579
>  __alloc_skb+0x347/0x7d0 net/core/skbuff.c:670
>  alloc_skb include/linux/skbuff.h:1336 [inline]
>  vcc_sendmsg+0xb40/0xff0 net/atm/common.c:628
>  sock_sendmsg_nosec net/socket.c:712 [inline]
>  __sock_sendmsg+0x330/0x3d0 net/socket.c:727
>  ____sys_sendmsg+0x7e0/0xd80 net/socket.c:2566
>  ___sys_sendmsg+0x271/0x3b0 net/socket.c:2620
>  __sys_sendmsg net/socket.c:2652 [inline]
>  __do_sys_sendmsg net/socket.c:2657 [inline]
>  __se_sys_sendmsg net/socket.c:2655 [inline]
>  __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2655
>  x64_sys_call+0x32fb/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:47
>  do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>  do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> CPU: 1 UID: 0 PID: 5798 Comm: syz-executor192 Not tainted 6.16.0-rc1-syzkaller-00010-g2c4a1f3fe03e #0 PREEMPT(undef) 
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> =====================================================
> 
> 
> ---
> 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 syzkaller@googlegroups.com.
> 
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> 
> If the report is already addressed, let syzbot know by replying with:
> #syz fix: exact-commit-title
> 
> If you want syzbot to run the reproducer, reply with:
> #syz test: git://repo/address.git branch-or-commit-hash
> If you attach or paste a git patch, syzbot will apply it before testing.

#syz test

diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index d4aa0f353b6c..c74dec9a2759 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -288,7 +288,11 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
 	struct sk_buff *new_skb;
 	int result = 0;
 
-	if (!skb->len) return 0;
+	if (!skb->len)
+		return 0;
+	if (skb->len < sizeof(atmtcp_hdr))
+		return -EINVAL;
+
 	dev = vcc->dev_data;
 	hdr = (struct atmtcp_hdr *) skb->data;
 	if (hdr->length == ATMTCP_HDR_MAGIC) {

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
  2025-06-12 23:49 ` Kuniyuki Iwashima
@ 2025-06-13  2:40   ` syzbot
  2025-06-13  3:00     ` Kuniyuki Iwashima
  0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2025-06-13  2:40 UTC (permalink / raw)
  To: 3chas3, kuni1840, kuniyu, linux-atm-general, linux-kernel, netdev,
	syzkaller-bugs

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

drivers/atm/atmtcp.c:293:24: error: use of undeclared identifier 'atmtcp_hdr'; did you mean 'atm_tcp_ops'?


Tested on:

commit:         27605c8c Merge tag 'net-6.16-rc2' of git://git.kernel...
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=42d51b7b9f9e61d
dashboard link: https://syzkaller.appspot.com/bug?extid=1d3c235276f62963e93a
compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1183ed70580000


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
  2025-06-13  2:40   ` syzbot
@ 2025-06-13  3:00     ` Kuniyuki Iwashima
  2025-06-13  3:48       ` syzbot
  0 siblings, 1 reply; 7+ messages in thread
From: Kuniyuki Iwashima @ 2025-06-13  3:00 UTC (permalink / raw)
  To: syzbot+1d3c235276f62963e93a
  Cc: 3chas3, kuni1840, kuniyu, linux-atm-general, linux-kernel, netdev,
	syzkaller-bugs

From: syzbot <syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com>
Date: Thu, 12 Jun 2025 19:40:03 -0700
> Hello,
> 
> syzbot tried to test the proposed patch but the build/boot failed:
> 
> drivers/atm/atmtcp.c:293:24: error: use of undeclared identifier 'atmtcp_hdr'; did you mean 'atm_tcp_ops'?

Oops, I forgot struct :/

#syz test

diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index d4aa0f353b6c..96c0969ce584 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -288,7 +288,11 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
 	struct sk_buff *new_skb;
 	int result = 0;
 
-	if (!skb->len) return 0;
+	if (!skb->len)
+		return 0;
+	if (skb->len < sizeof(struct atmtcp_hdr))
+		return -EINVAL;
+
 	dev = vcc->dev_data;
 	hdr = (struct atmtcp_hdr *) skb->data;
 	if (hdr->length == ATMTCP_HDR_MAGIC) {

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
  2025-06-13  3:00     ` Kuniyuki Iwashima
@ 2025-06-13  3:48       ` syzbot
  2025-06-13  4:24         ` Kuniyuki Iwashima
  0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2025-06-13  3:48 UTC (permalink / raw)
  To: 3chas3, kuni1840, kuniyu, linux-atm-general, linux-kernel, netdev,
	syzkaller-bugs

Hello,

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

Reported-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com
Tested-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com

Tested on:

commit:         27605c8c Merge tag 'net-6.16-rc2' of git://git.kernel...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16d17682580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=42d51b7b9f9e61d
dashboard link: https://syzkaller.appspot.com/bug?extid=1d3c235276f62963e93a
compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch:          https://syzkaller.appspot.com/x/patch.diff?x=129e7682580000

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
  2025-06-13  3:48       ` syzbot
@ 2025-06-13  4:24         ` Kuniyuki Iwashima
  2025-06-13  5:11           ` syzbot
  0 siblings, 1 reply; 7+ messages in thread
From: Kuniyuki Iwashima @ 2025-06-13  4:24 UTC (permalink / raw)
  To: syzbot+1d3c235276f62963e93a
  Cc: 3chas3, kuni1840, kuniyu, linux-atm-general, linux-kernel, netdev,
	syzkaller-bugs

From: syzbot <syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com>
Date: Thu, 12 Jun 2025 20:48:02 -0700
> Hello,
> 
> syzbot has tested the proposed patch and the reproducer did not trigger any issue:
> 
> Reported-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com
> Tested-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com
> 
> Tested on:
> 
> commit:         27605c8c Merge tag 'net-6.16-rc2' of git://git.kernel...
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=16d17682580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=42d51b7b9f9e61d
> dashboard link: https://syzkaller.appspot.com/bug?extid=1d3c235276f62963e93a
> compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
> patch:          https://syzkaller.appspot.com/x/patch.diff?x=129e7682580000
> 
> Note: testing is done by a robot and is best-effort only.

I noticed the original code didn't call dev_kfree_skb() and leaked
sk_buff_head.

Also, most of the ATM drivers don't call atm_return() to revert
the memory accounting by atm_account_tx() in vcc_sendmsg(), but
that's another bug...

#syz test

diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index d4aa0f353b6c..5ce3c6c066e1 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -288,7 +288,11 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
 	struct sk_buff *new_skb;
 	int result = 0;
 
-	if (!skb->len) return 0;
+	if (skb->len < sizeof(struct atmtcp_hdr)) {
+		dev_kfree_skb(skb);
+		return -EINVAL;
+	}
+
 	dev = vcc->dev_data;
 	hdr = (struct atmtcp_hdr *) skb->data;
 	if (hdr->length == ATMTCP_HDR_MAGIC) {

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
  2025-06-13  4:24         ` Kuniyuki Iwashima
@ 2025-06-13  5:11           ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-06-13  5:11 UTC (permalink / raw)
  To: 3chas3, kuni1840, kuniyu, linux-atm-general, linux-kernel, netdev,
	syzkaller-bugs

Hello,

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

Reported-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com
Tested-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com

Tested on:

commit:         27605c8c Merge tag 'net-6.16-rc2' of git://git.kernel...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15c21e0c580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=42d51b7b9f9e61d
dashboard link: https://syzkaller.appspot.com/bug?extid=1d3c235276f62963e93a
compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch:          https://syzkaller.appspot.com/x/patch.diff?x=10c0d10c580000

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-06-13  5:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 23:41 [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send syzbot
2025-06-12 23:49 ` Kuniyuki Iwashima
2025-06-13  2:40   ` syzbot
2025-06-13  3:00     ` Kuniyuki Iwashima
2025-06-13  3:48       ` syzbot
2025-06-13  4:24         ` Kuniyuki Iwashima
2025-06-13  5:11           ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).