From nobody Fri Apr 3 01:31:23 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A80B29D26D; Mon, 16 Feb 2026 14:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771253319; cv=none; b=EXWaWaj2yFPPGvGDRmLCAkRqB26NE/pgvXq0j66sxgUWaxNmdqrmlIZJlAwy+veJqTiLAzAlih7DVXsTAfFxGktcDBs7uCj6dTZLjAZdSOUFL1p4tnTvo/FbeIDDCxwaVbG7PKK4deMOSwfYVB5QnUlhAPiJUVGkM51VHaVLb4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771253319; c=relaxed/simple; bh=3CB0xHGNkH+YsTFlC8f1CrMJKb+o7PHaRENKWCS4kFg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tbmk0LIOqy81uWw74VxLKrLuSsdaKAk+dq53Nz3jCNxeG8fAiIPznYbZx4GhsnYTG/RPKzN73G1ZnhvPYE826G4LL9m32GmOz1b8XTkF4HzasMNwJaKSH3+7QNC5CSZfNewlWXt/d7I1ZHND6R/JpxkjuVvJ9NTP58UtQ22PKmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=LeBUanw4; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="LeBUanw4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=RnllYfzOls3PqrsuLzda2MhZBE57obQilCCnQxMfsmw=; b=LeBUanw4On3fVjFFdRZQzHNmWi UAeH3Q9e49uWXqOaJXEOyD14JcqQi5LHtkLRa08ENbeFkUSnOPYFmlesGy1mkcXiLQH35b4EUOv74 vuom4f+SJmo619UC/uxH453LPs1M+5lhlI08Hv10KRC07cx1ea3EQ6tSjXI9UNLklUsaUZqn63In9 5pJJOGGKezsWjFEN/tgK1EkANikh4i45YsmigrZvlHjV7asb8Vcaeh00ixg1viHRQXZc1huyNxrBs u/+0S9wngMM7cEuUhhrPPqpgK+8x6u8jDt7ML5r8MG/DkdyrMuEe92aCiE99OPi5B30BbtoFy2VLS EULA7IsQ==; Received: from bl17-145-117.dsl.telepac.pt ([188.82.145.117] helo=localhost) by fanzine2.igalia.com with utf8esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vrztn-001KRs-Vv; Mon, 16 Feb 2026 15:48:32 +0100 From: Luis Henriques To: Miklos Szeredi Cc: mszeredi@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Henriques , syzbot+fdebb2dc960aa56c600a@syzkaller.appspotmail.com Subject: [PATCH] fuse: fix uninit-value in fuse_dentry_revalidate() Date: Mon, 16 Feb 2026 14:48:30 +0000 Message-ID: <20260216144830.48804-1-luis@igalia.com> In-Reply-To: <69917e0d.050a0220.340abe.02e2.GAE@google.com> References: <69917e0d.050a0220.340abe.02e2.GAE@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" fuse_dentry_revalidate() may be called with a dentry that didn't had ->d_time initialised. The issue was found with KMSAN, where lookup_open() calls __d_alloc(), followed by d_revalidate(), as shown below: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D BUG: KMSAN: uninit-value in fuse_dentry_revalidate+0x150/0x13d0 fs/fuse/dir= .c:394 fuse_dentry_revalidate+0x150/0x13d0 fs/fuse/dir.c:394 d_revalidate fs/namei.c:1030 [inline] lookup_open fs/namei.c:4405 [inline] open_last_lookups fs/namei.c:4583 [inline] path_openat+0x1614/0x64c0 fs/namei.c:4827 do_file_open+0x2aa/0x680 fs/namei.c:4859 [...] Uninit was created at: slab_post_alloc_hook mm/slub.c:4466 [inline] slab_alloc_node mm/slub.c:4788 [inline] kmem_cache_alloc_lru_noprof+0x382/0x1280 mm/slub.c:4807 __d_alloc+0x55/0xa00 fs/dcache.c:1740 d_alloc_parallel+0x99/0x2740 fs/dcache.c:2604 lookup_open fs/namei.c:4398 [inline] open_last_lookups fs/namei.c:4583 [inline] path_openat+0x135f/0x64c0 fs/namei.c:4827 do_file_open+0x2aa/0x680 fs/namei.c:4859 [...] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Reported-by: syzbot+fdebb2dc960aa56c600a@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/69917e0d.050a0220.340abe.02e2.GAE@googl= e.com Fixes: 2396356a945b ("fuse: add more control over cache invalidation behavi= our") Signed-off-by: Luis Henriques --- fs/fuse/dir.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index f25ee47822ad..66f0113ddfaf 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -481,6 +481,11 @@ static int fuse_dentry_init(struct dentry *dentry) fd->dentry =3D dentry; RB_CLEAR_NODE(&fd->node); dentry->d_fsdata =3D fd; + /* + * Initialising d_time (epoch) to '0' ensures the dentry is invalid + * if compared to fc->epoch, which is initialized to '1'. + */ + dentry->d_time =3D 0; =20 return 0; }