All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: ebiggers@google.com, ebiggers@kernel.org,
	gregkh@linuxfoundation.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-mtd@lists.infradead.org, sarthakkukreti@chromium.org,
	tytso@mit.edu
Cc: stable-commits@vger.kernel.org
Subject: [f2fs-dev] Patch "fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory" has been added to the 4.19-stable tree
Date: Sun, 01 Nov 2020 11:39:02 +0100	[thread overview]
Message-ID: <16042271428367@kroah.com> (raw)
In-Reply-To: <20201031220553.1085782-4-ebiggers@kernel.org>


This is a note to let you know that I've just added the patch titled

    fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory

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:
     fs-fscrypt-clear-dcache_encrypted_name-when-unaliasing-directory.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 <stable@vger.kernel.org> know about it.


From foo@baz Sun Nov  1 11:35:18 AM CET 2020
From: Eric Biggers <ebiggers@kernel.org>
Date: Sat, 31 Oct 2020 15:05:51 -0700
Subject: fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory
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, Sarthak Kukreti <sarthakkukreti@chromium.org>, Theodore Ts'o <tytso@mit.edu>
Message-ID: <20201031220553.1085782-4-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

commit 0bf3d5c1604ecbbd4e49e9f5b3c79152b87adb0d upstream.

Make __d_move() clear DCACHE_ENCRYPTED_NAME on the source dentry.  This
is needed for when d_splice_alias() moves a directory's encrypted alias
to its decrypted alias as a result of the encryption key being added.

Otherwise, the decrypted alias will incorrectly be invalidated on the
next lookup, causing problems such as unmounting a mount the user just
mount()ed there.

Note that we don't have to support arbitrary moves of this flag because
fscrypt doesn't allow dentries with DCACHE_ENCRYPTED_NAME to be the
source or target of a rename().

