From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB42E3EB80C for ; Tue, 17 Mar 2026 15:13:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773760396; cv=none; b=eAtD9ZYAXW2DYoqzM54v9gBdcXYkrl21lkggOwRyWvzwwknR8BVafdU9tt2p+DbLOLkfdcLvB2J+KeWnFHXTl4ixel4kC98XFU//GUUjD0seiG4gcwtQe6wxvOvhZzjA/snTNq5pq1QM0dW7RhJL0CAnZIgTKA2CxHWwpeG/E9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773760396; c=relaxed/simple; bh=8YklYSi7boixcqDljMgUnEWgfe34j/K8BqVH3D+Dxvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mkNIHI4+mFBCNDWCkulV3wmXGH9dr+chW3lUVshZhNUQCnr53voxXjpEwg9fYIOySCRLXkG/uT/fx8rsWHq3PVtN9+BPsWxA+N0AaPsK6oi6xns0nJ9X+iPMUZJY7I0RuVAA/ZkRUhuCJ4rj9pDJBu1bKRdUTh16NmYiNWQyGs4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M3tgGhKe; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M3tgGhKe" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-c739e680bebso330351a12.1 for ; Tue, 17 Mar 2026 08:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773760395; x=1774365195; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qYuUdzJOX8A/sSXW3PXSlPWbK+XwKgF5hx90nZXlOy4=; b=M3tgGhKel/AuanCD4mH8KQuSqMed+P67YM/xwmq9pKKUV3+d/A4eUE4tjMua6tynBj E/6u92BwCseuG6CFbgz6SThPT2pU5GE1elE6+ca45QXOdRJlj3aLhPU1Yy1SMZSkuu1Y ZfoelizH5XgklUDY87s4fiHLTgAEDewLQJaje6nS+z6hbZTiGc+aEuFgv5+Tyfj14xmA o2j4uj53lE/9WX/iG1LvOaeiU0voPRBHvcqJBdHtG/AYAt1NFGCfVZCuCrMJ7e6mbjqc +b8+s2XqJCljMiogUZTPkR8DOIxyBVUo/9UqIwQCemVXvY/d76EPiM/OUpuGnVJOV9zW tTFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773760395; x=1774365195; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qYuUdzJOX8A/sSXW3PXSlPWbK+XwKgF5hx90nZXlOy4=; b=R5CYc68OGZMs7UnTR0kahkmA+lop0fNs6TJTX/5UkeKYIoUaLhnkQK56wYKij6o5lW B9R1gxktlhI2iXZW3DwzSpKRAiJryDz+JnCJclQMM2m2UoGnAUtA6hCZIIol3LqnaxVy FI+rffjSVy/nXcePTbw24SE4H2NT2aNM212zKW19tjp5mdj1tS0z9QrWtOX45SijwLMV o5J/nPlqKTwQJM7CUyFE/l31GaTDCk04+FtFX3wtpj0ByMxb03AHlyikr5B/jBpxFqYW i1onT/NLHDvij1cSIMY7baAQmT0PHvmdrUCSoQ9Gap7eer8qDU4Mqan6hMwe9pvZpvz7 0+pw== X-Forwarded-Encrypted: i=1; AJvYcCXkVjgmus0hJQXkgS2rhtJSE58C+UeI6pEJClfsolJxW3ag6/iyk7EHNGui5S1lWgkAgJPojz89x8Nyiyk=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4IubdFWF++NMjlPhS+jphIuSribMdcojMiFm52/OkONoWmYXW fDZEFWnmOnH8z9QOUmF6+QOz+8L2dDAq2TDuydlv+oipmxCFeJlAMvHG X-Gm-Gg: ATEYQzwqGl6xauklFdOJBwF3KuvDn1Hmhm4oGEfi7LTRJhZFmNByKxEMr20xvjRgZ99 3j5lsv1+cu5kUlLBj0/DLcinLbrpdyNm1Ty+sg94zQpgl3uBdI1dRhdlrjR4pcnmGDT2FNeTGm9 VnkC8whZzHwfxfcOFICgd5XTrjdaMIGvTe0b09NoYzF2TqVICGABqWtRWK1iSiE+BC+0O2T+RZQ dYP1WcRyQzirLznb+SXMJ2MLY/1ijnkzktoxSeiI8t/OvmBnKuEeEwz+pgAMKY0TkSGSEy8zthz BjzshnvrkgnfeRjjqYAQaJxjlhYc0PInvCG3Z+dLc/Ekc3/Fkff2UYuq3aVabcv2gfV6rVFRtlc hcfVUYQHq0OXzWdIlC8F0HG1NM828GUiWiz1BSbWPCEVojGkleLLHPwTQ25per1nIy2Qk6jV5Cp JGulhHysy4Nw+S8XDhRVOE/NhcZXrGp4X98OeTH0aKR5m94myYcRAetRNV63+7CfgOCzqPLjc6Y auDGiE= X-Received: by 2002:a17:90b:554f:b0:359:8dfc:d39a with SMTP id 98e67ed59e1d1-35bada61fe8mr3126686a91.4.1773760395053; Tue, 17 Mar 2026 08:13:15 -0700 (PDT) Received: from deepanshu-kernel-hacker.. ([2405:201:682f:389d:adc8:8291:13a9:ab52]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35b95822ca2sm2972831a91.4.2026.03.17.08.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 08:13:14 -0700 (PDT) From: Deepanshu Kartikey To: eadavis@qq.com Cc: konishi.ryusuke@gmail.com, linux-kernel@vger.kernel.org, linux-nilfs@vger.kernel.org, slava@dubeyko.com, syzbot+4b4093b1f24ad789bf37@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH] nilfs2: no longer save to shadow map if the num of members is too small Date: Tue, 17 Mar 2026 20:43:06 +0530 Message-ID: <20260317151307.881198-1-kartikey406@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Edward, On Mon, 17 Mar 2026, Edward Adam Davis wrote: > The value of argv0.v_nmembs passed from userspace is 0. This prevents > nilfs_iget_for_gc() from being called to initialize the gcinode during > the execution of nilfs_ioctl_move_blocks(). Consequently, this triggers > a null-ptr-deref involving ii->i_assoc_inode within the subsequent call > sequence: nilfs_clean_segments()->nilfs_mdt_save_to_shadow_map() [1]. This analysis is incorrect. The null-ptr-deref is not caused by nilfs_iget_for_gc() not being called. The real problem is that ns_dat->i_assoc_inode (the DAT inode's btree node cache) is never initialized at mount time. > A check for argv[0].v_nmembs has been added to nilfs_clean_segments() > to prevent this potential null-ptr-deref of ii->i_assoc_inode. This fixes the symptom but not the root cause. Also note that in the original syzkaller reproducer: argv[0].v_nmembs = 0xd = 13 > 0 Your check would NOT prevent the crash with the original reproducer. The correct fix is to initialize the btnode cache eagerly in nilfs_dat_read() at mount time, since i_assoc_inode is only initialized lazily during btree operations. When NILFS_IOCTL_CLEAN_SEGMENTS is called before any btree operation has occurred, i_assoc_inode is NULL. I have already submitted this fix and syzbot confirmed it as fixed: https://lore.kernel.org/all/20260317090109.878401-1-kartikey406@gmail.com/T/ Regards, Deepanshu Kartikey