From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796325233; b=u/slySYh6bzB59TW3HslHlFbdiDSPgUw/ALVnYBJUx0dWHKj6IEpZ+fMHq6917BDnvvI 49l5mkqvAstpAqbqyUyMKban7NlQ7T+8Y5SvzbKemZzh0WtdEnmpA5/7Ia0tYZ/LtHCYx gxJ7ttZseKzp9378WW/rZibTq+DuGBnV1xA/eJ7B637NXz84vZsIxoJHDvmxRHwKWWno6 1jSYIE7SAJPCNg7v/Io2HvendmTA1t+HC4Ydvq5ayUNaH70W+nh+6JkCbBe8Yy1+lWozO LKTK1kGQhU5m055/MRlxQcb2CDVZyhVtAsrOkxyVTOuRXMh+4Hc3AvQf4TG2skhYbqA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796325233; h=Received:DKIM-Signature:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=WR1t4eL05q962/rhFStENF3s/M3WxV15iXVOK4NpylQ=; b=AQGaAY72YUWu++oFIl9l90MBsN42YHPUUS2Bi51ijiIe8kbtUQdXWAr6l0+WwzGCRqZT Oipbf1uX/LQl3Qos2FHRlJUo/HDDlw9EU3pjq0pNB5+1D5pLE3yS+E7oZ6LxticapoLdI oY4lPmDDi3ScaxjWbC57+7/r4Pw1pATyJ1YBrssjullkAoQm5DX92ADXGj6Wjt/Z5SiJp 4X25jTijMa+6rSkenplEit8FdfoegtzPqEFIgM+h3E0vAy/hbnvK8jXTDtFNH0YnoNEwo MbhOdxtwz20DSsoRcFSWBCiOwVlWJNmoZQmbgfQMaO+TbBFSSjRRvdrcM10a1/v5YNw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Wbikk6mP; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5286C606A322; Thu, 3 Dec 2026 19:13:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Wbikk6mP Received: by smtp.kernel.org (Postfix) with ESMTPSA id D72BF1F000C2; Thu, 3 Dec 2026 19:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796325233; bh=WR1t4eL05q962/rhFStENF3s/M3WxV15iXVOK4NpylQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Wbikk6mP1cZrTOIIPAaE9oPIbRFbMmw1Ik6m22AQqpYV/yADqueoCnQKts8I54YyO uqO5sC05kDdqidnfIlDGsXjxTZhTCCBSP19yZm6g+TcjBlDgcx2p66BgIk/7st4Fpz NAm39MzorkrbHFWkjNw3q93yZF7DzOlqjLFFtd17gCJ6uY6OMICdiHK4KRoP+fXhq3 r3XuQjffZOKTLlVrk6DojtkUCXAC9dyjY0VsV02RxTuLwZacDufaassNoCeprVA+B9 ND181AUMMsu56YaUkDtRbCG/tzgcUVbvFqxyD2umcWwddlIW3B4ijztG/aNPM8aC2t UzvIWK5tWRaig== Date: Thu, 03 Dec 2026 09:13:52 -1000 Message-ID: <760de4526e0b26bde176bf952ed3360c@kernel.org> From: Tejun Heo To: Josef Bacik Cc: Greg Kroah-Hartman , Christian Brauner , driver-core@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernfs: don't take a failed id allocation for a wrap In-Reply-To: <20261202-b4-kernfs-id-wrap-v1-1-99d9a77c1300@bacik.io> References: <20261202-b4-kernfs-id-wrap-v1-1-99d9a77c1300@bacik.io> X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Wed, Dec 02, 2026 at 02:40:46PM -0500, Josef Bacik wrote: > After one failed id allocation every new node of that kernfs root gets an > inode number above 32 bits on a 64 bit kernel, and the 32 bit stat() and > getdents() fail on it with EOVERFLOW until the root goes away. > > __kernfs_new_node() stores the result of idr_alloc_cyclic() in the u32 > last_id_lowbits even when it is an errno. The next id is below that > value, so id_highbits is incremented as if the low bits had wrapped. > > Reproduced with failslab on radix_tree_node while making cgroups, the > inode number of the first cgroup made after the ENOMEM: > > before: 0x1000002c0 > after: 0x2c0 > > Getting the last id once more is a wrap as well, and the stored errno > covered for that after an ENOSPC. > > Fix by only recording ids that were allocated, and by counting an id > equal to the last one as a wrap. > > Fixes: e23f568aa63f ("kernfs: fix ino wrap-around detection") > Signed-off-by: Josef Bacik Acked-by: Tejun Heo Thanks. -- tejun