Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7710989rwb; Tue, 6 Dec 2022 08:58:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf528i4Gf871ui4I1zC/1AcmIHdIGuZKdxxSlD0030N3SoFfBqk8rLbQKbRzPWRFbvkh/sqA X-Received: by 2002:a17:906:7244:b0:7ae:2964:72dc with SMTP id n4-20020a170906724400b007ae296472dcmr49940587ejk.111.1670345920042; Tue, 06 Dec 2022 08:58:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670345920; cv=none; d=google.com; s=arc-20160816; b=jGBSCZSZ2/GmkL5wOdcgXdK39saIteLG4lTWmMYZ2jqGbZk0xS4LSkMVSDPakGRRbA xXgTL+2tDsuS0yDsnMmtJ9JOjFkILV8uT4L9qiyi6OsoWSsn/ewljCnr2hWQe3hnNgkY jqxAmzCLtD92+bB35d9B8FF5E378m3uv9bmoXTvjqCgrbibmddGAnwCmIug0gefdRbI8 USuvEiyevtlm1LblT6gZ3BBuYChbsfqIRaBHJP2GLZEIcsMvGuMYLpSQ4ohq+uiax8d/ F0bNfUCnO7gIZqNk+Vyw5M9z51GBLxuGn659pdYn/W4cnZ6NEVMJJR3yXAaQFuhzcZ2a aNCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DKTbnFauBQSq1w24uvDzVUdb+ndoW+9zAbYxO8lWcTE=; b=xWH10H/k0Y7+0a0OqeEkZOT6s5VVQ6jy5CPGF8VWyUIx5aVbrxEkHNWqXI/Z+d5L65 hWdBlR0ns9FPhj/p7wNLe/rwntUIt06atLp1fhpg/JS6bJU7yutLAthk9p4wnBWTlIDS dJDl5RqH1yOUNtZMJ5DQcqZ+v2KbaahnpDJxup5LXjktqU/s38ahwALe9VcfpX6Jl1Bk gkCx1m7bxywMPuoohJzzCw/7E0TsYMkgRWWq/JPsPAPp/eQlWUit7baws2wtuHWPpB71 XQvqdWnVk7QEjp+gaoYlwZMAB0gBE0Fz9ZQQZWSTOwrVTcqxTeiIFPzM4nPo9ieTCbc8 9HIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=M9aQ+y4e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr5-20020a170907720500b00783160b16a1si14941223ejc.397.2022.12.06.08.58.21; Tue, 06 Dec 2022 08:58:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=M9aQ+y4e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235583AbiLFQhd (ORCPT + 77 others); Tue, 6 Dec 2022 11:37:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235626AbiLFQhJ (ORCPT ); Tue, 6 Dec 2022 11:37:09 -0500 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE6C2FC34 for ; Tue, 6 Dec 2022 08:36:01 -0800 (PST) Received: by mail-yb1-xb35.google.com with SMTP id i186so7117709ybc.9 for ; Tue, 06 Dec 2022 08:36:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DKTbnFauBQSq1w24uvDzVUdb+ndoW+9zAbYxO8lWcTE=; b=M9aQ+y4eDXXcRdNdGyXp3iY7CVYirhqmxy7pKTAhXywDRlsMaI2LW7EJosQFwsgfzQ gC2cz3W2SGPyWZqcC48bDwyFYzp2cLUyzTTZr09BXOxxatqR5o4ZsbPd3HeM1U+XRyXu z4+1wMyPV+KNCVTZmwtGwwxOLN2JaQi4y+YncHzrrmA5DxQ1FgKMGvpr/vOKgT4MCavm wZ9pjy9J1WjTl7FKMXIzrA1BcO7BwDOp1TIR9W+BtvsY4NxX2drTl51Y4eYFRCguuy82 IEtFQoxonRCXcYK2BJXnzrcT3WtGBuzMWlvl8couqSxhqiwmnVtbl3OhWItuDTxrJQib 5ROg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DKTbnFauBQSq1w24uvDzVUdb+ndoW+9zAbYxO8lWcTE=; b=DWiT90JFdZUceoAd4D6Vo+lFNdFYnURFOH0juJ0/Qr5m3di9mJ9WgPwBA5nFQZYecR O9sBw1CEd0AUkS1Xr3s+IX91SApDaXkHqAx9cEyV+uFhuG7PxqWfSucDxgoYDtZAVTYa +mBRQXLJoBEnGow+sW7/TxKFnQofjRVBY4DsA24L/ZN5Lpt5QZIK/QcyMLiqWTPQ7OPF CMJqENGcVoKThhdt6s1bBxILgWTvkQLDU3I3zRLYO5uP3LhHfu+52HwVa6qcdBlrG6+V FDOPQffrza/AqaaAOZMdYBHA886sMScl59vInNS/GFBthK6TaJVlAw/cvYIxAR7wZb6z wGNA== X-Gm-Message-State: ANoB5pl4S2LvJZsXuRhG8jL8AY9qbaI/gw3dJ/+75h2Z4C9Y8GC3woPd GX0gbifewdsM6PG4OQhTbPN8P4BtSKnzDtNoQpKOnA== X-Received: by 2002:a25:d655:0:b0:6fc:1c96:c9fe with SMTP id n82-20020a25d655000000b006fc1c96c9femr23163963ybg.36.1670344560743; Tue, 06 Dec 2022 08:36:00 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Eric Dumazet Date: Tue, 6 Dec 2022 17:35:49 +0100 Message-ID: Subject: Re: BUG: unable to handle kernel paging request in can_rcv_filter To: Wei Chen Cc: socketcan@hartkopp.net, mkl@pengutronix.de, "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Abeni , syzkaller-bugs@googlegroups.com, syzbot Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 6, 2022 at 4:26 PM Wei Chen 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+2d7f58292cb5b29eb5ad@syzkaller.appspotmail.com > > 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 > > 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: > > 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 > > > __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 > > 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