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=1796112905; b=dqzp+XHeSQiVXR3eVAWgmBSDpEPCcEV5mEyvw3mLpDUqt2Mwqk7RsWW/vlJG9NJIYGN7 4Gok9scmB4ne/Wm4hWWo7XytlVYQmSWJTxSj6siG5gw9r+G2Purc347DFur+/wDdINiO2 1bbaYr2BxQWoH32DMzpMwc2qUNtEqMF+eHcpKx8Ogl6X8c/Z7vD8cWqb9XgF57s6QFqQA NFnf1dUhD37rWAqhgFNX+46f2nH/hlhJmMkzKRkwpSTL60WrgsDGwIXrtterMmrq0QndR 818FfvICOjrJ0R3dqviViYYb8P6N61WvQyoQruhx0VzvEKPK9A3Bwq1Hxjs42UPKaiQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796112905; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent:Cc: Subject:To:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=K3MJDkrfpJVG4TLJ+i5YsRJkNbYgSnm6CMfrxts6xLY=; b=yb5PiCQMAsnVGPsQqQL/I04HTtEfoHcX/1m/bI0/JnH0Ome9lZVKTWwJ70g/YgB1E7+U T5OFOrTjkG/DA+yzYtunhOxzEMG6soCKublGzKh0vnCj7mSPku7rL9E3fh1U5dPEah//A I10ATFDAeh1/yWHTDXDlScSLbvia07goDRdUuiB1HLRB2qlM3Jlacx+V5xij5yuo+aVwP sEiTfPylQvqkbWqihUzJaRpw8uJ7DYaYdwkdApuDT9rRrAOELB/JrPY5z7JjiE1925I8W SA9dlPDKsiTFGjKJZwzNJ/OVHURTd13YWUWjpebNSykfSjBMgZVT1IL/DVSQhdk3L5Q== 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=Yz1DjiRu; 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 DF368606A320; Tue, 1 Dec 2026 08:15:04 +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=Yz1DjiRu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 210541F00893; Tue, 1 Dec 2026 08:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796112904; bh=K3MJDkrfpJVG4TLJ+i5YsRJkNbYgSnm6CMfrxts6xLY=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=Yz1DjiRu/RmtONoNlUmU6Ow9xC3F6/h/g7REJDtngNIH3u1JgkBKgtSb3trxlmXrx 87vXVM32qYpQTjuY+mQ6j3adS8fMeKP5cdYmSOmBBlDRi48Juz6srvfp7m4FH0OAZn ODnQudhPSZ33NChPTJaPx6Mz+tCNEbk2JCzLXoGdoJR2MxCR7D4ivTPvo312MG2iNN eHqAHrbRa3eU7qNwO9VisSLtfxImbB14H9oOWMa1vDXdTTpG5v3HMgizVAsuWHAoPf a2icxf3OOTafjWLMoVKqQoe8YK8Z8urnqSChZa6Tlt3q1Ago8PxcNeUfs8JpGwOIIH Ffqy5aFCs1P6Q== Message-ID: <11c9935a-044a-4ac4-85ee-592d6aca3c81@kernel.org> Date: Tue, 1 Dec 2026 16:15:01 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, Taerang Kim , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] f2fs: fix to reject inline_data inode which has blocks To: Hengyu Liang , Jaegeuk Kim References: <20261122153636.2731348-1-hengyul@cs.unc.edu> Content-Language: en-US From: Chao Yu In-Reply-To: <20261122153636.2731348-1-hengyul@cs.unc.edu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/22/26 23:36, Hengyu Liang wrote: > Commit c240c87bcd44 ("f2fs: fix to do sanity check on blocks for > inline_data inode") made f2fs_sanity_check_inline_data() return false, > i.e. "sane", as soon as an inline_data inode has blocks or node ids. > > However, the function returns true for a corrupted inode, and that > commit meant to detect exactly this state. The early return also skips > the older checks that reject inline_data on a directory and on a > compressed, encrypted or verity file. As of now, such an inode on a > corrupted image is loaded, and setting this one bit in i_inline of an > inode is enough for the following: > > - unlink() of a small compressed file that owns one data block hits > BUG_ON() in clear_inode(). With panic_on_oops=1 the machine panics. > Otherwise the task is killed, and the file system can no longer be > unmounted (EBUSY). > - unlink() of a larger compressed file succeeds, but the orphan inode > cannot be evicted, and the next mount fails with EIO until fsck.f2fs > repairs the image. > - A directory lists only 70 of its 300 entries, yet rmdir removes it > once those 70 are deleted, and fsck.f2fs then finds the other 230 > inodes unreachable. > > The issue can be reproduced with: > > mkfs.f2fs -q -f -O extra_attr,compression /dev/vda > mount -t f2fs -o compress_algorithm=lz4 /dev/vda /mnt > touch /mnt/f; chattr +c /mnt/f; echo hello > /mnt/f; sync > ino=$(ls -i /mnt/f | awk '{print $1}'); umount /mnt > blk=$(dump.f2fs -d 1 -i $ino /dev/vda | > sed -n 's/.*nat_entry.block_addr *\[0x\(.*\)\]/\1/p') > # i_inline 0x21 -> 0x23 (F2FS_INLINE_DATA) > printf '\043' | dd of=/dev/vda bs=1 seek=$((0x$blk * 4096 + 3)) \ > conv=notrunc > mount -t f2fs /dev/vda /mnt; rm /mnt/f > > Before that commit, the result is: > > rm: can't stat '/mnt/f': Structure needs cleaning > > After it, the result is: > > kernel BUG at fs/inode.c:776! > > With this patch, the result is the same as before that commit. > > This patch will make the check return true for an inline_data inode > which has blocks, as the message of that commit describes. > > Fixes: c240c87bcd44 ("f2fs: fix to do sanity check on blocks for inline_data inode") > Cc: stable@vger.kernel.org > Signed-off-by: Hengyu Liang Reviewed-by: Chao Yu Thanks, From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08C82606A325 for ; Tue, 1 Dec 2026 08:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lists.sourceforge.net header.i=@lists.sourceforge.net header.a=rsa-sha256 header.s=beta header.b=ITkkrG1i; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.a=rsa-sha256 header.s=x header.b=l/As46vK; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.a=rsa-sha256 header.s=x header.b=T3StyD+E; dkim=neutral header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Yz1DjiRu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:In-Reply-To:References:To:MIME-Version:Date: Message-ID:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=YoI/O6PRjLwjpgyZ0h8HWrmi+kGU9S5YhfVQopawrhU=; b=ITkkrG1ip0gbF4 m0rgPXiTf3itV8yn3wri89zF+RXkSTHY3fhKcl7UB0FistdiIoIh8YVRmQHzbtj/tZu8fmFk4DW3l oEgn2ELLkllvE0xJ3cySrC3KesjTloXKLZS2ylL9q1b7U7BxbsoNEj7D28qa6du7G11P4tbrSMZ5/ OBE=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xYJ17-000000002Rz-2yrH; Tue, 01 Dec 2026 08:15:13 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xYJ15-000000002Rl-3g6o for linux-f2fs-devel@lists.sourceforge.net; Tue, 01 Dec 2026 08:15:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:To:Subject:Cc:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=K3MJDkrfpJVG4TLJ+i5YsRJkNbYgSnm6CMfrxts6xLY=; b=l/As46vKMGz9+xak/HWNHbK7vX /sx+ZbmOPKVamD+QqMY/14j6sanPssGg+6SecMfYlk/n0kP9T4xBCJwttNj8EK+iwHUVbXbGbcQg3 FCUMTFThWrlThSvTId3AtaqmMt/HJNiZgoIydqjl8I/BCdfSIg7gS7aESYtttmxKvOXk=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:To: Subject:Cc:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=K3MJDkrfpJVG4TLJ+i5YsRJkNbYgSnm6CMfrxts6xLY=; b=T3StyD+Eg+bolaKCBJwQevVzMP kMkLyYRlJCOuPjOIPhmgRh3/TrW86sPWX0BFVV0eRY7S1FFmhtHmovXPIiQqnLenJ051dPSMBTYUJ WHncbLqAtFt4rjAB879V9agbB7MYCXZT2DFoYmwviXZMMduMp5W48EWBjESOthqAWL3A=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xYJ14-00000000841-1y2d for linux-f2fs-devel@lists.sourceforge.net; Tue, 01 Dec 2026 08:15:11 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id C182360DEB; Tue, 1 Dec 2026 08:15:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 210541F00893; Tue, 1 Dec 2026 08:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796112904; bh=K3MJDkrfpJVG4TLJ+i5YsRJkNbYgSnm6CMfrxts6xLY=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=Yz1DjiRu/RmtONoNlUmU6Ow9xC3F6/h/g7REJDtngNIH3u1JgkBKgtSb3trxlmXrx 87vXVM32qYpQTjuY+mQ6j3adS8fMeKP5cdYmSOmBBlDRi48Juz6srvfp7m4FH0OAZn ODnQudhPSZ33NChPTJaPx6Mz+tCNEbk2JCzLXoGdoJR2MxCR7D4ivTPvo312MG2iNN eHqAHrbRa3eU7qNwO9VisSLtfxImbB14H9oOWMa1vDXdTTpG5v3HMgizVAsuWHAoPf a2icxf3OOTafjWLMoVKqQoe8YK8Z8urnqSChZa6Tlt3q1Ago8PxcNeUfs8JpGwOIIH Ffqy5aFCs1P6Q== Message-ID: <11c9935a-044a-4ac4-85ee-592d6aca3c81@kernel.org> Date: Tue, 1 Dec 2026 16:15:01 +0800 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Hengyu Liang , Jaegeuk Kim References: <20261122153636.2731348-1-hengyul@cs.unc.edu> Content-Language: en-US In-Reply-To: <20261122153636.2731348-1-hengyul@cs.unc.edu> X-Spam-Score: -0.2 (/) X-Headers-End: 1xYJ14-00000000841-1y2d Subject: Re: [f2fs-dev] [PATCH] f2fs: fix to reject inline_data inode which has blocks X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , From: Chao Yu via Linux-f2fs-devel Reply-To: Chao Yu Cc: Taerang Kim , linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 11/22/26 23:36, Hengyu Liang wrote: > Commit c240c87bcd44 ("f2fs: fix to do sanity check on blocks for > inline_data inode") made f2fs_sanity_check_inline_data() return false, > i.e. "sane", as soon as an inline_data inode has blocks or node ids. > > However, the function returns true for a corrupted inode, and that > commit meant to detect exactly this state. The early return also skips > the older checks that reject inline_data on a directory and on a > compressed, encrypted or verity file. As of now, such an inode on a > corrupted image is loaded, and setting this one bit in i_inline of an > inode is enough for the following: > > - unlink() of a small compressed file that owns one data block hits > BUG_ON() in clear_inode(). With panic_on_oops=1 the machine panics. > Otherwise the task is killed, and the file system can no longer be > unmounted (EBUSY). > - unlink() of a larger compressed file succeeds, but the orphan inode > cannot be evicted, and the next mount fails with EIO until fsck.f2fs > repairs the image. > - A directory lists only 70 of its 300 entries, yet rmdir removes it > once those 70 are deleted, and fsck.f2fs then finds the other 230 > inodes unreachable. > > The issue can be reproduced with: > > mkfs.f2fs -q -f -O extra_attr,compression /dev/vda > mount -t f2fs -o compress_algorithm=lz4 /dev/vda /mnt > touch /mnt/f; chattr +c /mnt/f; echo hello > /mnt/f; sync > ino=$(ls -i /mnt/f | awk '{print $1}'); umount /mnt > blk=$(dump.f2fs -d 1 -i $ino /dev/vda | > sed -n 's/.*nat_entry.block_addr *\[0x\(.*\)\]/\1/p') > # i_inline 0x21 -> 0x23 (F2FS_INLINE_DATA) > printf '\043' | dd of=/dev/vda bs=1 seek=$((0x$blk * 4096 + 3)) \ > conv=notrunc > mount -t f2fs /dev/vda /mnt; rm /mnt/f > > Before that commit, the result is: > > rm: can't stat '/mnt/f': Structure needs cleaning > > After it, the result is: > > kernel BUG at fs/inode.c:776! > > With this patch, the result is the same as before that commit. > > This patch will make the check return true for an inline_data inode > which has blocks, as the message of that commit describes. > > Fixes: c240c87bcd44 ("f2fs: fix to do sanity check on blocks for inline_data inode") > Cc: stable@vger.kernel.org > Signed-off-by: Hengyu Liang Reviewed-by: Chao Yu Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel