Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2717651pxv; Sun, 11 Jul 2021 23:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVsdb3irWnZM4Uvc/VS3bSjrk/3T+Y5NKneR3Cgm/FFQjhHQZHl2zO+tzOtKtG1vBFw4pS X-Received: by 2002:a50:fd17:: with SMTP id i23mr17463463eds.270.1626072068908; Sun, 11 Jul 2021 23:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626072068; cv=none; d=google.com; s=arc-20160816; b=1DdhXHFRp2RsXAfJ+d6qdBCVzYHERRLJAABiaqN7wh8K1c6n69cRjUck9skJyi/i21 60LU/GZhGKonXBvHpwRk9bYWJGtSFEsoWFGPTcdbjNQd5ULV0xG+C0j7e0R7iB82KDYq lqJ68B1E5IHbveKZBYf9jehIZKVxCTOdjG6C21Kz8Wg7A7htO5iewehuOS1bXAOtnRi3 +4DzP0L5Vz7tQiCMwp9nEF+8tQP5T3CaJe/SWTakzQkNI0XiT5g12adDXlCJ89wmJj4j XpJrsjjOsjVdX83sjaHf5A4FjnhhcF/h3/6/I85nDXPI5KxzaU0J0g+k7ETLPsGOwZQt GoVQ== 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=CZhPES5evUn37ucVJLyMt3gnTs5du0pGDo9DTGfdCOqMGPzrwhtyP5sKunaYTYmRbE PJJKto83WM7DuiCHTvu41v30DF4h1p9B6+1lO/Fk5JVtojwE7Atxplo2za2DG0fgo8M5 vD6Q+KpKv8ZoiyJ2rQwgVJPPa8roQrwk3M8eF1cbO7ufteNdSVbu+kjeJyARgOrrh/Pc XpU+GR3RUeIp7UQRMRR6sTk0u3MsvAmX6WB022RWLxD+w4YQBZBBn1ay2O6AlCljhr/F lZ4NLLFfKVfhSCZf7PruTExqBmHWTFdfUeBzoLNqpHtj2g/Ci62/z2+fpTgn0jVlLb9H KSQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P4uBCulZ; 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 w5si17577145edv.342.2021.07.11.23.40.46; Sun, 11 Jul 2021 23:41:08 -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=P4uBCulZ; 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 S235991AbhGLGlZ (ORCPT + 99 others); Mon, 12 Jul 2021 02:41:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:55500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236598AbhGLGcY (ORCPT ); Mon, 12 Jul 2021 02:32:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E203610D1; Mon, 12 Jul 2021 06:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071375; bh=s0hSDXPGZNPiMQhMeECJGareszJcyKYanf7R9VEQUoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4uBCulZhcBdSeBHPNIB9P89tV00ipAcPnYvPq59Daju59cVKn3zFnGE0Glb6Atn+ wECpUJoTifjkPGQBYnjLVzam0HBFeq8rCndlmvPbi/G+7NVC1Qty6ksKIrGNsvALur SVkb1hNmhe3vL7XR8GsM4Gz355kp5h2Wk8ltrkBQ= 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.10 043/593] ext4: fix kernel infoleak via ext4_extent_header Date: Mon, 12 Jul 2021 08:03:23 +0200 Message-Id: <20210712060847.901755689@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@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);