From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 5BB4B78F29 for ; Mon, 15 Jun 2026 03:14:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781493249; cv=none; b=k3SE/qeLRuxi04FMtncjpdBfcHipsGKFdhodEMqhhOYjTMtBAVE+O7bEWaQz4ddH5NbbyqpkqWKl+wh6/oo67Yo/TG54ui8xAPW9sVMwxn7MntdV/tZKJX4CPyPWRbwUIdqbhcFw8WjxxNWNGx7wBo3T2tl6db14wDSZm57vZFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781493249; c=relaxed/simple; bh=y1NUWFYTXmsd7gPiP4CmZXn7rKpG1fV6KDXBO9jHHwk=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=B1MOblFNBpAtpYgRhkp29O6LAeT1ppMvEdTM3h9pr+j9emHje3oGG09gDCdTfW81PDX8qOnCkgtkef6X41DM9yJ6+aPzm4zKZj6etPIWlf/tllFWTYVZJsoNOmZGmLurOT+TgIGQ/KvQoIodiajEM6jMSyTpxRlQl5cYpVqcND0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eIMhx9Ur; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eIMhx9Ur" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A96821F000E9; Mon, 15 Jun 2026 03:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781493247; bh=m8p1sEGL+W1L0l6iKEoOSB+rXixXbnsVyCjzmpVoam0=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=eIMhx9Urd+AE8bQq+bKCn3TPJa96gOWFy+mTz1lQMyRxlCQSsr3EQXOZKIfNr+CwR TaJp7tedSsX1j6ZztZc5NfFzpo0LDUrBPkBgPpmbcQdRykaQsNXYTHRvGzOQz4kKb0 I0GBvfpMiekFj+E30As051xhyYAgMLVObAu2wshcWoSa8MXQForsit9Sina9DwPbHn 3VrM1q/g9m9dOAkOGBhTYa23hAJnRgHJRhrlRcwQvCdg49owHXgkhyalAOJnOOJQDK EAmB+Ac2jhgWM4l+jo1lhxX/PEj83daWv9K88PV1CyEkEQha8KTuJjQIg7pKCXuksH 1krdrhJHpNf/g== Message-ID: Date: Mon, 15 Jun 2026 11:14:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, "open list:F2FS FILE SYSTEM" , open list Subject: Re: [PATCH] f2fs: validate inline dentry name lengths before conversion To: Samuel Moelius , Jaegeuk Kim References: <20260603154933.16368-1-sam.moelius@trailofbits.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260603154933.16368-1-sam.moelius@trailofbits.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/3/26 23:49, Samuel Moelius wrote: > Inline dentry conversion copies names out of the inline dentry area > before checking that each recorded name length fits in the available > filename slots. > > A corrupted image can therefore make the conversion path read past > the inline filename storage while building the regular dentry block. > > Validate each inline dentry name length against the inline filename > area before copying it. > > Assisted-by: Codex:gpt-5.5-cyber-preview > Signed-off-by: Samuel Moelius > --- > fs/f2fs/inline.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c > index 7aabfc9b43cb..4584dfbe3fb8 100644 > --- a/fs/f2fs/inline.c > +++ b/fs/f2fs/inline.c > @@ -507,6 +507,10 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) > bit_pos++; > continue; > } > + if (unlikely(le16_to_cpu(de->name_len) > F2FS_NAME_LEN || > + bit_pos + GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)) > > + d.max)) > + return -EFSCORRUPTED; err = -EFSCORRUPTED; goto punch_dentry_pages; Thanks, > > /* > * We only need the disk_name and hash to move the dentry. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A7CACD98C5 for ; Mon, 15 Jun 2026 03:14:24 +0000 (UTC) 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-Owner; bh=U7vnMpH9B3fPz+YM6jffH5zXQnPjaDH1yZaioFTqhFs=; b=a0ZuO2ntT9Gt+s0kyCjRfIMkqs PnZQdPJtZYMCm02LqQ4fI5qdx2UfQAiLOzCIUbAknuZuD8LMHoMm0WWOBxb1pfLs1FIojNnR2P+IL 74Kqp3pP6ClY68s7ctYgKUdskp3jqWyKKqIMAUqORA5LBcC3+uPV5MRwjXPlIkLbXpWg=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wYxmL-0002XV-84; Mon, 15 Jun 2026 03:14:22 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wYxmJ-0002XN-6U for linux-f2fs-devel@lists.sourceforge.net; Mon, 15 Jun 2026 03:14:20 +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-Subscribe:List-Post:List-Owner:List-Archive; bh=m8p1sEGL+W1L0l6iKEoOSB+rXixXbnsVyCjzmpVoam0=; b=I3fG3NkzrkhaLKCyOOlmohaPF2 +359aDVY5Co7pBaSl2yjTNo5gi2S4ORe2p7BU0/lE5JaSYegmz07Vwtb1BSQr3QCX+dMXlStWN30f Z5gfLVBAt/EJsKKB9msRFpdeltfyBHBsqaPfUiaZyUdAltswYew4CUSZODxgG8f7q2Zs=; 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-Subscribe: List-Post:List-Owner:List-Archive; bh=m8p1sEGL+W1L0l6iKEoOSB+rXixXbnsVyCjzmpVoam0=; b=Qn286Ls51aOYKwvz2ZwXGejbeh G+BQfK2yZehj8HZ2hlKqzKC83GEaaQMQ0ukhxqiqQGorY8b3MOcyBT+2gbQAskM/lk59lS2Dn00Ek 640qzgAS0P/I6bsLChy2OP+9GEQpRu/oGLNlw2pKkH2Yc5C5o0+zKkMtEUSdbyurwRJc=; 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.95) id 1wYxmE-00089Z-Pv for linux-f2fs-devel@lists.sourceforge.net; Mon, 15 Jun 2026 03:14:20 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 4B6B16008A; Mon, 15 Jun 2026 03:14:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A96821F000E9; Mon, 15 Jun 2026 03:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781493247; bh=m8p1sEGL+W1L0l6iKEoOSB+rXixXbnsVyCjzmpVoam0=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=eIMhx9Urd+AE8bQq+bKCn3TPJa96gOWFy+mTz1lQMyRxlCQSsr3EQXOZKIfNr+CwR TaJp7tedSsX1j6ZztZc5NfFzpo0LDUrBPkBgPpmbcQdRykaQsNXYTHRvGzOQz4kKb0 I0GBvfpMiekFj+E30As051xhyYAgMLVObAu2wshcWoSa8MXQForsit9Sina9DwPbHn 3VrM1q/g9m9dOAkOGBhTYa23hAJnRgHJRhrlRcwQvCdg49owHXgkhyalAOJnOOJQDK EAmB+Ac2jhgWM4l+jo1lhxX/PEj83daWv9K88PV1CyEkEQha8KTuJjQIg7pKCXuksH 1krdrhJHpNf/g== Message-ID: Date: Mon, 15 Jun 2026 11:14:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Samuel Moelius , Jaegeuk Kim References: <20260603154933.16368-1-sam.moelius@trailofbits.com> Content-Language: en-US In-Reply-To: <20260603154933.16368-1-sam.moelius@trailofbits.com> X-Headers-End: 1wYxmE-00089Z-Pv Subject: Re: [f2fs-dev] [PATCH] f2fs: validate inline dentry name lengths before conversion X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chao Yu via Linux-f2fs-devel Reply-To: Chao Yu Cc: open list , "open list:F2FS FILE SYSTEM" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 6/3/26 23:49, Samuel Moelius wrote: > Inline dentry conversion copies names out of the inline dentry area > before checking that each recorded name length fits in the available > filename slots. > > A corrupted image can therefore make the conversion path read past > the inline filename storage while building the regular dentry block. > > Validate each inline dentry name length against the inline filename > area before copying it. > > Assisted-by: Codex:gpt-5.5-cyber-preview > Signed-off-by: Samuel Moelius > --- > fs/f2fs/inline.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c > index 7aabfc9b43cb..4584dfbe3fb8 100644 > --- a/fs/f2fs/inline.c > +++ b/fs/f2fs/inline.c > @@ -507,6 +507,10 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) > bit_pos++; > continue; > } > + if (unlikely(le16_to_cpu(de->name_len) > F2FS_NAME_LEN || > + bit_pos + GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)) > > + d.max)) > + return -EFSCORRUPTED; err = -EFSCORRUPTED; goto punch_dentry_pages; Thanks, > > /* > * We only need the disk_name and hash to move the dentry. _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel