All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4.4.y] ext4: never move the system.data xattr out of the inode body
@ 2018-09-28 16:21 Zubin Mithra
  2018-09-30 15:28 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Zubin Mithra @ 2018-09-28 16:21 UTC (permalink / raw)
  To: stable; +Cc: gregkh, tytso, natechancellor, groeck, zsm

From: Theodore Ts'o <tytso@mit.edu>

commit 8cdb5240ec5928b20490a2bb34cb87e9a5f40226 upstream.

When expanding the extra isize space, we must never move the
system.data xattr out of the inode body.  For performance reasons, it
doesn't make any sense, and the inline data implementation assumes
that system.data xattr is never in the external xattr block.

This addresses CVE-2018-10880

https://bugzilla.kernel.org/show_bug.cgi?id=200005

Backport Note:
- dfa2064b22("ext4: factor out loop for freeing inode xattr space")
factored out the loop from inside ext4_expand_extra_isize_ea to a
separate function named ext4_xattr_make_inode_space. As the above commit
is not present in 4.4.y, make the change inside ext4_expand_extra_isize_ea.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Zubin Mithra <zsm@chromium.org>
---
 fs/ext4/xattr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 9fb2a751fce4..b51bb73b06a6 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1386,6 +1386,11 @@ retry:
 		/* Find the entry best suited to be pushed into EA block */
 		entry = NULL;
 		for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
+			/* never move system.data out of the inode */
+			if ((last->e_name_len == 4) &&
+			    (last->e_name_index == EXT4_XATTR_INDEX_SYSTEM) &&
+			    !memcmp(last->e_name, "data", 4))
+				continue;
 			total_size =
 			EXT4_XATTR_SIZE(le32_to_cpu(last->e_value_size)) +
 					EXT4_XATTR_LEN(last->e_name_len);
-- 
2.19.0.605.g01d371f741-goog

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v4.4.y] ext4: never move the system.data xattr out of the inode body
  2018-09-28 16:21 [PATCH v4.4.y] ext4: never move the system.data xattr out of the inode body Zubin Mithra
@ 2018-09-30 15:28 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2018-09-30 15:28 UTC (permalink / raw)
  To: Zubin Mithra; +Cc: stable, tytso, natechancellor, groeck

On Fri, Sep 28, 2018 at 09:21:44AM -0700, Zubin Mithra wrote:
> From: Theodore Ts'o <tytso@mit.edu>
> 
> commit 8cdb5240ec5928b20490a2bb34cb87e9a5f40226 upstream.
> 
> When expanding the extra isize space, we must never move the
> system.data xattr out of the inode body.  For performance reasons, it
> doesn't make any sense, and the inline data implementation assumes
> that system.data xattr is never in the external xattr block.
> 
> This addresses CVE-2018-10880
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=200005
> 
> Backport Note:
> - dfa2064b22("ext4: factor out loop for freeing inode xattr space")
> factored out the loop from inside ext4_expand_extra_isize_ea to a
> separate function named ext4_xattr_make_inode_space. As the above commit
> is not present in 4.4.y, make the change inside ext4_expand_extra_isize_ea.


What about a 4.9.y version of this?  I can't just take a 4.4 version
because someone would suffer a regression if they moved from 4.4.y to
4.9.y :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-30 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28 16:21 [PATCH v4.4.y] ext4: never move the system.data xattr out of the inode body Zubin Mithra
2018-09-30 15:28 ` Greg KH

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.