ext4: never move the system.data xattr out of the inode body
Subsystems (2)
PATCH 1/1 ext4: never move the system.data xattr out of the inode body
From: Theodore Ts'o <[email protected]>
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
---
I thought the 4.4.y backport should apply, but I think it doesn't after all. This backport applies to v4.9.y.
fs/ext4/xattr.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ext4/xattr.c +5 -0
@@ -1426,6 +1426,11 @@ static int ext4_xattr_make_inode_space(handle_t *handle, struct inode *inode, last =IFIRST (header);/* Find the entry best suited to be pushed into EA block */ 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);
Signature · 1 line
2.7.4
Hi,
Quoted 13 lines · Guenter Roeck
From: Theodore Ts'o <[email protected]>
commit
8cdb5240ec5928b20490a2bb34cb87e9a5f40226upstream.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
Quoted 7 lines
Signed-off-by Theodore Ts'o <[email protected]>[groeck: Context changes]Signed-off-by Guenter Roeck <[email protected]>---
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 (林上智)
Quoted 1 line
From
2793f91d47ba4fd0e45f532ff7345d9ed459f083Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
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
--- fs/ext4/xattr.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ext4/xattr.c +5 -0
@@ -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);
Signature · 1 line
2.19.0
Greg Kroah-Hartman
maintainerQuoted 13 lines · Guenter Roeck
From: Theodore Ts'o <[email protected]>
commit
8cdb5240ec5928b20490a2bb34cb87e9a5f40226upstream.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
Quoted 7 lines
Signed-off-by Theodore Ts'o <[email protected]>[groeck: Context changes]Signed-off-by Guenter Roeck <[email protected]>---
I thought the 4.4.y backport should apply, but I think it doesn't after all. This backport applies to v4.9.y.
Thanks, that worked.
greg k-h