Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1332383imm; Tue, 2 Oct 2018 06:39:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV63sgvMES4JUVliQUSbUOLGS04ROpMNq5tM72N4NY2qLNuON+hW2byBMRdAuA7UNh8Fr0hFc X-Received: by 2002:a63:5a0d:: with SMTP id o13-v6mr14530717pgb.267.1538487596271; Tue, 02 Oct 2018 06:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538487596; cv=none; d=google.com; s=arc-20160816; b=bH5jTbZcJv0036cURmc5GthluzH6ABqOMO6mopLXc1gYPIH3ZdYsSYnnKwDReMDkBi +RNV01/utDv9h9uVq21nSCXNe6RRcTQR6OsZbZ6yGEGTL8ARdi2VEiKYu7tf09PzM1uJ Bq0ZGpvwQhVnMN7HmJtD0n5iWv4otWAIV1YRnEXYkFXn/POd2x+o0lzBsTDV3XMh9UPp 0tlFaNHmQfZX6oV3fqSiSEKORRNwGr251yGUJ2g08wgI1UR+I5YebPXfm1r/L2k5q72l T5um3DTGbdCoK2FirwBw/DgXCiHhnVqbS6hxpOovENJLgTMF2EIUXS12tCObAiVXoIVX cHkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=94MkV01V2Y1FUuYXg0F+r0zRVsyZV615vSy5IsHtLKU=; b=ns0JliwMz3n9Jq43/8STkK2tHWLZ0qjCchZONqkFLGHXinpSxS0G5hXU/xhMEQmHY9 yWk2jeRkEMj1/RnUxrRbrTgjCIjVsC6QIg5od/mGkZwONxVfk4TxfpjFIjT98isaswnW LpwZNgP/FzZ/zzN74r3OXckqUzfpu9VJgkooWqrJWKApj5AUbOEhxK9CyASuytJcnKwx kTLX8YVE+zNayqPGKr+rgyo9LMU6zMW1FZSaNJV8YeUwl0kaIok98WeDD/A1eZAyEu2p itW52N6Ry4ggkU6z8iSf+vCg3WkaqMIU/XY4q7j30omqq7SL1dR7zM2yPHFzm8PlLnHT cCpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b89-v6si10766446plb.143.2018.10.02.06.39.41; Tue, 02 Oct 2018 06:39:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387533AbeJBUUS (ORCPT + 99 others); Tue, 2 Oct 2018 16:20:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36484 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731241AbeJBUUS (ORCPT ); Tue, 2 Oct 2018 16:20:18 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 492615AA; Tue, 2 Oct 2018 13:36:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , stable@kernel.org, Guenter Roeck Subject: [PATCH 4.9 80/94] ext4: never move the system.data xattr out of the inode body Date: Tue, 2 Oct 2018 06:25:34 -0700 Message-Id: <20181002132506.076671947@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132500.494838053@linuxfoundation.org> References: <20181002132500.494838053@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o 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 Cc: stable@kernel.org [groeck: Context changes] Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- fs/ext4/xattr.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1426,6 +1426,11 @@ static int ext4_xattr_make_inode_space(h 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);