From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09859C5B552 for ; Mon, 9 Jun 2025 08:35:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 99C4F6B0098; Mon, 9 Jun 2025 04:35:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 973B36B0099; Mon, 9 Jun 2025 04:35:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B12B6B009A; Mon, 9 Jun 2025 04:35:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6F4D06B0098 for ; Mon, 9 Jun 2025 04:35:41 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 198131614AF for ; Mon, 9 Jun 2025 08:35:41 +0000 (UTC) X-FDA: 83535203682.17.8B3B383 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by imf23.hostedemail.com (Postfix) with ESMTP id 1CBC2140002 for ; Mon, 9 Jun 2025 08:35:38 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=XNKGDEXz; spf=pass (imf23.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.43 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749458139; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cvLItu/HN16OmhCmeDXPcs+GyozsakyZwX/mIV9qLzE=; b=nxYjQ0zPAT3Y5yzWDd+kELbK+eS41+QCrQj6DjFM0z9lcheRzkLDvxDui9H9leZNWeFfWC 2IkgKZe5SqqE+faTHV2f+cotrV1DemaTzPVtGzHoKAl9ZwNYu08WlqKp5FILCKDl/uw3pJ ltRCVhtAA6yxfijRiKj9r1FuyH0XaQ4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=XNKGDEXz; spf=pass (imf23.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.43 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749458139; a=rsa-sha256; cv=none; b=QD0MaTweVOrX22fjLAuOdT8t0rmo7f3pDM+v4BaYOoq+lZL8xqWl9eUfZC1nZsrfJ6lkKQ JklOPVgo3yA3ExtmUkwQ+pUJyUUdCLkkq3t7FI9fzpf8Og7oTCIkUPuvSG2Q4FixhlAB/6 j7wD1xObQgr8fiDG9KzCa8qH9Qc4Shk= Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-54998f865b8so3856182e87.3 for ; Mon, 09 Jun 2025 01:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749458137; x=1750062937; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=cvLItu/HN16OmhCmeDXPcs+GyozsakyZwX/mIV9qLzE=; b=XNKGDEXzpmszrQzsxklEU9M8zvgYGy/GqTJmlVOEHKCajhiji8a5MSAsa0cXY+Ejmv pgDa2gonAUnO3cn4xuc3xy0C10oxT4C6kt8MkAm7eujCT80FWBH0oukNDXxQ3BPXskxr igtUAm4xcxH4Doyw2XPKHRiyn0CcRbQ/oN4VsngFRT6MyXONoKFJm1cF5KNhF4oHEKeb ogww9L8SS4cMJRqEHzSz3KLHhSFYSmbSpoHrNjqSe/KkgF26YRTRiionefVgos7dLjIZ 4Kpw1AoyXHgdH//51DWWZSzrQoTAD7VXFvcFlFQpX3jJveBq4vWTM4X1U38hv6S+juj9 r2+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749458137; x=1750062937; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cvLItu/HN16OmhCmeDXPcs+GyozsakyZwX/mIV9qLzE=; b=TJiROW0Y++a9r9kJpHLbyop36lXiqkdV8Eo6YPXPBJaB4DjQHoA2ryUCojwCJK0rkC QGrlDsfdWHLaFm1fgrMCdRP4rPhtJQ7U37Mxg28stbRfA0sIDL8NVjTgSN8GNEGyPhea L/mU9edlMrUpVqsRzQ32/NN5Akpnz3Zt1Pv9JQxgQMhU7BPHtDHOUfOKDwCm+HrWbxbj CGPoJ8Vbibpo56ajEXArZYwK8IehgtyuM5J4eXNy+04ZpoYRPR20vUC1+hfK8LY3s4SQ Yb8JugvLurgP9pMG9cFRgEcglTNXPmIAlK/7CbnIvRKncMjpszuVyzx39V1Ew7TnljT3 Rcgw== X-Forwarded-Encrypted: i=1; AJvYcCWQ7tShSqzUgcgzTSeJLPAnQH186BsR0mjQZzVvt/FX//kE8/LWfv3zmb4yiiHuiwnSW+NRBmBy9g==@kvack.org X-Gm-Message-State: AOJu0Yzthp7QwULZWyjoTp+MD0/d3h7R3m7leWcFBcLTgLDyPcEoWSD3 VcvqBjS/mJam5vri8cZuBG3HGTPyJsP3DI3ja85UJI9ycXBaniXxFH0D X-Gm-Gg: ASbGncutsAP9hYl7B2zDXsOAhKCG1hRP/uUoTsOz3czdqMs9msbymamHcJnFjSLnpL3 UgiKxFjYPHxIui3INEwrAeJZHBpy+JJhtYXMzuWtARf02QxpbmvfGuw8qrNX/QYNh2EeyiSwECr BvELZZy/1uMEGTdk/u2Js6LyXBp6t8y8F7rVY5BwsSeUak/XVDEvdKMd5nHVaMg01P1/6znnaoL J4FGTlF3DIH4FgwvobnJi9KOEzvyK/4H71VimPYfg6g+CEBMC1oIZD9KytKpruFnPclP1AbF/++ f7H6xJoZtY5nbLDY0xHo+ExF3VVM2W8h/2UoZes= X-Google-Smtp-Source: AGHT+IH83g0g5KOdIh+DOMRgYfTX58Wy6XYREYf5FT1ympEvV1siDhuPiiGn7oIc311L5D9GAuWq9w== X-Received: by 2002:ac2:4184:0:b0:553:64ac:4670 with SMTP id 2adb3069b0e04-55366c3596cmr2570205e87.54.1749458136968; Mon, 09 Jun 2025 01:35:36 -0700 (PDT) Received: from pc636 ([2001:9b1:d5a0:a500::800]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553677316bfsm1035468e87.209.2025.06.09.01.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 01:35:36 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 9 Jun 2025 10:35:34 +0200 To: "Paul E. McKenney" Cc: Uladzislau Rezki , Kent Overstreet , syzbot , akpm@linux-foundation.org, josh@joshtriplett.org, linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, rcu@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [rcu?] [bcachefs?] BUG: unable to handle kernel NULL pointer dereference in rcu_core (3) Message-ID: References: <67a2b20a.050a0220.50516.0003.GAE@google.com> <9694d40a-072e-47c2-a950-3b258bbe04f5@paulmck-laptop> <602bb1be-f4a4-4194-803f-856e95711870@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <602bb1be-f4a4-4194-803f-856e95711870@paulmck-laptop> X-Rspamd-Que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i3Jp+ZTIKvadhEljUvEGXvW X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sun, Jun 08, 2025 at 05:25:05PM -0700, Paul E. McKenney wrote: > On Sun, Jun 08, 2025 at 08:23:36PM +0200, Uladzislau Rezki wrote: > > On Sun, Jun 08, 2025 at 11:26:28AM -0400, Kent Overstreet wrote: > > > On Wed, Feb 05, 2025 at 06:56:19AM -0800, Paul E. McKenney wrote: > > > > On Tue, Feb 04, 2025 at 04:34:18PM -0800, syzbot wrote: > > > > > Hello, > > > > > > > > > > syzbot found the following issue on: > > > > > > > > > > HEAD commit: 0de63bb7d919 Merge tag 'pull-fix' of git://git.kernel.org/.. > > > > > git tree: upstream > > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=10faf5f8580000 > > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=1909f2f0d8e641ce > > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=80e5d6f453f14a53383a > > > > > 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=16b69d18580000 > > > > > > > > > > Downloadable assets: > > > > > disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-0de63bb7.raw.xz > > > > > vmlinux: https://storage.googleapis.com/syzbot-assets/1142009a30a7/vmlinux-0de63bb7.xz > > > > > kernel image: https://storage.googleapis.com/syzbot-assets/5d9e46a8998d/bzImage-0de63bb7.xz > > > > > mounted in repro: https://storage.googleapis.com/syzbot-assets/526692501242/mount_0.gz > > > > > > > > > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > > > > > Reported-by: syzbot+80e5d6f453f14a53383a@syzkaller.appspotmail.com > > > > > > > > > > slab radix_tree_node start ffff88803bf382c0 pointer offset 24 size 576 > > > > > BUG: kernel NULL pointer dereference, address: 0000000000000000 > > > > > #PF: supervisor instruction fetch in kernel mode > > > > > #PF: error_code(0x0010) - not-present page > > > > > PGD 0 P4D 0 > > > > > Oops: Oops: 0010 [#1] PREEMPT SMP KASAN NOPTI > > > > > CPU: 0 UID: 0 PID: 5705 Comm: syz-executor Not tainted 6.14.0-rc1-syzkaller-00020-g0de63bb7d919 #0 > > > > > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 > > > > > RIP: 0010:0x0 > > > > > Code: Unable to access opcode bytes at 0xffffffffffffffd6. > > > > > RSP: 0018:ffffc90000007bd8 EFLAGS: 00010246 > > > > > RAX: dffffc0000000000 RBX: 1ffff110077e705c RCX: 23438dd059a4b100 > > > > > RDX: 0000000000000100 RSI: 0000000000000000 RDI: ffff88803bf382d8 > > > > > RBP: ffffc90000007e10 R08: ffffffff819f146c R09: 1ffff11003f8519a > > > > > R10: dffffc0000000000 R11: 0000000000000000 R12: ffffffff81a6d507 > > > > > R13: ffff88803bf382e0 R14: 0000000000000000 R15: ffff88803bf382d8 > > > > > FS: 0000555567992500(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000 > > > > > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > > > > > CR2: ffffffffffffffd6 CR3: 000000004da38000 CR4: 0000000000352ef0 > > > > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > > > > > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > > > > > Call Trace: > > > > > > > > > > rcu_do_batch kernel/rcu/tree.c:2546 [inline] > > > > > > > > The usual way that this happens is that someone clobbers the rcu_head > > > > structure of something that has been passed to call_rcu(). The most > > > > popular way of clobbering this structure is to pass the same something to > > > > call_rcu() twice in a row, but other creative arrangements are possible. > > > > > > > > Building your kernel with CONFIG_DEBUG_OBJECTS_RCU_HEAD=y can usually > > > > spot invoking call_rcu() twice in a row. > > > > > > I don't think it's that - syzbot's .config already has that enabled. > > > KASAN, too. > > > > > > And the only place we do call_rcu() is from rcu_pending.c, where we've > > > got a rearming rcu callback - but we track whether it's outstanding, and > > > we do all relevant operations with a lock held. > > > > > > And we only use rcu_pending.c with SRCU, not regular RCU. > > > > > > We do use kfree_rcu() in a few places (all boring, I expect), but that > > > doesn't (generally?) use the rcu callback list. > > > > > Right, kvfree_rcu() does not intersect with regular callbacks, it has > > its own path. > > > > It looks like the problem is here: > > > > > > f = rhp->func; > > debug_rcu_head_callback(rhp); > > WRITE_ONCE(rhp->func, (rcu_callback_t)0L); > > f(rhp); > > > > > > we do not check if callback, "f", is a NULL. If it is, the kernel bug > > is triggered right away. For example: > > > > call_rcu(&rh, NULL); > > > > @Paul, do you think it makes sense to narrow callers which apparently > > pass NULL as a callback? To me it seems the case of this bug. But we > > do not know the source. > > > > It would give at least a stack-trace of caller which passes a NULL. > > Adding a check for NULL func passed to __call_rcu_common(), you mean? > Yes. Currently there is no any check. So passing a NULL just triggers kernel panic. > > That wouldn't hurt, and would either (as you say) catch the culprit > or show that the problem is elsewhere. > I can add it then and send out the patch if no objections. -- Uladzislau Rezki