Fixes: 28b4c263961c ("ext4 crypto: revalidate dentry after adding or removing the key")
Reported-by: Sarthak Kukreti <sarthakkukreti@chromium.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/dcache.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2713,6 +2713,20 @@ static void copy_name(struct dentry *den
 }
 
 /*
+ * When d_splice_alias() moves a directory's encrypted alias to its decrypted
+ * alias as a result of the encryption key being added, DCACHE_ENCRYPTED_NAME
+ * must be cleared.  Note that we don't have to support arbitrary moves of this
+ * flag because fscrypt doesn't allow encrypted aliases to be the source or
+ * target of a rename().
+ */
+static inline void fscrypt_handle_d_move(struct dentry *dentry)
+{
+#if IS_ENABLED(CONFIG_FS_ENCRYPTION)
+	dentry->d_flags &= ~DCACHE_ENCRYPTED_NAME;
+#endif
+}
+
+/*
  * __d_move - move a dentry
  * @dentry: entry to move
  * @target: new dentry
@@ -2787,6 +2801,7 @@ static void __d_move(struct dentry *dent
 	list_move(&dentry->d_child, &dentry->d_parent->d_subdirs);
 	__d_rehash(dentry);
 	fsnotify_update_flags(dentry);
+	fscrypt_handle_d_move(dentry);
 
 	write_seqcount_end(&target->d_seq);
 	write_seqcount_end(&dentry->d_seq);


Patches currently in stable-queue which might be from ebiggers@kernel.org are

queue-4.19/fscrypt-only-set-dentry_operations-on-ciphertext-dentries.patch
queue-4.19/fscrypt-clean-up-and-improve-dentry-revalidation.patch
queue-4.19/fscrypt-fix-race-allowing-rename-and-link-of-ciphertext-dentries.patch
queue-4.19/fs-fscrypt-clear-dcache_encrypted_name-when-unaliasing-directory.patch
queue-4.19/fscrypt-fix-race-where-lookup-marks-plaintext-dentry-as-ciphertext.patch


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
From: <gregkh@linuxfoundation.org>
To: ebiggers@google.com, ebiggers@kernel.org,
	gregkh@linuxfoundation.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-mtd@lists.infradead.org, sarthakkukreti@chromium.org,
	tytso@mit.edu
Cc: stable-commits@vger.kernel.org
Subject: Patch "fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory" has been added to the 4.19-stable tree
Date: Sun, 01 Nov 2020 11:39:02 +0100	[thread overview]
Message-ID: <16042271428367@kroah.com> (raw)
In-Reply-To: <20201031220553.1085782-4-ebiggers@kernel.org>


This is a note to let you know that I've just added the patch titled

    fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory

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:
     fs-fscrypt-clear-dcache_encrypted_name-when-unaliasing-directory.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 <stable@vger.kernel.org> know about it.


From foo@baz Sun Nov  1 11:35:18 AM CET 2020
From: Eric Biggers <ebiggers@kernel.org>
Date: Sat, 31 Oct 2020 15:05:51 -0700
Subject: fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory
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, Sarthak Kukreti <sarthakkukreti@chromium.org>, Theodore Ts'o <tytso@mit.edu>
Message-ID: <20201031220553.1085782-4-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

commit 0bf3d5c1604ecbbd4e49e9f5b3c79152b87adb0d upstream.

Make __d_move() clear DCACHE_ENCRYPTED_NAME on the source dentry.  This
is needed for when d_splice_alias() moves a directory's encrypted alias
to its decrypted alias as a result of the encryption key being added.

Otherwise, the decrypted alias will incorrectly be invalidated on the
next lookup, causing problems such as unmounting a mount the user just
mount()ed there.

Note that we don't have to support arbitrary moves of this flag because
fscrypt doesn't allow dentries with DCACHE_ENCRYPTED_NAME to be the
source or target of a rename().

Fixes: 28b4c263961c ("ext4 crypto: revalidate dentry after adding or removing the key")
Reported-by: Sarthak Kukreti <sarthakkukreti@chromium.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/dcache.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2713,6 +2713,20 @@ static void copy_name(struct dentry *den
 }
 
 /*
+ * When d_splice_alias() moves a directory's encrypted alias to its decrypted
+ * alias as a result of the encryption key being added, DCACHE_ENCRYPTED_NAME
+ * must be cleared.  Note that we don't have to support arbitrary moves of this
+ * flag because fscrypt doesn't allow encrypted aliases to be the source or
+ * target of a rename().
+ */
+static inline void fscrypt_handle_d_move(struct dentry *dentry)
+{
+#if IS_ENABLED(CONFIG_FS_ENCRYPTION)
+	dentry->d_flags &= ~DCACHE_ENCRYPTED_NAME;
+#endif
+}
+
+/*
  * __d_move - move a dentry
  * @dentry: entry to move
  * @target: new dentry
@@ -2787,6 +2801,7 @@ static void __d_move(struct dentry *dent
 	list_move(&dentry->d_child, &dentry->d_parent->d_subdirs);
 	__d_rehash(dentry);
 	fsnotify_update_flags(dentry);
+	fscrypt_handle_d_move(dentry);
 
 	write_seqcount_end(&target->d_seq);
 	write_seqcount_end(&dentry->d_seq);


Patches currently in stable-queue which might be from ebiggers@kernel.org are

queue-4.19/fscrypt-only-set-dentry_operations-on-ciphertext-dentries.patch
queue-4.19/fscrypt-clean-up-and-improve-dentry-revalidation.patch
queue-4.19/fscrypt-fix-race-allowing-rename-and-link-of-ciphertext-dentries.patch
queue-4.19/fs-fscrypt-clear-dcache_encrypted_name-when-unaliasing-directory.patch
queue-4.19/fscrypt-fix-race-where-lookup-marks-plaintext-dentry-as-ciphertext.patch

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2020-11-01 10:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31 22:05 [PATCH 4.19 0/5] backport some more fscrypt fixes to 4.19 Eric Biggers
2020-10-31 22:05 ` Eric Biggers
2020-10-31 22:05 ` [f2fs-dev] " Eric Biggers
2020-10-31 22:05 ` [PATCH 4.19 1/5] fscrypt: clean up and improve dentry revalidation Eric Biggers
2020-10-31 22:05   ` Eric Biggers
2020-10-31 22:05   ` [f2fs-dev] " Eric Biggers
2020-11-01 10:39   ` [f2fs-dev] Patch "fscrypt: clean up and improve dentry revalidation" has been added to the 4.19-stable tree gregkh
2020-11-01 10:39     ` gregkh
2020-10-31 22:05 ` [PATCH 4.19 2/5] fscrypt: fix race allowing rename() and link() of ciphertext dentries Eric Biggers
2020-10-31 22:05   ` Eric Biggers
2020-10-31 22:05   ` [f2fs-dev] " Eric Biggers
2020-11-01 10:39   ` [f2fs-dev] Patch "fscrypt: fix race allowing rename() and link() of ciphertext dentries" has been added to the 4.19-stable tree gregkh
2020-11-01 10:39     ` gregkh
2020-10-31 22:05 ` [PATCH 4.19 3/5] fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory Eric Biggers
2020-10-31 22:05   ` Eric Biggers
2020-10-31 22:05   ` [f2fs-dev] " Eric Biggers
2020-11-01 10:39   ` gregkh [this message]
2020-11-01 10:39     ` Patch "fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory" has been added to the 4.19-stable tree gregkh
2020-10-31 22:05 ` [PATCH 4.19 4/5] fscrypt: only set dentry_operations on ciphertext dentries Eric Biggers
2020-10-31 22:05   ` Eric Biggers
2020-10-31 22:05   ` [f2fs-dev] " Eric Biggers
2020-11-01 10:39   ` [f2fs-dev] Patch "fscrypt: only set dentry_operations on ciphertext dentries" has been added to the 4.19-stable tree gregkh
2020-11-01 10:39     ` gregkh
2020-10-31 22:05 ` [PATCH 4.19 5/5] fscrypt: fix race where ->lookup() marks plaintext dentry as ciphertext Eric Biggers
2020-10-31 22:05   ` Eric Biggers
2020-10-31 22:05   ` [f2fs-dev] " Eric Biggers
2020-11-01 10:39   ` [f2fs-dev] Patch "fscrypt: fix race where ->lookup() marks plaintext dentry as ciphertext" has been added to the 4.19-stable tree gregkh
2020-11-01 10:39     ` gregkh
2020-11-01 10:39 ` [PATCH 4.19 0/5] backport some more fscrypt fixes to 4.19 Greg KH
2020-11-01 10:39   ` Greg KH
2020-11-01 10:39   ` [f2fs-dev] " Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16042271428367@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=ebiggers@google.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sarthakkukreti@chromium.org \
    --cc=stable-commits@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.