netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
@ 2023-12-05 18:25 syzbot
  2023-12-06  0:53 ` Kuniyuki Iwashima
  2023-12-06  1:55 ` [PATCH] llc: fix " Edward Adam Davis
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2023-12-05 18:25 UTC (permalink / raw)
  To: davem, edumazet, kuba, linux-kernel, netdev, pabeni,
	syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    1c41041124bd Merge tag 'i3c/for-6.7' of git://git.kernel.o..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=10429eeb680000
kernel config:  https://syzkaller.appspot.com/x/.config?x=956549bd1d1e9efd
dashboard link: https://syzkaller.appspot.com/bug?extid=b5ad66046b913bc04c6f
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=12b6a00f680000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=121471ef680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/20fd86e677f1/disk-1c410411.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ccd39cb0b7b6/vmlinux-1c410411.xz
kernel image: https://storage.googleapis.com/syzbot-assets/156fc60f97bc/bzImage-1c410411.xz

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

syz-executor994 uses obsolete (PF_INET,SOCK_PACKET)
=====================================================
BUG: KMSAN: uninit-value in __llc_lookup_established+0xe9d/0xf90
 __llc_lookup_established+0xe9d/0xf90
 __llc_lookup net/llc/llc_conn.c:611 [inline]
 llc_conn_handler+0x4bd/0x1360 net/llc/llc_conn.c:791
 llc_rcv+0xfbb/0x14a0 net/llc/llc_input.c:206
 __netif_receive_skb_one_core net/core/dev.c:5527 [inline]
 __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5641
 netif_receive_skb_internal net/core/dev.c:5727 [inline]
 netif_receive_skb+0x58/0x660 net/core/dev.c:5786
 tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1555
 tun_get_user+0x53af/0x66d0 drivers/net/tun.c:2002
 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048
 call_write_iter include/linux/fs.h:2020 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x8ef/0x1490 fs/read_write.c:584
 ksys_write+0x20f/0x4c0 fs/read_write.c:637
 __do_sys_write fs/read_write.c:649 [inline]
 __se_sys_write fs/read_write.c:646 [inline]
 __x64_sys_write+0x93/0xd0 fs/read_write.c:646
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Local variable daddr created at:
 llc_conn_handler+0x53/0x1360 net/llc/llc_conn.c:783
 llc_rcv+0xfbb/0x14a0 net/llc/llc_input.c:206

CPU: 1 PID: 5004 Comm: syz-executor994 Not tainted 6.6.0-syzkaller-14500-g1c41041124bd #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
=====================================================


