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 X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BAFEC433E0 for ; Wed, 30 Dec 2020 15:41:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E26BA22262; Wed, 30 Dec 2020 15:41:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E26BA22262 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kudb9-0004yU-H7; Wed, 30 Dec 2020 15:41:15 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kudb8-0004yG-9q for linux-f2fs-devel@lists.sourceforge.net; Wed, 30 Dec 2020 15:41:14 +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:MIME-Version :Message-ID:In-Reply-To:Date:From:Cc:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kxTRlsmr/q/fzRl8gSLFTkF8lKrLR1zmzIn5QT9H7dU=; b=UlFQt82r8BpecI89Rbd1DelZt6 VyuiEFIgl7GbkfFuO0jyGwEW3iuDoOboM6aEoeSaeHET0ONzqt3NjIz1WrY1f5GSP5yL0GmQ7JS9v YrWrf7AsCx1LQeWslyTjAJGN6VrtiZgeIlLlcwxftI/5SPyUw24KE05nlmpS2y400PDE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:From:Cc:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kxTRlsmr/q/fzRl8gSLFTkF8lKrLR1zmzIn5QT9H7dU=; b=m3jD6fuAPCggUJWtc9L4ShdOJf xD68hDhuZ/F6Cf8fvssBtuBu8JfCO7RjB+zVLiH/cJYRQYF6SrIWSE1pAFjIDEVfNgGZrc72lWoMJ OmSE7fJcFTEKKcGAg1YHbtArYtyAHdGDP1IvcZbkl2GIOtHBHb3dr6cKlX6UfEVltiJs=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kudat-0098vu-R5 for linux-f2fs-devel@lists.sourceforge.net; Wed, 30 Dec 2020 15:41:14 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6C24221FA; Wed, 30 Dec 2020 15:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609342847; bh=QGBdU/TFo/ciokWjTibpTiQxhNjlKkD6A8udYjbiJ/c=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=GT15I0QuWzGs/rNXV3NN4S4dacDnlPkNLX77TEIdLiIpspHl5rnM0Dk2Z6sACYoSi BYzV6O/aZ3zZsJSfu1EgeSb2qhvNSB033ypljm1r4dygCtasa4yRLzrd7BCQ04RhE2 CGPYdnWwiZhExG2NNzTXfBOqk0zVwRlESUW7lbMg= To: ebiggers@google.com, ebiggers@kernel.org, gregkh@linuxfoundation.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org From: Date: Wed, 30 Dec 2020 16:42:04 +0100 In-Reply-To: <20201228191211.138300-5-ebiggers@kernel.org> Message-ID: <160934292474165@kroah.com> MIME-Version: 1.0 X-stable: commit X-Patchwork-Hint: ignore X-Headers-End: 1kudat-0098vu-R5 Subject: [f2fs-dev] Patch "ubifs: prevent creating duplicate encrypted filenames" has been added to the 4.19-stable tree 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: , Cc: stable-commits@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This is a note to let you know that I've just added the patch titled ubifs: prevent creating duplicate encrypted filenames to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ubifs-prevent-creating-duplicate-encrypted-filenames.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Wed Dec 30 04:40:58 PM CET 2020 From: Eric Biggers Date: Mon, 28 Dec 2020 11:12:11 -0800 Subject: ubifs: prevent creating duplicate encrypted filenames To: stable@vger.kernel.org Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org Message-ID: <20201228191211.138300-5-ebiggers@kernel.org> From: Eric Biggers commit 76786a0f083473de31678bdb259a3d4167cf756d upstream. As described in "fscrypt: add fscrypt_is_nokey_name()", it's possible to create a duplicate filename in an encrypted directory by creating a file concurrently with adding the directory's encryption key. Fix this bug on ubifs by rejecting no-key dentries in ubifs_create(), ubifs_mkdir(), ubifs_mknod(), and ubifs_symlink(). Note that ubifs doesn't actually report the duplicate filenames from readdir, but rather it seems to replace the original dentry with a new one (which is still wrong, just a different effect from ext4). On ubifs, this fixes xfstest generic/595 as well as the new xfstest I wrote specifically for this bug. Fixes: f4f61d2cc6d8 ("ubifs: Implement encrypted filenames") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20201118075609.120337-5-ebiggers@kernel.org Signed-off-by: Eric Biggers Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/dir.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -290,6 +290,15 @@ done: return d_splice_alias(inode, dentry); } +static int ubifs_prepare_create(struct inode *dir, struct dentry *dentry, + struct fscrypt_name *nm) +{ + if (fscrypt_is_nokey_name(dentry)) + return -ENOKEY; + + return fscrypt_setup_filename(dir, &dentry->d_name, 0, nm); +} + static int ubifs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) { @@ -313,7 +322,7 @@ static int ubifs_create(struct inode *di if (err) return err; - err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); + err = ubifs_prepare_create(dir, dentry, &nm); if (err) goto out_budg; @@ -977,7 +986,7 @@ static int ubifs_mkdir(struct inode *dir if (err) return err; - err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); + err = ubifs_prepare_create(dir, dentry, &nm); if (err) goto out_budg; @@ -1062,7 +1071,7 @@ static int ubifs_mknod(struct inode *dir return err; } - err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); + err = ubifs_prepare_create(dir, dentry, &nm); if (err) { kfree(dev); goto out_budg; @@ -1146,7 +1155,7 @@ static int ubifs_symlink(struct inode *d if (err) return err; - err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); + err = ubifs_prepare_create(dir, dentry, &nm); if (err) goto out_budg; Patches currently in stable-queue which might be from ebiggers@kernel.org are queue-4.19/fscrypt-add-fscrypt_is_nokey_name.patch queue-4.19/ext4-prevent-creating-duplicate-encrypted-filenames.patch queue-4.19/ubifs-prevent-creating-duplicate-encrypted-filenames.patch queue-4.19/f2fs-prevent-creating-duplicate-encrypted-filenames.patch _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel 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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AA5AC433DB for ; Wed, 30 Dec 2020 15:41:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2FD1207A6 for ; Wed, 30 Dec 2020 15:41:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2FD1207A6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-Reply-To:Date:From:To: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=oZpBWiNj6ecfOozZM71+zLzHJiTLgktKrW7hONRBCco=; b=PwQFvDcOH3j6uWDa37gMKkzad cLXldjHRsBpjufIztIzyUyEunGQ8joxHbQBRb0WEGbHC/HTZsfZKFLU4C3MWCE9Ej0rZ5edJw8bl6 zEs1kP1xsPXy0yVlcBeXzG7+l0vooalTnYGqYt0iR7DNTS+5JWaecqERrbvsRd+QZFKTMFHjv7BN3 0BIuelvyi47b9gzhawZnRGu1/nKxQO6QzZm/NIcEOUIeGsFRi0YpHRB5FXK7/TO1niyXyMZtwL9ze bTN3FGm1Rpctp9Bn8/SMBBsl0mi/8vGOkUsEEjewsu9P2o3Sq2kc2ANq+rFHMv71ybatPCC+9tGDm miatTUGLw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kudao-0004Cy-MV; Wed, 30 Dec 2020 15:40:54 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kudai-0004Aw-4H for linux-mtd@lists.infradead.org; Wed, 30 Dec 2020 15:40:49 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6C24221FA; Wed, 30 Dec 2020 15:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609342847; bh=QGBdU/TFo/ciokWjTibpTiQxhNjlKkD6A8udYjbiJ/c=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=GT15I0QuWzGs/rNXV3NN4S4dacDnlPkNLX77TEIdLiIpspHl5rnM0Dk2Z6sACYoSi BYzV6O/aZ3zZsJSfu1EgeSb2qhvNSB033ypljm1r4dygCtasa4yRLzrd7BCQ04RhE2 CGPYdnWwiZhExG2NNzTXfBOqk0zVwRlESUW7lbMg= Subject: Patch "ubifs: prevent creating duplicate encrypted filenames" has been added to the 4.19-stable tree To: ebiggers@google.com, ebiggers@kernel.org, gregkh@linuxfoundation.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org From: Date: Wed, 30 Dec 2020 16:42:04 +0100 In-Reply-To: <20201228191211.138300-5-ebiggers@kernel.org> Message-ID: <160934292474165@kroah.com> MIME-Version: 1.0 X-stable: commit X-Patchwork-Hint: ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201230_104048_493316_D222345A X-CRM114-Status: GOOD ( 14.80 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable-commits@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org This is a note to let you know that I've just added the patch titled ubifs: prevent creating duplicate encrypted filenames to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ubifs-prevent-creating-duplicate-encrypted-filenames.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Wed Dec 30 04:40:58 PM CET 2020 From: Eric Biggers Date: Mon, 28 Dec 2020 11:12:11 -0800 Subject: ubifs: prevent creating duplicate encrypted filenames To: stable@vger.kernel.org Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org Message-ID: <20201228191211.138300-5-ebiggers@kernel.org> From: Eric Biggers commit 76786a0f083473de31678bdb259a3d4167cf756d upstream. As described in "fscrypt: add fscrypt_is_nokey_name()", it's possible to create a duplicate filename in an encrypted directory by creating a file concurrently with adding the directory's encryption key. Fix this bug on ubifs by rejecting no-key dentries in ubifs_create(), ubifs_mkdir(), ubifs_mknod(), and ubifs_symlink(). Note that ubifs doesn't actually report the duplicate filenames from readdir, but rather it seems to replace the original dentry with a new one (which is still wrong, just a different effect from ext4). On ubifs, this fixes xfstest generic/595 as well as the new xfstest I wrote specifically for this bug. Fixes: f4f61d2cc6d8 ("ubifs: Implement encrypted filenames") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20201118075609.120337-5-ebiggers@kernel.org Signed-off-by: Eric Biggers Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/dir.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -290,6 +290,15 @@ done: return d_splice_alias(inode, dentry); } +static int ubifs_prepare_create(struct inode *dir, struct dentry *dentry, + struct fscrypt_name *nm) +{ + if (fscrypt_is_nokey_name(dentry)) + return -ENOKEY; + + return fscrypt_setup_filename(dir, &dentry->d_name, 0, nm); +} + static int ubifs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) { @@ -313,7 +322,7 @@ static int ubifs_create(struct inode *di if (err) return err; - err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); + err = ubifs_prepare_create(dir, dentry, &nm); if (err) goto out_budg; @@ -977,7 +986,7 @@ static int ubifs_mkdir(struct inode *dir if (err) return err; - err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); + err = ubifs_prepare_create(dir, dentry, &nm); if (err) goto out_budg; @@ -1062,7 +1071,7 @@ static int ubifs_mknod(struct inode *dir return err; } - err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); + err = ubifs_prepare_create(dir, dentry, &nm); if (err) { kfree(dev); goto out_budg; @@ -1146,7 +1155,7 @@ static int ubifs_symlink(struct inode *d if (err) return err; - err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); + err = ubifs_prepare_create(dir, dentry, &nm); if (err) goto out_budg; Patches currently in stable-queue which might be from ebiggers@kernel.org are queue-4.19/fscrypt-add-fscrypt_is_nokey_name.patch queue-4.19/ext4-prevent-creating-duplicate-encrypted-filenames.patch queue-4.19/ubifs-prevent-creating-duplicate-encrypted-filenames.patch queue-4.19/f2fs-prevent-creating-duplicate-encrypted-filenames.patch ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/