BUG: unable to handle kernel paging request in can_rcv_filter

18 views
Skip to first unread message

Wei Chen

unread,
Dec 6, 2022, 10:26:14ā€ÆAM12/6/22
to sock...@hartkopp.net, m...@pengutronix.de, David S. Miller, Eric Dumazet, Jakub Kicinski, net...@vger.kernel.org, linu...@vger.kernel.org, linux-...@vger.kernel.org, Paolo Abeni, syzkall...@googlegroups.com, syzbot
Dear Linux Developers,

Recently, when using our tool to fuzz kernel, the following crash was triggered.

HEAD commit: 147307c69ba
git tree: linux-next
compiler: clang 12.0.0
console output:
https://drive.google.com/file/d/1_c7TZ6WzCT-VLBimUP3xnkMpJPhjOAPY/view?usp=share_link
kernel config: https://drive.google.com/file/d/1NAf4S43d9VOKD52xbrqw-PUP1Mbj8z-S/view?usp=share_link

Unfortunately, I didn't have a reproducer for this crash.

I'm wondering if there is a data race between can_receive and
sock_close, which leads to the invalid null value of dev and
dev_rcv_lists. I hope the following report is helpful.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: Wei Chen <harperc...@gmail.com>

BUG: unable to handle page fault for address: 0000000000006020
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 132110067 P4D 132110067 PUD 1320b6067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
CPU: 0 PID: 13844 Comm: syz-executor.0 Not tainted 6.1.0-rc5-next-20221118 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.13.0-48-gd9c812dda519-prebuilt.qemu.org 04/01/2014
RIP: 0010:can_rcv_filter+0x44/0x4e0 net/can/af_can.c:584
Code: 00 00 00 e8 3e 86 0f fd 49 8b 9e d8 00 00 00 48 89 df e8 af 81
0f fd 44 8b 23 48 8d bd 20 60 00 00 e8 a0 81 0f fd 48 89 2c 24 <8b> 9d
20 60 00 00 45 31 ed 31 ff 89 de e8 9a 1c fc fc 85 db 0f 84
RSP: 0018:ffffc90000003d50 EFLAGS: 00010246
RAX: ffff88813bc274d8 RBX: ffff8881310c5a10 RCX: ffffffff842b9940
RDX: 0000000000000522 RSI: 0000000000000000 RDI: 0000000000006020
RBP: 0000000000000000 R08: 0000000000006023 R09: 0000000000000000
R10: 0001ffffffffffff R11: 00018881310c5a04 R12: 0000000000000000
R13: ffff888106fb8880 R14: ffff8881308cba00 R15: 0000000000000000
FS: 00007fc9368b0700(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000006020 CR3: 0000000132249000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000020000180 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Call Trace:
<IRQ>
can_receive+0x182/0x1f0 net/can/af_can.c:664
canfd_rcv+0x9a/0x120 net/can/af_can.c:703
__netif_receive_skb_one_core net/core/dev.c:5482 [inline]
__netif_receive_skb+0x8b/0x1b0 net/core/dev.c:5596
process_backlog+0x23f/0x3b0 net/core/dev.c:5924
__napi_poll+0x65/0x420 net/core/dev.c:6485
napi_poll net/core/dev.c:6552 [inline]
net_rx_action+0x37e/0x730 net/core/dev.c:6663
__do_softirq+0xf2/0x2c9 kernel/softirq.c:571
do_softirq+0xb1/0xf0 kernel/softirq.c:472
</IRQ>
<TASK>
__local_bh_enable_ip+0x6f/0x80 kernel/softirq.c:396
local_bh_enable+0x1b/0x20 include/linux/bottom_half.h:33
netif_rx+0x63/0x1c0 net/core/dev.c:5003
can_send+0x521/0x5b0 net/can/af_can.c:286
bcm_can_tx+0x2f0/0x3f0 net/can/bcm.c:302
bcm_tx_setup net/can/bcm.c:1020 [inline]
bcm_sendmsg+0x1f78/0x2c50 net/can/bcm.c:1351
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg net/socket.c:734 [inline]
____sys_sendmsg+0x38f/0x500 net/socket.c:2476
___sys_sendmsg net/socket.c:2530 [inline]
__sys_sendmsg+0x197/0x230 net/socket.c:2559
__do_sys_sendmsg net/socket.c:2568 [inline]
__se_sys_sendmsg net/socket.c:2566 [inline]
__x64_sys_sendmsg+0x42/0x50 net/socket.c:2566
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x4697f9
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fc9368afc48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000077bf80 RCX: 00000000004697f9
RDX: 0000000000000000 RSI: 0000000020000380 RDI: 0000000000000006
RBP: 00000000004d29e9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000077bf80
R13: 0000000000000000 R14: 000000000077bf80 R15: 00007ffe26483e60
</TASK>
Modules linked in:
CR2: 0000000000006020
---[ end trace 0000000000000000 ]---
RIP: 0010:can_rcv_filter+0x44/0x4e0 net/can/af_can.c:584
Code: 00 00 00 e8 3e 86 0f fd 49 8b 9e d8 00 00 00 48 89 df e8 af 81
0f fd 44 8b 23 48 8d bd 20 60 00 00 e8 a0 81 0f fd 48 89 2c 24 <8b> 9d
20 60 00 00 45 31 ed 31 ff 89 de e8 9a 1c fc fc 85 db 0f 84
RSP: 0018:ffffc90000003d50 EFLAGS: 00010246
RAX: ffff88813bc274d8 RBX: ffff8881310c5a10 RCX: ffffffff842b9940
RDX: 0000000000000522 RSI: 0000000000000000 RDI: 0000000000006020
RBP: 0000000000000000 R08: 0000000000006023 R09: 0000000000000000
R10: 0001ffffffffffff R11: 00018881310c5a04 R12: 0000000000000000
R13: ffff888106fb8880 R14: ffff8881308cba00 R15: 0000000000000000
FS: 00007fc9368b0700(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000006020 CR3: 0000000132249000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000020000180 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
----------------
Code disassembly (best guess):
0: 00 00 add %al,(%rax)
2: 00 e8 add %ch,%al
4: 3e 86 0f xchg %cl,%ds:(%rdi)
7: fd std
8: 49 8b 9e d8 00 00 00 mov 0xd8(%r14),%rbx
f: 48 89 df mov %rbx,%rdi
12: e8 af 81 0f fd callq 0xfd0f81c6
17: 44 8b 23 mov (%rbx),%r12d
1a: 48 8d bd 20 60 00 00 lea 0x6020(%rbp),%rdi
21: e8 a0 81 0f fd callq 0xfd0f81c6
26: 48 89 2c 24 mov %rbp,(%rsp)
* 2a: 8b 9d 20 60 00 00 mov 0x6020(%rbp),%ebx <-- trapping instruction
30: 45 31 ed xor %r13d,%r13d
33: 31 ff xor %edi,%edi
35: 89 de mov %ebx,%esi
37: e8 9a 1c fc fc callq 0xfcfc1cd6
3c: 85 db test %ebx,%ebx
3e: 0f .byte 0xf
3f: 84 .byte 0x84

Best,
Wei

syzbot

unread,
Dec 6, 2022, 11:34:37ā€ÆAM12/6/22
to da...@davemloft.net, edum...@google.com, ku...@kernel.org, linu...@vger.kernel.org, linux-...@vger.kernel.org, m...@pengutronix.de, net...@vger.kernel.org, pab...@redhat.com, sock...@hartkopp.net, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e3cb714fb489 Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=16e55ae3880000
kernel config: https://syzkaller.appspot.com/x/.config?x=ec7118319bfb771e
dashboard link: https://syzkaller.appspot.com/bug?extid=2d7f58292cb5b29eb5ad
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1164b38d880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11f61223880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/832eb1866f2c/disk-e3cb714f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5fd572b7d96d/vmlinux-e3cb714f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/34c82908beda/Image-e3cb714f.gz.xz

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

syz-executor414 uses obsolete (PF_INET,SOCK_PACKET)
Unable to handle kernel paging request at virtual address 0000000000006020
Mem abort info:
ESR = 0x0000000096000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=0000000109d9e000
[0000000000006020] pgd=080000010bb80003, p4d=080000010bb80003, pud=080000010ba1f003, pmd=0000000000000000
Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 3072 Comm: syz-executor414 Not tainted 6.1.0-rc7-syzkaller-33097-ge3cb714fb489 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : can_rcv_filter+0x30/0x30c net/can/af_can.c:584
lr : can_rcv_filter+0x28/0x30c net/can/af_can.c:578
sp : ffff80000f77b970
x29: ffff80000f77b970 x28: ffff0000c9f2cc80 x27: ffff80000f77bcd0
x26: 0000000000000000 x25: ffff0000c9585300 x24: 0000000000000001
x23: ffff0000c7be3680 x22: 0000000000000000 x21: 0000000000000000
x20: ffff0000c9f2c000 x19: ffff0000c9585300 x18: 0000000000000000
x17: 0000000000000000 x16: ffff80000dbe6158 x15: ffff0000c7c98000
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c7c98000
x11: ff8080000b96c6ac x10: 0000000000000000 x9 : 0000000000006020
x8 : ffff0000c7ab2240 x7 : ffff80000b96c9a0 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000002
x2 : 0000000000000008 x1 : ffff0000c9585300 x0 : 0000000000000000
Call trace:
can_rcv_filter+0x30/0x30c
can_receive+0x194/0x26c net/can/af_can.c:664
canfd_rcv+0x7c/0xf8 net/can/af_can.c:703
__netif_receive_skb_one_core net/core/dev.c:5489 [inline]
__netif_receive_skb+0x70/0x14c net/core/dev.c:5603
netif_receive_skb_internal+0xb4/0x258 net/core/dev.c:5689
netif_receive_skb+0x28/0x44 net/core/dev.c:5748
tun_rx_batched+0x1e0/0x220
tun_get_user+0xf94/0x1148 drivers/net/tun.c:2004
tun_chr_write_iter+0xa4/0x144 drivers/net/tun.c:2034
call_write_iter include/linux/fs.h:2199 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x2dc/0x46c fs/read_write.c:584
ksys_write+0xb4/0x160 fs/read_write.c:637
__do_sys_write fs/read_write.c:649 [inline]
__se_sys_write fs/read_write.c:646 [inline]
__arm64_sys_write+0x24/0x34 fs/read_write.c:646
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x140 arch/arm64/kernel/syscall.c:197
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:584
Code: aa0003f6 9724e4b5 f9406e68 528c0409 (b8696ad4)
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
0: aa0003f6 mov x22, x0
4: 9724e4b5 bl 0xfffffffffc9392d8
8: f9406e68 ldr x8, [x19, #216]
c: 528c0409 mov w9, #0x6020 // #24608
* 10: b8696ad4 ldr w20, [x22, x9] <-- trapping instruction


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

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Eric Dumazet

unread,
Dec 6, 2022, 11:36:03ā€ÆAM12/6/22
to Wei Chen, sock...@hartkopp.net, m...@pengutronix.de, David S. Miller, Jakub Kicinski, net...@vger.kernel.org, linu...@vger.kernel.org, linux-...@vger.kernel.org, Paolo Abeni, syzkall...@googlegroups.com, syzbot
On Tue, Dec 6, 2022 at 4:26 PM Wei Chen <harperc...@gmail.com> wrote:
>
> Dear Linux Developers,
>
> Recently, when using our tool to fuzz kernel, the following crash was triggered.
>
> HEAD commit: 147307c69ba
> git tree: linux-next
> compiler: clang 12.0.0
> console output:
> https://drive.google.com/file/d/1_c7TZ6WzCT-VLBimUP3xnkMpJPhjOAPY/view?usp=share_link
> kernel config: https://drive.google.com/file/d/1NAf4S43d9VOKD52xbrqw-PUP1Mbj8z-S/view?usp=share_link
>
> Unfortunately, I didn't have a reproducer for this crash.

Well, public syzbot instance has something better, with a repro....

syzbot found the following issue on:

HEAD commit: e3cb714fb489 Merge branch 'for-next/core' into for-kernelci
git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=16e55ae3880000
kernel config: https://syzkaller.appspot.com/x/.config?x=ec7118319bfb771e
dashboard link: https://syzkaller.appspot.com/bug?extid=2d7f58292cb5b29eb5ad
compiler: Debian clang version
13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld
(GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1164b38d880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11f61223880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/832eb1866f2c/disk-e3cb714f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5fd572b7d96d/vmlinux-e3cb714f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/34c82908beda/Image-e3cb714f.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2d7f58...@syzkaller.appspotmail.com
Reply all
Reply to author
Forward
0 new messages