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=-8.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT 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 3C6B3C433F4 for ; Mon, 24 Aug 2020 06:35:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B4E0208E4 for ; Mon, 24 Aug 2020 06:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598249899; bh=5Cg/F/P1MsSIqNAEKm5EcA85tMzmQDFgxtq+BwsOiXY=; h=From:To:Cc:Subject:Date:List-ID:From; b=hK8yrvEOAYTvR6bATXWuSPrYNA8KXk1MLdhIgZV0b0rI1jUY4jfV/tJ24jgnWS1Uq hW9RZ0l7Tw8gCDguXPyuPIHnhQPyd0T6cO4zXM8QQYE6F0DC5pK1hn+IOtJn70nlOT 6uxjady8SxdkxaA5kllbdTI5bZ51ONSl+5FbWeSk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725999AbgHXGSS (ORCPT ); Mon, 24 Aug 2020 02:18:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:49688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725770AbgHXGSS (ORCPT ); Mon, 24 Aug 2020 02:18:18 -0400 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD6CF206B5; Mon, 24 Aug 2020 06:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598249898; bh=5Cg/F/P1MsSIqNAEKm5EcA85tMzmQDFgxtq+BwsOiXY=; h=From:To:Cc:Subject:Date:From; b=f893nZOHOk74YywNd+s2c7KM7U+ApkFK+G5wAxPqs247sQ2FcptH0qP9EtwzvEYBf LROjPrF6b7H17wnj5KGsZaPkgvTF6yctFlLpC0zde7Uvt1Qfhq8ilvE8jBprCzObNr jbaGalIhOAIFifcUwA2qyoWoyI0iCcGdq4CofU6w= From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, ceph-devel@vger.kernel.org, Jeff Layton Subject: [RFC PATCH 0/8] fscrypt: avoid GFP_NOFS-unsafe key setup during transaction Date: Sun, 23 Aug 2020 23:17:04 -0700 Message-Id: <20200824061712.195654-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org This series fixes some deadlocks which are theoretically possible due to fscrypt_get_encryption_info() being GFP_NOFS-unsafe, and thus not safe to be called from within an ext4 transaction or under f2fs_lock_op(). The problem is solved by new helper functions which allow setting up the key for new inodes earlier. Patch 1 adds these helper functions. Also see that patch for a more detailed description of this problem. Patches 2-6 then convert ext4, f2fs, and ubifs to use these new helpers. Patch 7-8 then clean up a few things afterwards. Coincidentally, this also solves some of the ordering problems that ceph fscrypt support will have. For more details about this, see the discussion on Jeff Layton's RFC patchset for ceph fscrypt support (https://lkml.kernel.org/linux-fscrypt/20200821182813.52570-1-jlayton@kernel.org/T/#u) However, fscrypt_prepare_new_inode() still requires that the new 'struct inode' exist already, so it might not be enough for ceph yet. This patchset applies to v5.9-rc2. Eric Biggers (8): fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context() ext4: factor out ext4_xattr_credits_for_new_inode() ext4: remove some #ifdefs in ext4_xattr_credits_for_new_inode() ext4: use fscrypt_prepare_new_inode() and fscrypt_set_context() f2fs: use fscrypt_prepare_new_inode() and fscrypt_set_context() ubifs: use fscrypt_prepare_new_inode() and fscrypt_set_context() fscrypt: remove fscrypt_inherit_context() fscrypt: stop pretending that key setup is nofs-safe fs/crypto/fscrypt_private.h | 3 + fs/crypto/hooks.c | 10 +- fs/crypto/inline_crypt.c | 7 +- fs/crypto/keysetup.c | 190 ++++++++++++++++++++++++++++-------- fs/crypto/keysetup_v1.c | 8 +- fs/crypto/policy.c | 64 +++++++----- fs/ext4/ialloc.c | 118 +++++++++++----------- fs/f2fs/dir.c | 2 +- fs/f2fs/f2fs.h | 16 --- fs/f2fs/namei.c | 7 +- fs/ubifs/dir.c | 26 ++--- include/linux/fscrypt.h | 18 +++- 12 files changed, 293 insertions(+), 176 deletions(-) -- 2.28.0 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=-6.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no 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 5656FC4345A for ; Mon, 24 Aug 2020 06:35:27 +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 3DB21206B5; Mon, 24 Aug 2020 06:18:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="lPN+dSlk"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="GXe+vKfD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="f893nZOH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DB21206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.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-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kA5oL-0002Aw-PV; Mon, 24 Aug 2020 06:18:29 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kA5oL-0002Al-99 for linux-f2fs-devel@lists.sourceforge.net; Mon, 24 Aug 2020 06:18:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=eTytA6+3y4Po9Hme+7xm8vvdfibYXRJad7JIRTBOCVg=; b=lPN+dSlkMRS7zz6yShN8Sk4C0B Nly6y8ZX+/6YY+Ca9C7X7/DsxXIASCxHHDzYlYaRFub4pHIsR8ncLaX25QVjug90qb82PY3YKd6Nb lTxrFlpvR+QMcFXzkrpPsbF3jx9XxLL4kWbGuE0Uj1zNGl05iWc1d5wK9y5uFDFghYb4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=eTytA6+3y4Po9Hme+7xm8vvdfibYXRJad7JIRTBOCVg=; b=G Xe+vKfD83h657SUfQYJGyqib/DabcuuQbb/n6g39XkJMtSPlyMmREZ4e9BezyAR2zWjHwZEZG+3e3 Ev4Hgz58g56jZXGr1Gg6wHZHogRiN0gmPU6Wwc6mWYXBV4YmUDsKuRAVNikPNocqdbMVMVwMUKlkc UTQfp+C7iwd+3Ffk=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kA5oH-00GmMP-QM for linux-f2fs-devel@lists.sourceforge.net; Mon, 24 Aug 2020 06:18:29 +0000 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD6CF206B5; Mon, 24 Aug 2020 06:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598249898; bh=5Cg/F/P1MsSIqNAEKm5EcA85tMzmQDFgxtq+BwsOiXY=; h=From:To:Cc:Subject:Date:From; b=f893nZOHOk74YywNd+s2c7KM7U+ApkFK+G5wAxPqs247sQ2FcptH0qP9EtwzvEYBf LROjPrF6b7H17wnj5KGsZaPkgvTF6yctFlLpC0zde7Uvt1Qfhq8ilvE8jBprCzObNr jbaGalIhOAIFifcUwA2qyoWoyI0iCcGdq4CofU6w= From: Eric Biggers To: linux-fscrypt@vger.kernel.org Date: Sun, 23 Aug 2020 23:17:04 -0700 Message-Id: <20200824061712.195654-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Headers-End: 1kA5oH-00GmMP-QM Subject: [f2fs-dev] [RFC PATCH 0/8] fscrypt: avoid GFP_NOFS-unsafe key setup during transaction 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: Jeff Layton , ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mtd@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This series fixes some deadlocks which are theoretically possible due to fscrypt_get_encryption_info() being GFP_NOFS-unsafe, and thus not safe to be called from within an ext4 transaction or under f2fs_lock_op(). The problem is solved by new helper functions which allow setting up the key for new inodes earlier. Patch 1 adds these helper functions. Also see that patch for a more detailed description of this problem. Patches 2-6 then convert ext4, f2fs, and ubifs to use these new helpers. Patch 7-8 then clean up a few things afterwards. Coincidentally, this also solves some of the ordering problems that ceph fscrypt support will have. For more details about this, see the discussion on Jeff Layton's RFC patchset for ceph fscrypt support (https://lkml.kernel.org/linux-fscrypt/20200821182813.52570-1-jlayton@kernel.org/T/#u) However, fscrypt_prepare_new_inode() still requires that the new 'struct inode' exist already, so it might not be enough for ceph yet. This patchset applies to v5.9-rc2. Eric Biggers (8): fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context() ext4: factor out ext4_xattr_credits_for_new_inode() ext4: remove some #ifdefs in ext4_xattr_credits_for_new_inode() ext4: use fscrypt_prepare_new_inode() and fscrypt_set_context() f2fs: use fscrypt_prepare_new_inode() and fscrypt_set_context() ubifs: use fscrypt_prepare_new_inode() and fscrypt_set_context() fscrypt: remove fscrypt_inherit_context() fscrypt: stop pretending that key setup is nofs-safe fs/crypto/fscrypt_private.h | 3 + fs/crypto/hooks.c | 10 +- fs/crypto/inline_crypt.c | 7 +- fs/crypto/keysetup.c | 190 ++++++++++++++++++++++++++++-------- fs/crypto/keysetup_v1.c | 8 +- fs/crypto/policy.c | 64 +++++++----- fs/ext4/ialloc.c | 118 +++++++++++----------- fs/f2fs/dir.c | 2 +- fs/f2fs/f2fs.h | 16 --- fs/f2fs/namei.c | 7 +- fs/ubifs/dir.c | 26 ++--- include/linux/fscrypt.h | 18 +++- 12 files changed, 293 insertions(+), 176 deletions(-) -- 2.28.0 _______________________________________________ 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=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no 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 3C695C433F2 for ; Mon, 24 Aug 2020 06:35:27 +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 76D6722D02 for ; Mon, 24 Aug 2020 06:19:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m+7CEPPE"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="f893nZOH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76D6722D02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.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:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=QCTjl2e3yUMVNbrKIeXcKvpOA3S4qXXlP9wlj1rsRD8=; b=m+7CEPPEkigA5Phpa7hVk9GFjK 1Gp0cKORVzMaWkcn4M5TpVhTkJ8RIdG8f7bB4HfOsINXa0cdCk4hAKmkkCSrUN2k+Po+ATvoz7W5t tzP/f3PGkUBJPfwUz2BULum3j10qrvxFNTo/leCgnL8GfJAmoHhdlcf2GX0I9TbBuUhVtdhbwum4U 23ryjj7gj5e7YMkNlRjbgILgyo75zw5SOS6QELKPzWTd4/+RiSPRWsh0gQbKgq8MhTVIiWxbeS+0q 30InrODVw7WbFjBRXnmDD0bc3eERsa1Q19Ui4h7n8DkO0cBjY4XtXi5IS1CTGO5jQt/9iM3fDqyQT FPWQeqLw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kA5oP-0003lm-KX; Mon, 24 Aug 2020 06:18:33 +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 1kA5oC-0003he-Q0 for linux-mtd@lists.infradead.org; Mon, 24 Aug 2020 06:18:24 +0000 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD6CF206B5; Mon, 24 Aug 2020 06:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598249898; bh=5Cg/F/P1MsSIqNAEKm5EcA85tMzmQDFgxtq+BwsOiXY=; h=From:To:Cc:Subject:Date:From; b=f893nZOHOk74YywNd+s2c7KM7U+ApkFK+G5wAxPqs247sQ2FcptH0qP9EtwzvEYBf LROjPrF6b7H17wnj5KGsZaPkgvTF6yctFlLpC0zde7Uvt1Qfhq8ilvE8jBprCzObNr jbaGalIhOAIFifcUwA2qyoWoyI0iCcGdq4CofU6w= From: Eric Biggers To: linux-fscrypt@vger.kernel.org Subject: [RFC PATCH 0/8] fscrypt: avoid GFP_NOFS-unsafe key setup during transaction Date: Sun, 23 Aug 2020 23:17:04 -0700 Message-Id: <20200824061712.195654-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200824_021821_238014_AF1C76B3 X-CRM114-Status: GOOD ( 13.29 ) 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: Jeff Layton , ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mtd@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net 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 series fixes some deadlocks which are theoretically possible due to fscrypt_get_encryption_info() being GFP_NOFS-unsafe, and thus not safe to be called from within an ext4 transaction or under f2fs_lock_op(). The problem is solved by new helper functions which allow setting up the key for new inodes earlier. Patch 1 adds these helper functions. Also see that patch for a more detailed description of this problem. Patches 2-6 then convert ext4, f2fs, and ubifs to use these new helpers. Patch 7-8 then clean up a few things afterwards. Coincidentally, this also solves some of the ordering problems that ceph fscrypt support will have. For more details about this, see the discussion on Jeff Layton's RFC patchset for ceph fscrypt support (https://lkml.kernel.org/linux-fscrypt/20200821182813.52570-1-jlayton@kernel.org/T/#u) However, fscrypt_prepare_new_inode() still requires that the new 'struct inode' exist already, so it might not be enough for ceph yet. This patchset applies to v5.9-rc2. Eric Biggers (8): fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context() ext4: factor out ext4_xattr_credits_for_new_inode() ext4: remove some #ifdefs in ext4_xattr_credits_for_new_inode() ext4: use fscrypt_prepare_new_inode() and fscrypt_set_context() f2fs: use fscrypt_prepare_new_inode() and fscrypt_set_context() ubifs: use fscrypt_prepare_new_inode() and fscrypt_set_context() fscrypt: remove fscrypt_inherit_context() fscrypt: stop pretending that key setup is nofs-safe fs/crypto/fscrypt_private.h | 3 + fs/crypto/hooks.c | 10 +- fs/crypto/inline_crypt.c | 7 +- fs/crypto/keysetup.c | 190 ++++++++++++++++++++++++++++-------- fs/crypto/keysetup_v1.c | 8 +- fs/crypto/policy.c | 64 +++++++----- fs/ext4/ialloc.c | 118 +++++++++++----------- fs/f2fs/dir.c | 2 +- fs/f2fs/f2fs.h | 16 --- fs/f2fs/namei.c | 7 +- fs/ubifs/dir.c | 26 ++--- include/linux/fscrypt.h | 18 +++- 12 files changed, 293 insertions(+), 176 deletions(-) -- 2.28.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/