* 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: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-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
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: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-05 18:25 [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established 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
2023-12-05 18:25 [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established 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
2023-12-05 18:25 [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established 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
2023-12-05 18:25 [syzbot] [net?] KMSAN: uninit-value in __llc_lookup_established 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