---
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] 5+ messages in thread

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
  2023-12-05 18:25 [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established syzbot
@ 2023-12-06  0:53 ` Kuniyuki Iwashima
  2023-12-06  1:28   ` syzbot
  2023-12-06  1:55 ` [PATCH] llc: fix " Edward Adam Davis
  1 sibling, 1 reply; 5+ messages in thread
From: Kuniyuki Iwashima @ 2023-12-06  0:53 UTC (permalink / raw)
  To: syzbot+b5ad66046b913bc04c6f
  Cc: davem, edumazet, kuba, linux-kernel, netdev, pabeni,
	syzkaller-bugs, kuniyu

From: syzbot <syzbot+b5ad66046b913bc04c6f@syzkaller.appspotmail.com>
Date: Tue, 05 Dec 2023 10:25:31 -0800
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    1c41041124bd Merge tag 'i3c/for-6.7' of git://git.kernel.o..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=10429eeb680000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=956549bd1d1e9efd
> dashboard link: https://syzkaller.appspot.com/bug?extid=b5ad66046b913bc04c6f
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=12b6a00f680000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=121471ef680000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/20fd86e677f1/disk-1c410411.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/ccd39cb0b7b6/vmlinux-1c410411.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/156fc60f97bc/bzImage-1c410411.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+b5ad66046b913bc04c6f@syzkaller.appspotmail.com
> 
> syz-executor994 uses obsolete (PF_INET,SOCK_PACKET)
> =====================================================
> BUG: KMSAN: uninit-value in __llc_lookup_established+0xe9d/0xf90
>  __llc_lookup_established+0xe9d/0xf90
>  __llc_lookup net/llc/llc_conn.c:611 [inline]
>  llc_conn_handler+0x4bd/0x1360 net/llc/llc_conn.c:791
>  llc_rcv+0xfbb/0x14a0 net/llc/llc_input.c:206
>  __netif_receive_skb_one_core net/core/dev.c:5527 [inline]
>  __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5641
>  netif_receive_skb_internal net/core/dev.c:5727 [inline]
>  netif_receive_skb+0x58/0x660 net/core/dev.c:5786
>  tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1555
>  tun_get_user+0x53af/0x66d0 drivers/net/tun.c:2002
>  tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048
>  call_write_iter include/linux/fs.h:2020 [inline]
>  new_sync_write fs/read_write.c:491 [inline]
>  vfs_write+0x8ef/0x1490 fs/read_write.c:584
>  ksys_write+0x20f/0x4c0 fs/read_write.c:637
>  __do_sys_write fs/read_write.c:649 [inline]
>  __se_sys_write fs/read_write.c:646 [inline]
>  __x64_sys_write+0x93/0xd0 fs/read_write.c:646
>  do_syscall_x64 arch/x86/entry/common.c:51 [inline]
>  do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
>  entry_SYSCALL_64_after_hwframe+0x63/0x6b
> 
> Local variable daddr created at:
>  llc_conn_handler+0x53/0x1360 net/llc/llc_conn.c:783
>  llc_rcv+0xfbb/0x14a0 net/llc/llc_input.c:206
> 
> CPU: 1 PID: 5004 Comm: syz-executor994 Not tainted 6.6.0-syzkaller-14500-g1c41041124bd #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
> =====================================================

llc_pdu_decode_[sd]a() initialises addr.mac only for ETH_P_802_2.
Otherwise, llc_estab_match() reads an uninit value form both [sd]addr.

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

diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 0a3f5e0bec00..730561e186ce 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -780,7 +780,7 @@ static struct sock *llc_create_incoming_sock(struct sock *sk,
 
 void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb)
 {
-	struct llc_addr saddr, daddr;
+	struct llc_addr saddr = {}, daddr = {};
 	struct sock *sk;
 
 	llc_pdu_decode_sa(skb, saddr.mac);

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

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
  2023-12-06  0:53 ` Kuniyuki Iwashima
@ 2023-12-06  1:28   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-12-06  1:28 UTC (permalink / raw)
  To: davem, edumazet, kuba, kuniyu, linux-kernel, netdev, pabeni,
	syzkaller-bugs

Hello,

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

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

Tested on:

commit:         1c410411 Merge tag 'i3c/for-6.7' of git://git.kernel.o..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1577c0d4e80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=956549bd1d1e9efd
dashboard link: https://syzkaller.appspot.com/bug?extid=b5ad66046b913bc04c6f
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=13fa938ce80000

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

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

* [PATCH] llc: fix uninit-value in __llc_lookup_established
  2023-12-05 18:25 [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established syzbot
  2023-12-06  0:53 ` Kuniyuki Iwashima
@ 2023-12-06  1:55 ` Edward Adam Davis
  2023-12-06  6:27   ` Kuniyuki Iwashima
  1 sibling, 1 reply; 5+ messages in thread
From: Edward Adam Davis @ 2023-12-06  1:55 UTC (permalink / raw)
  To: syzbot+b5ad66046b913bc04c6f
  Cc: davem, edumazet, kuba, linux-kernel, netdev, pabeni,
	syzkaller-bugs

llc only supports ETH_P_802_2 protocol, so drop the skb when the protocol is 
not it.

Reported-by: syzbot+b5ad66046b913bc04c6f@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 net/llc/llc_input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 51bccfb00a9c..16b2c57f38c2 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -141,7 +141,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
 			return 0;
 		if (unlikely(pskb_trim_rcsum(skb, data_size)))
 			return 0;
-	}
+	} else
+		return 0;
 	return 1;
 }
 
-- 
2.43.0



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

* Re: [PATCH] llc: fix uninit-value in __llc_lookup_established
  2023-12-06  1:55 ` [PATCH] llc: fix " Edward Adam Davis
@ 2023-12-06  6:27   ` Kuniyuki Iwashima
  0 siblings, 0 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2023-12-06  6:27 UTC (permalink / raw)
  To: eadavis
  Cc: davem, edumazet, kuba, linux-kernel, netdev, pabeni,
	syzbot+b5ad66046b913bc04c6f, syzkaller-bugs, kuniyu

From: Edward Adam Davis <eadavis@qq.com>
Date: Wed,  6 Dec 2023 09:55:15 +0800
> llc only supports ETH_P_802_2 protocol, so drop the skb when the protocol is 
> not it.

This is not true.  ETH_P_TR_802_2 is also processed by llc_rcv().

Let me post this formally.
https://lore.kernel.org/netdev/20231206005340.11534-1-kuniyu@amazon.com/

> 
> Reported-by: syzbot+b5ad66046b913bc04c6f@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
>  net/llc/llc_input.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
> index 51bccfb00a9c..16b2c57f38c2 100644
> --- a/net/llc/llc_input.c
> +++ b/net/llc/llc_input.c
> @@ -141,7 +141,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
>  			return 0;
>  		if (unlikely(pskb_trim_rcsum(skb, data_size)))
>  			return 0;
> -	}
> +	} else
> +		return 0;
>  	return 1;
>  }
>  
> -- 
> 2.43.0

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

end of thread, other threads:[~2023-12-06  6:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-05 18:25 [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established syzbot
2023-12-06  0:53 ` Kuniyuki Iwashima
2023-12-06  1:28   ` syzbot
2023-12-06  1:55 ` [PATCH] llc: fix " Edward Adam Davis
2023-12-06  6:27   ` Kuniyuki Iwashima

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