Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3762913pxv; Mon, 19 Jul 2021 08:11:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBd5E8Ui50x+eQUIUoupPamGi2SPVE7/LWsFcJLBM54j16H4pm8kk1YymHBAzPjiW/ePjA X-Received: by 2002:a05:600c:2319:: with SMTP id 25mr32536636wmo.91.1626707489288; Mon, 19 Jul 2021 08:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626707489; cv=none; d=google.com; s=arc-20160816; b=VKCIYMg1Z3fnH286/Bo8OQbhUakXIGZAPK09PbugjJKDptY+x1BnIjrTIOLLQZ85wy Bu4dKEn1mqVTq7XJpS1iu2/N4NGgBVGjb2KT2lkGdSLHi/GUDsvCsjbllrG2aUPubmPM WzY8dqmFX4pDr5vecFwuOLjONs0VhUlRMbxxK4tyydEfFuSqecCRCpr8rBKrFPk4KXFf ewWGZIBY//dNmeqn2sWgIoRNSQHNg23GZ/PuV0oPkn45Ey5nMoUAHpmWn20sshVBT3AC hCHlTagW/M40/NeI3YcbZ0eGGMWRYprzI7t5Cgng7gT1XpeENtT8Z6ymc9w15XhXLYLs jmJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HC1s2Qy6USGeovshuF+S7BpkZ95Bi56DEZnkjYNaRe4=; b=r8lAi7EMSe4Ib6sP5kmKgnMokGHMW8Mh3hCLnLrr26dMS59LVouA0KypDzoxDbpFfa rL+ez8wh/EzpOXrJw+SssNxF4Lwag49lPcyg+rIaVTvgLmhp5qW+3ErRLAIbW2fejTM5 oT8lIoEbw7v8PZPDztU4cYBr1U2fMSq6YYprCpmObLpI8+asYhrfWEfYBiTdUCs9pJD2 5q7d0pnlRt8F71ozIOEEm6nRgiDRWSHQHwuLbOuu+QBTc4KDZvmmhlhFwPtTbngDuQ/+ bYEQeTBxgnR9Uwegb/YbS14np1KCptmDKwLQX/1UBlqyD6uQwfm4/6jM/JS6FWZigShh SgDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TGzVZA1m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si15876682edd.279.2021.07.19.08.11.06; Mon, 19 Jul 2021 08:11:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TGzVZA1m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241696AbhGSO2x (ORCPT + 99 others); Mon, 19 Jul 2021 10:28:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:57198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243821AbhGSOYa (ORCPT ); Mon, 19 Jul 2021 10:24:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E258361002; Mon, 19 Jul 2021 15:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626707050; bh=53vGsTxgSpEvr9yg1SLxAPmPyQkZwT9fG5eQ7v8qeNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TGzVZA1m2OH1VYyQkHyaapvWezr2nr0WQoiJ6F8SoprVlQHNEoVT3HDjTUej+CCPC UNYToLctT43Yq36n6Vcq6q21WfaBqVO2gu9IiyM3pIRPIRtfxuAYETBpqI8qNQ4Yyh JCmcN1iaqOV+Rac66Pc77NE3XcADgmvbJQutFdxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, syzbot+2dcfeaf8cb49b05e8f1a@syzkaller.appspotmail.com, Anirudh Rayabharam , Theodore Tso Subject: [PATCH 4.9 012/245] ext4: fix kernel infoleak via ext4_extent_header Date: Mon, 19 Jul 2021 16:49:14 +0200 Message-Id: <20210719144940.785735982@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144940.288257948@linuxfoundation.org> References: <20210719144940.288257948@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anirudh Rayabharam commit ce3aba43599f0b50adbebff133df8d08a3d5fffe upstream. Initialize eh_generation of struct ext4_extent_header to prevent leaking info to userspace. Fixes KMSAN kernel-infoleak bug reported by syzbot at: http://syzkaller.appspot.com/bug?id=78e9ad0e6952a3ca16e8234724b2fa92d041b9b8 Cc: stable@kernel.org Reported-by: syzbot+2dcfeaf8cb49b05e8f1a@syzkaller.appspotmail.com Fixes: a86c61812637 ("[PATCH] ext3: add extent map support") Signed-off-by: Anirudh Rayabharam Link: https://lore.kernel.org/r/20210506185655.7118-1-mail@anirudhrb.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/extents.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -870,6 +870,7 @@ int ext4_ext_tree_init(handle_t *handle, eh->eh_entries = 0; eh->eh_magic = EXT4_EXT_MAGIC; eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0)); + eh->eh_generation = 0; ext4_mark_inode_dirty(handle, inode); return 0; } @@ -1126,6 +1127,7 @@ static int ext4_ext_split(handle_t *hand neh->eh_max = cpu_to_le16(ext4_ext_space_block(inode, 0)); neh->eh_magic = EXT4_EXT_MAGIC; neh->eh_depth = 0; + neh->eh_generation = 0; /* move remainder of path[depth] to the new leaf */ if (unlikely(path[depth].p_hdr->eh_entries != @@ -1203,6 +1205,7 @@ static int ext4_ext_split(handle_t *hand neh->eh_magic = EXT4_EXT_MAGIC; neh->eh_max = cpu_to_le16(ext4_ext_space_block_idx(inode, 0)); neh->eh_depth = cpu_to_le16(depth - i); + neh->eh_generation = 0; fidx = EXT_FIRST_INDEX(neh); fidx->ei_block = border; ext4_idx_store_pblock(fidx, oldblock);