* [syzbot] [net?] [can?] KMSAN: uninit-value in em_canid_match
@ 2025-11-25 19:50 syzbot
2025-11-25 20:41 ` shaurya
0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2025-11-25 19:50 UTC (permalink / raw)
To: davem, edumazet, horms, jhs, jiri, kuba, linux-can, linux-kernel,
mkl, netdev, pabeni, socketcan, syzkaller-bugs, xiyou.wangcong
Hello,
syzbot found the following issue on:
HEAD commit: ac3fd01e4c1e Linux 6.18-rc7
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1703e612580000
kernel config: https://syzkaller.appspot.com/x/.config?x=61a9bf3cc5d17a01
dashboard link: https://syzkaller.appspot.com/bug?extid=5d8269a1e099279152bc
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12040e58580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=117d797c580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/227434a45737/disk-ac3fd01e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d8117003dbb5/vmlinux-ac3fd01e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a13125fb7a7d/bzImage-ac3fd01e.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5d8269a1e099279152bc@syzkaller.appspotmail.com
syzkaller0: entered promiscuous mode
syzkaller0: entered allmulticast mode
=====================================================
BUG: KMSAN: uninit-value in em_canid_match+0x2f0/0x360 net/sched/em_canid.c:104
em_canid_match+0x2f0/0x360 net/sched/em_canid.c:104
tcf_em_match net/sched/ematch.c:494 [inline]
__tcf_em_tree_match+0x215/0xc70 net/sched/ematch.c:520
tcf_em_tree_match include/net/pkt_cls.h:512 [inline]
basic_classify+0x154/0x480 net/sched/cls_basic.c:50
tc_classify include/net/tc_wrapper.h:197 [inline]
__tcf_classify net/sched/cls_api.c:1764 [inline]
tcf_classify+0x855/0x1cb0 net/sched/cls_api.c:1860
multiq_classify net/sched/sch_multiq.c:39 [inline]
multiq_enqueue+0x82/0x590 net/sched/sch_multiq.c:66
dev_qdisc_enqueue net/core/dev.c:4118 [inline]
__dev_xmit_skb net/core/dev.c:4214 [inline]
__dev_queue_xmit+0x1d91/0x5e60 net/core/dev.c:4729
dev_queue_xmit include/linux/netdevice.h:3365 [inline]
packet_xmit+0x8f/0x710 net/packet/af_packet.c:275
packet_snd net/packet/af_packet.c:3076 [inline]
packet_sendmsg+0x9173/0xa2a0 net/packet/af_packet.c:3108
sock_sendmsg_nosec net/socket.c:727 [inline]
__sock_sendmsg+0x333/0x3d0 net/socket.c:742
____sys_sendmsg+0x7e0/0xd80 net/socket.c:2630
___sys_sendmsg+0x271/0x3b0 net/socket.c:2684
__sys_sendmsg net/socket.c:2716 [inline]
__do_sys_sendmsg net/socket.c:2721 [inline]
__se_sys_sendmsg net/socket.c:2719 [inline]
__x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2719
x64_sys_call+0x1dfd/0x3e30 arch/x86/include/generated/asm/syscalls_64.h:47
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0xfa0 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:4985 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
kmem_cache_alloc_node_noprof+0x989/0x16b0 mm/slub.c:5340
kmalloc_reserve+0x13c/0x4b0 net/core/skbuff.c:579
__alloc_skb+0x347/0x7d0 net/core/skbuff.c:670
alloc_skb include/linux/skbuff.h:1383 [inline]
alloc_skb_with_frags+0xc5/0xa60 net/core/skbuff.c:6671
sock_alloc_send_pskb+0xacc/0xc60 net/core/sock.c:2965
packet_alloc_skb net/packet/af_packet.c:2926 [inline]
packet_snd net/packet/af_packet.c:3019 [inline]
packet_sendmsg+0x743d/0xa2a0 net/packet/af_packet.c:3108
sock_sendmsg_nosec net/socket.c:727 [inline]
__sock_sendmsg+0x333/0x3d0 net/socket.c:742
____sys_sendmsg+0x7e0/0xd80 net/socket.c:2630
___sys_sendmsg+0x271/0x3b0 net/socket.c:2684
__sys_sendmsg net/socket.c:2716 [inline]
__do_sys_sendmsg net/socket.c:2721 [inline]
__se_sys_sendmsg net/socket.c:2719 [inline]
__x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2719
x64_sys_call+0x1dfd/0x3e30 arch/x86/include/generated/asm/syscalls_64.h:47
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
CPU: 0 UID: 0 PID: 6067 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(none)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/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] 3+ messages in thread
* Re: [syzbot] [net?] [can?] KMSAN: uninit-value in em_canid_match
2025-11-25 19:50 [syzbot] [net?] [can?] KMSAN: uninit-value in em_canid_match syzbot
@ 2025-11-25 20:41 ` shaurya
2025-11-25 21:57 ` syzbot
0 siblings, 1 reply; 3+ messages in thread
From: shaurya @ 2025-11-25 20:41 UTC (permalink / raw)
To: syzbot+5d8269a1e099279152bc
Cc: linux-can, linux-kernel, netdev, syzkaller-bugs
[-- Attachment #1: Type: text/plain, Size: 83 bytes --]
#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
[-- Attachment #2: 0001-net-sched-em_canid-add-length-check-before-reading-C.patch --]
[-- Type: text/x-patch, Size: 1229 bytes --]
From 137086f25c8aa52e4222355345e4218e410188c5 Mon Sep 17 00:00:00 2001
From: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Date: Wed, 26 Nov 2025 02:06:51 +0530
Subject: [PATCH] net/sched: em_canid: add length check before reading CAN ID
Add a check to verify that the skb has at least sizeof(canid_t) bytes
before reading the CAN ID from skb->data. This prevents reading
uninitialized memory when processing malformed packets that don't
contain a valid CAN frame.
Reported-by: syzbot+5d8269a1e099279152bc@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=5d8269a1e099279152bc
Fixes: f057bbb6f9ed ("net: em_canid: Ematch rule to match CAN frames according to their identifiers")
Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
---
net/sched/em_canid.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/em_canid.c b/net/sched/em_canid.c
index 5337bc462755..a9b6cab70ff1 100644
--- a/net/sched/em_canid.c
+++ b/net/sched/em_canid.c
@@ -99,6 +99,9 @@ static int em_canid_match(struct sk_buff *skb, struct tcf_ematch *m,
int i;
const struct can_filter *lp;
+ if (skb->len < sizeof(canid_t))
+ return 0;
+
can_id = em_canid_get_id(skb);
if (can_id & CAN_EFF_FLAG) {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [syzbot] [net?] [can?] KMSAN: uninit-value in em_canid_match
2025-11-25 20:41 ` shaurya
@ 2025-11-25 21:57 ` syzbot
0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2025-11-25 21:57 UTC (permalink / raw)
To: linux-can, linux-kernel, netdev, ssranevjti, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+5d8269a1e099279152bc@syzkaller.appspotmail.com
Tested-by: syzbot+5d8269a1e099279152bc@syzkaller.appspotmail.com
Tested on:
commit: 30f09200 Merge tag 'arm64-fixes' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13236e92580000
kernel config: https://syzkaller.appspot.com/x/.config?x=61a9bf3cc5d17a01
dashboard link: https://syzkaller.appspot.com/bug?extid=5d8269a1e099279152bc
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch: https://syzkaller.appspot.com/x/patch.diff?x=1230257c580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-25 21:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 19:50 [syzbot] [net?] [can?] KMSAN: uninit-value in em_canid_match syzbot
2025-11-25 20:41 ` shaurya
2025-11-25 21:57 ` 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).