Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2893906pxv; Mon, 12 Jul 2021 04:38:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhPL46gm05uoo+KpEb//YHpAQi+jFmyhoHfkgNOcB3sMa/X6/BXxLi/JMMSKFYo9+QMJT1 X-Received: by 2002:a02:9109:: with SMTP id a9mr44460962jag.93.1626089898486; Mon, 12 Jul 2021 04:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626089898; cv=none; d=google.com; s=arc-20160816; b=hDeWK4d5hWzha3I2b5PizcTiKv0nbXifmls89IAzeQ7EgfgNVZcdS8RIN/fzMA0FdX 83/eLn00oCEyBNln81VKEK8egmuvCa3gnnjvGhBzk8Qa6azLMi9CYTiIt+cigKiA+GkW 1DL2qlo8PWfhrbWRO2qeYP05ekrN7b7b0gNlar5A8O5cNweQzM3KM2CCzYYxicNr2fJh IsE35YVVh0ga22P8fCQfdu1wVKP3jpzfX7QlBpkyhqrtBE4REGvTZQikdpe0jQmHApTe cDRnqoJ4da7W3IiuGTeuOcK5mcPQpcdi0XIPzY70/3PmP73mIv9XP+pe4WmWiWpy/sO7 r/nw== 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=SbrWxbUM6x3w6uZ+2E/fQL2JdSjoxiyYCCc8D/W8nfk=; b=kHSijJXcpnUGGmKxNe4iBcrWCA72l9np5YtRMjNAigVOOhba9m9L457xZcbWpsg7oZ eG7Tsb+BaeikbaVqpNqZLlLasgH8BGJhLsq1jGKVsaIvM2vzzrHD7JGLu27uF0fCXP9A pgKAH9QjrSI2SnzlpnJJ8Xc+3WOXGKZUTI+qyXoVMgs10fZkRAnsloHNTH3AgxBQhM5c jClEVuWWT3OUqHLv/Xawbht2gNyLfg4qUh0Zlj1zFwuFxPgdtQjbmUVMV9NGh0p6Qt+I 3/K0MmB61jOHmBRobb84MaW7BzUjLeivOC0t1Mam2yt1bk9Kp5KNh7Yie8m2o2n0lpSg J8UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rqoJUJyy; 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 u15si19308756iot.89.2021.07.12.04.38.06; Mon, 12 Jul 2021 04:38:18 -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=rqoJUJyy; 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 S1356383AbhGLIQZ (ORCPT + 99 others); Mon, 12 Jul 2021 04:16:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:51136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344638AbhGLHb4 (ORCPT ); Mon, 12 Jul 2021 03:31:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1ED8460C40; Mon, 12 Jul 2021 07:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074948; bh=s0hSDXPGZNPiMQhMeECJGareszJcyKYanf7R9VEQUoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqoJUJyyHM56gzzBH4wa40qglFVg9TT5w496GI35W1b11XZBdCpaTXqni4SHgbikT W7q1lzvTvydsZAVVqAo4OkU+8jFWx+70IvqDqC843x+fnpa1BIqX9O3zlGUR3R4SAj ewYkJhXTt3E/4I2niOpiWg8HLuPNlBYyftaM3hVY= 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 5.13 053/800] ext4: fix kernel infoleak via ext4_extent_header Date: Mon, 12 Jul 2021 08:01:16 +0200 Message-Id: <20210712060920.899159528@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060912.995381202@linuxfoundation.org> References: <20210712060912.995381202@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 @@ -825,6 +825,7 @@ void 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); } @@ -1090,6 +1091,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 != @@ -1167,6 +1169,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);