NetBSD Problem Report #56950
From www@netbsd.org Wed Aug 3 09:28:15 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 3999D1A921F
for <gnats-bugs@gnats.NetBSD.org>; Wed, 3 Aug 2022 09:28:15 +0000 (UTC)
Message-Id: <20220803092743.77BE31A9239@mollari.NetBSD.org>
Date: Wed, 3 Aug 2022 09:27:43 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: Race in vnode klist destruction?
X-Send-Pr-Version: www-1.0
>Number: 56950
>Category: kern
>Synopsis: Race in vnode klist destruction?
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: thorpej
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 03 09:30:00 +0000 2022
>Closed-Date: Sun Aug 20 06:57:04 +0000 2023
>Last-Modified: Sun Aug 20 06:57:04 +0000 2023
>Originator: Taylor R Campbell
>Release: current
>Organization:
La Fundacion NetBSD
>Environment:
hot like a greenhouse
>Description:
[ 158.8702193] panic: ASan: Unauthorized Access In 0xffffffff81ca635a: Addr 0xffffb1001400b418 [8 bytes, read, PoolUseAfterFree]
[ 158.8896562] cpu0: Begin traceback...
[ 158.9002072] vpanic() at netbsd:vpanic+0x282 sys/kern/subr_prf.c:293
[ 158.9402085] panic() at netbsd:panic+0x9e sys/kern/subr_prf.c:1043
[ 158.9702073] kasan_report() at netbsd:kasan_report+0x8f kasan_code_name sys/kern/subr_asan.c:168 [inline]
[ 158.9702073] kasan_report() at netbsd:kasan_report+0x8f sys/kern/subr_asan.c:200
[ 159.0002068] __asan_load8() at netbsd:__asan_load8+0xac kasan_shadow_8byte_isvalid sys/kern/subr_asan.c:370 [inline]
[ 159.0002068] __asan_load8() at netbsd:__asan_load8+0xac kasan_shadow_check sys/kern/subr_asan.c:420 [inline]
[ 159.0002068] __asan_load8() at netbsd:__asan_load8+0xac sys/kern/subr_asan.c:1207
[ 159.0302067] vcache_reclaim() at netbsd:vcache_reclaim+0x52b sys/kern/vfs_vnode.c:1923
[ 159.0702091] vrelel() at netbsd:vrelel+0x67a sys/kern/vfs_vnode.c:985
[ 159.1002077] vrele() at netbsd:vrele+0x51 sys/kern/vfs_vnode.c:1038
[ 159.1202065] layer_remove() at netbsd:layer_remove+0xa4 sys/miscfs/genfs/layer_vnops.c:631
[ 159.1502067] VOP_REMOVE() at netbsd:VOP_REMOVE+0x27c sys/kern/vnode_if.c:1219
[ 159.1802070] do_sys_unlinkat() at netbsd:do_sys_unlinkat+0x5b5 sys/kern/vfs_syscalls.c:2916
[ 159.2102077] syscall() at netbsd:syscall+0x25a sy_call sys/sys/syscallvar.h:65 [inline]
[ 159.2102077] syscall() at netbsd:syscall+0x25a sy_invoke sys/sys/syscallvar.h:94 [inline]
[ 159.2102077] syscall() at netbsd:syscall+0x25a sys/arch/x86/x86/syscall.c:138
[ 159.2215181] --- syscall (number 10) ---
[ 159.2327772] netbsd:syscall+0x25a:
Reported-by: syzbot+177e6808c863c4dd4584@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=7ea755f80234f6a5c322864deba9b5abfc13c1b9
>How-To-Repeat:
syzbot did not find a reproducer.
>Fix:
Yes, please!
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->thorpej
Responsible-Changed-By: thorpej@NetBSD.org
Responsible-Changed-When: Thu, 04 Aug 2022 03:26:49 +0000
Responsible-Changed-Why:
My bug.
State-Changed-From-To: open->analyzed
State-Changed-By: thorpej@NetBSD.org
State-Changed-When: Thu, 04 Aug 2022 03:26:49 +0000
State-Changed-Why:
Root cause analyzed.
State-Changed-From-To: analyzed->feedback
State-Changed-By: thorpej@NetBSD.org
State-Changed-When: Fri, 05 Aug 2022 05:21:56 +0000
State-Changed-Why:
Please confirm with vfs_vnode.c 1.145 and vnode.h 1.303.
From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56950 CVS commit: src/sys
Date: Fri, 5 Aug 2022 05:20:39 +0000
Module Name: src
Committed By: thorpej
Date: Fri Aug 5 05:20:39 UTC 2022
Modified Files:
src/sys/kern: vfs_vnode.c
src/sys/sys: vnode.h
Log Message:
In vcache_reclaim(), post NOTE_REVOKE immediately after changing the
vnode state to VS_RECLAIMING, before we actually call VOP_RECLAIM(),
which will release the reference on the lower node of a stacked FS
vnode, which is likely to free the upper node's v_klist backing store.
Acquire the vnode interlock when checking for kevent interest now,
because the vp->v_klist pointer is now volatile.
PR kern/56950
To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.302 -r1.303 src/sys/sys/vnode.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: feedback->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sun, 20 Aug 2023 06:57:04 +0000
State-Changed-Why:
no reproducer, syzbot has not found this again since last August
candidate fix committed, assuming fixed
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.