public inbox for linux-kernel@vger.kernel.org
 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
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ 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] 13+ messages in thread

* Re: [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:28   ` syzbot
  2023-12-06  1:14 ` syzbot
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ 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] 13+ messages in thread

* Re: [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:14 ` syzbot
  2023-12-06  7:08 ` syzbot
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06  1:14 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [net?] KMSAN: uninit-value in __llc_lookup_established
Author: eadavis@qq.com

please test uninit-value in __llc_lookup_established

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

diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 51bccfb00a9c..58e0b8ab41b7 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -126,6 +126,7 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
 
 	skb->transport_header += llc_len;
 	skb_pull(skb, llc_len);
+	printk("3sp: %d\n", skb->protocol);
 	if (skb->protocol == htons(ETH_P_802_2)) {
 		__be16 pdulen;
 		s32 data_size;
@@ -141,7 +142,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;
 }
 
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index afa5497f7c35..bff910513fc3 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1900,6 +1900,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 		skb->protocol = eth_type_trans(skb, tun->dev);
 		break;
 	}
+	printk("sp: %d\n", skb->protocol);
 
 	/* copy skb_ubuf_info for callback when skb has no error */
 	if (zerocopy) {
@@ -1999,6 +2000,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 
 		local_bh_enable();
 	} else if (!IS_ENABLED(CONFIG_4KSTACKS)) {
+		printk("2sp: %d\n", skb->protocol);
 		tun_rx_batched(tun, tfile, skb, more);
 	} else {
 		netif_rx(skb);


^ permalink raw reply related	[flat|nested] 13+ 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; 13+ 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] 13+ messages in thread

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
       [not found] <tencent_8F9E041BAF4BC41B1C2558BA38BBE233E808@qq.com>
@ 2023-12-06  1:55 ` syzbot
  0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06  1:55 UTC (permalink / raw)
  To: eadavis, linux-kernel, 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:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=11b6743ce80000
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=141ceb9ae80000

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

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

* Re: [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:14 ` syzbot
@ 2023-12-06  7:08 ` syzbot
  2023-12-06  8:13 ` syzbot
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06  7:08 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [net?] KMSAN: uninit-value in __llc_lookup_established
Author: eadavis@qq.com

please test uninit-value in __llc_lookup_established

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

diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 51bccfb00a9c..58e0b8ab41b7 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -126,6 +126,7 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
 
 	skb->transport_header += llc_len;
 	skb_pull(skb, llc_len);
+	printk("3sp: %d, %d, %d\n", skb->protocol, htons(ETH_P_802_2), htons(ETH_P_TR_802_2));
 	if (skb->protocol == htons(ETH_P_802_2)) {
 		__be16 pdulen;
 		s32 data_size;
@@ -141,7 +142,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
 			return 0;
 		if (unlikely(pskb_trim_rcsum(skb, data_size)))
 			return 0;
-	}
+	} else if (skb->protocol != htons(ETH_P_TR_802_2))
+		return 0;
 	return 1;
 }
 


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

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
       [not found] <tencent_EE98A7D746C352F2464689936ED8AEF14C06@qq.com>
@ 2023-12-06  8:01 ` syzbot
  0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06  8:01 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: uninit-value in __llc_lookup_established

syz-executor.0 uses obsolete (PF_INET,SOCK_PACKET)
3sp: 4352, 1024, 4352
=====================================================
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+0x105b/0x1520 net/llc/llc_input.c:208
 __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+0x105b/0x1520 net/llc/llc_input.c:208

CPU: 1 PID: 5474 Comm: syz-executor.0 Not tainted 6.6.0-syzkaller-14500-g1c41041124bd-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
=====================================================


Tested on:

commit:         1c410411 Merge tag 'i3c/for-6.7' of git://git.kernel.o..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=148a49b4e80000
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=16c0649ce80000


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

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
  2023-12-05 18:25 syzbot
                   ` (2 preceding siblings ...)
  2023-12-06  7:08 ` syzbot
@ 2023-12-06  8:13 ` syzbot
  2023-12-06  9:07 ` syzbot
  2023-12-06 10:09 ` syzbot
  5 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06  8:13 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [net?] KMSAN: uninit-value in __llc_lookup_established
Author: eadavis@qq.com

