All of lore.kernel.org
 help / color / mirror / Atom feed
From: "SZ Lin (林上智)" <sz.lin@moxa.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Guenter Roeck <linux@roeck-us.net>
Cc: Zubin Mithra <zsm@chromium.org>,
	stable@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH v4.9.y] ext4: never move the system.data xattr out of the inode body
Date: Mon, 1 Oct 2018 13:49:25 +0800	[thread overview]
Message-ID: <20181001054925.GA8113@localhost> (raw)
In-Reply-To: <1538327868-27369-1-git-send-email-linux@roeck-us.net>

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

Hi,

On Sun, Sep 30, 2018 at 10:17:48AM -0700, Guenter Roeck 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
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Cc: stable@kernel.org
> [groeck: Context changes]
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> I thought the 4.4.y backport should apply, but I think it doesn't after
> all. This backport applies to v4.9.y.

This patch got a conflict in 4.4.y stable kernel, I've tweaked the context
for 4.4.y backporting.

Attached is the 4.4.y backport patch which was compiled successfully with
following environment setting.

kernel version: v4.4.159
toolchain: GCC 8.2.0
config: x86_64_defconfig

--
SZ Lin (林上智)

[-- Attachment #2: 0001-ext4-never-move-the-system.data-xattr-out-of-the-ino.patch --]
[-- Type: text/x-diff, Size: 1498 bytes --]

>From 2793f91d47ba4fd0e45f532ff7345d9ed459f083 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 16 Jun 2018 15:40:48 -0400
Subject: [PATCH] ext4: never move the system.data xattr out of the inode body

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

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
[SZ Lin (林上智): Tweak context for 4.4.y backporting]
Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
---
 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


  reply	other threads:[~2018-10-01 12:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-30 17:17 [PATCH v4.9.y] ext4: never move the system.data xattr out of the inode body Guenter Roeck
2018-10-01  5:49 ` SZ Lin (林上智) [this message]
2018-10-02 11:56 ` Greg Kroah-Hartman

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=20181001054925.GA8113@localhost \
    --to=sz.lin@moxa.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux@roeck-us.net \
    --cc=stable@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=zsm@chromium.org \
    /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.