please test uninit-value in __llc_lookup_established

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

diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 7e73f8e5e497..cba149476e41 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -262,7 +262,8 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
  */
 static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
 {
-	if (skb->protocol == htons(ETH_P_802_2))
+	if (skb->protocol == htons(ETH_P_802_2) || 
+	    skb->protocol == htons(ETH_P_TR_802_2))
 		memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
 }
 
@@ -275,7 +276,8 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
  */
 static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
 {
-	if (skb->protocol == htons(ETH_P_802_2))
+	if (skb->protocol == htons(ETH_P_802_2) || 
+	    skb->protocol == htons(ETH_P_TR_802_2))
 		memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
 }
 
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 51bccfb00a9c..ed1a2b59b40c 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -126,7 +126,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
 
 	skb->transport_header += llc_len;
 	skb_pull(skb, llc_len);
-	if (skb->protocol == htons(ETH_P_802_2)) {
+	if (skb->protocol == htons(ETH_P_802_2) || 
+	    skb->protocol == htons(ETH_P_TR_802_2)) {
 		__be16 pdulen;
 		s32 data_size;
 


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

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
       [not found] <tencent_F966ECFECCAC7AC26D7C2C3D6F049664E80A@qq.com>
@ 2023-12-06  8:23 ` syzbot
  0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06  8:23 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

failed to apply patch:
checking file include/net/llc_pdu.h
checking file net/llc/llc_input.c
Hunk #1 FAILED at 126.
1 out of 1 hunk FAILED



Tested on:

commit:         1c410411 Merge tag 'i3c/for-6.7' of git://git.kernel.o..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel config:  https://syzkaller.appspot.com/x/.config?x=956549bd1d1e9efd
dashboard link: https://syzkaller.appspot.com/bug?extid=b5ad66046b913bc04c6f
compiler:       
patch:          https://syzkaller.appspot.com/x/patch.diff?x=10855d1ce80000


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

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
  2023-12-05 18:25 syzbot
                   ` (3 preceding siblings ...)
  2023-12-06  8:13 ` syzbot
@ 2023-12-06  9:07 ` syzbot
  2023-12-06 10:09 ` syzbot
  5 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06  9:07 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [net?] KMSAN: uninit-value in __llc_lookup_established
Author: eadavis@qq.com

please test uninit-value in __llc_lookup_established

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

diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 7e73f8e5e497..cba149476e41 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -262,7 +262,8 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
  */
 static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
 {
-	if (skb->protocol == htons(ETH_P_802_2))
+	if (skb->protocol == htons(ETH_P_802_2) || 
+	    skb->protocol == htons(ETH_P_TR_802_2))
 		memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
 }
 
@@ -275,7 +276,8 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
  */
 static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
 {
-	if (skb->protocol == htons(ETH_P_802_2))
+	if (skb->protocol == htons(ETH_P_802_2) || 
+	    skb->protocol == htons(ETH_P_TR_802_2))
 		memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
 }
 
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 7cac441862e2..f4f24b5d9eea 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -126,7 +126,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
 
 	skb->transport_header += llc_len;
 	skb_pull(skb, llc_len);
-	if (skb->protocol == htons(ETH_P_802_2)) {
+	if (skb->protocol == htons(ETH_P_802_2)
+	    skb->protocol == htons(ETH_P_TR_802_2)) {
 		__be16 pdulen = eth_hdr(skb)->h_proto;
 		s32 data_size = ntohs(pdulen) - llc_len;
 


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

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
       [not found] <tencent_7D2FCFAD8DEEA5D60DCF9236DD9B5DAD9907@qq.com>
@ 2023-12-06  9:24 ` syzbot
  0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06  9:24 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

net/llc/llc_input.c:130:6: error: expected ')'


Tested on:

commit:         1c410411 Merge tag 'i3c/for-6.7' of git://git.kernel.o..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
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=1367debae80000


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

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
  2023-12-05 18:25 syzbot
                   ` (4 preceding siblings ...)
  2023-12-06  9:07 ` syzbot
@ 2023-12-06 10:09 ` syzbot
  5 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06 10:09 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [net?] KMSAN: uninit-value in __llc_lookup_established
Author: eadavis@qq.com

please test uninit-value in __llc_lookup_established

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

diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 7e73f8e5e497..cba149476e41 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -262,7 +262,8 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
  */
 static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
 {
-	if (skb->protocol == htons(ETH_P_802_2))
+	if (skb->protocol == htons(ETH_P_802_2) || 
+	    skb->protocol == htons(ETH_P_TR_802_2))
 		memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
 }
 
@@ -275,7 +276,8 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
  */
 static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
 {
-	if (skb->protocol == htons(ETH_P_802_2))
+	if (skb->protocol == htons(ETH_P_802_2) || 
+	    skb->protocol == htons(ETH_P_TR_802_2))
 		memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
 }
 
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 7cac441862e2..f4f24b5d9eea 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -126,7 +126,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
 
 	skb->transport_header += llc_len;
 	skb_pull(skb, llc_len);
-	if (skb->protocol == htons(ETH_P_802_2)) {
+	if (skb->protocol == htons(ETH_P_802_2) ||
+	    skb->protocol == htons(ETH_P_TR_802_2)) {
 		__be16 pdulen = eth_hdr(skb)->h_proto;
 		s32 data_size = ntohs(pdulen) - llc_len;
 


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

* Re: [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established
       [not found] <tencent_832FC96FC0960CE862ED52CF3079966C4C0A@qq.com>
@ 2023-12-06 10:29 ` syzbot
  0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2023-12-06 10:29 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: uninit-value in llc_rcv

syz-executor.0 uses obsolete (PF_INET,SOCK_PACKET)
=====================================================
BUG: KMSAN: uninit-value in pskb_may_pull_reason include/linux/skbuff.h:2667 [inline]
BUG: KMSAN: uninit-value in pskb_may_pull include/linux/skbuff.h:2681 [inline]
BUG: KMSAN: uninit-value in llc_fixup_skb net/llc/llc_input.c:135 [inline]
BUG: KMSAN: uninit-value in llc_rcv+0x10b9/0x1480 net/llc/llc_input.c:178
 pskb_may_pull_reason include/linux/skbuff.h:2667 [inline]
 pskb_may_pull include/linux/skbuff.h:2681 [inline]
 llc_fixup_skb net/llc/llc_input.c:135 [inline]
 llc_rcv+0x10b9/0x1480 net/llc/llc_input.c:178
 __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

Uninit was created at:
 slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768
 slab_alloc_node mm/slub.c:3478 [inline]
 kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523
 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560
 __alloc_skb+0x318/0x740 net/core/skbuff.c:651
 alloc_skb include/linux/skbuff.h:1286 [inline]
 alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6331
 sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2780
 tun_alloc_skb drivers/net/tun.c:1531 [inline]
 tun_get_user+0x1e8a/0x66d0 drivers/net/tun.c:1846
 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

CPU: 1 PID: 5454 Comm: syz-executor.0 Not tainted 6.6.0-syzkaller-14500-g1c41041124bd-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
=====================================================


Tested on:

commit:         1c410411 Merge tag 'i3c/for-6.7' of git://git.kernel.o..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=111c2586e80000
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=140e7c4ce80000


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

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

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <tencent_EE98A7D746C352F2464689936ED8AEF14C06@qq.com>
2023-12-06  8:01 ` [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established syzbot
     [not found] <tencent_832FC96FC0960CE862ED52CF3079966C4C0A@qq.com>
2023-12-06 10:29 ` syzbot
     [not found] <tencent_7D2FCFAD8DEEA5D60DCF9236DD9B5DAD9907@qq.com>
2023-12-06  9:24 ` syzbot
     [not found] <tencent_F966ECFECCAC7AC26D7C2C3D6F049664E80A@qq.com>
2023-12-06  8:23 ` syzbot
     [not found] <tencent_8F9E041BAF4BC41B1C2558BA38BBE233E808@qq.com>
2023-12-06  1:55 ` syzbot
2023-12-05 18:25 syzbot
2023-12-06  0:53 ` Kuniyuki Iwashima
2023-12-06  1:28   ` syzbot
2023-12-06  1:14 ` syzbot
2023-12-06  7:08 ` syzbot
2023-12-06  8:13 ` syzbot
2023-12-06  9:07 ` syzbot
2023-12-06 10:09 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox