Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4469460imw; Tue, 19 Jul 2022 07:12:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vgwi8Q16JsFAI81SN+6q487hjfTg398nS5K5xwyzsR7GM/nGQjVGXiMx5APTwTLwnIh8+E X-Received: by 2002:a05:620a:147c:b0:6b5:e60b:a1e7 with SMTP id j28-20020a05620a147c00b006b5e60ba1e7mr6839541qkl.725.1658239947101; Tue, 19 Jul 2022 07:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658239947; cv=none; d=google.com; s=arc-20160816; b=ny38aLPdZKBHlnOBotWAGRztMdRDDdW4/Rz+G9IkZNKM3r4TB1LcW3wQc3rnSLfst2 3v4qiNsL7f6k//cRXx2TjSUu9NTJLr85Mbh0JqtMDjm64z0ZJUhcRJFYaFMYvdXAJNLI S19oXpAm5+MW8WwdrI+kVGgN2esxftmLIfO9VRav8wThygH66mhp08x9qIcreRyN5mEC wCrkr323epJ3IFJ5u209veB/71PV4swhYdGkPkroAk0tDze76b0EEZhFgyFhqiW1i9wB hDaGWDiifUKRLO11/gdOyYQfa8kaPMBKWEoHRszhy0KLesZBmbGCeHcTUoIKOk1LZ2Me /vWg== 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=JMF1lecoS02pITYjDHmjOtuvpDhzyDpff2TEN643ME0=; b=LVcaXPD5tWkTQChXT082tADqZnx1mDAK9do02giiamFmP4p4DPpIP7vJpSZYWHKGrq l3z8TfaSpPB34vey3wFUIlBDu68Jlo0zfsIVgXJ7paIKKIWqbvZZixtYkDtwP7RxYQ5M R0nrGbR1WYbnqLfnpwHOFgSFylCgPIIEHiVJXB9eRE7olI1QjNjKNgMcMFaK8+7QwhSG q3YY5sF8IfZUE7NPYhwvxZ160micf6lxNyMzFi5wOUe9TvEQp39tAca1Mcsi6U1WVILX qsgdbEduISQALxrXT+X1cxj1G5Kcb/FP1X/ilJo6VLnB4HhEBY8HYL+z7XWXH0QaqWyL b+dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IDVrPObO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bl20-20020a05620a1a9400b006b2543c5866si6907786qkb.18.2022.07.19.07.12.11; Tue, 19 Jul 2022 07:12:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IDVrPObO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S241591AbiGSMra (ORCPT + 99 others); Tue, 19 Jul 2022 08:47:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241584AbiGSMqj (ORCPT ); Tue, 19 Jul 2022 08:46:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD7D78B4BA; Tue, 19 Jul 2022 05:18:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 990216183D; Tue, 19 Jul 2022 12:18:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D8F5C341C6; Tue, 19 Jul 2022 12:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233102; bh=GfEQxJNjjHPalvfvVNCj9R5BmsifevUz1PfOtOY//7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IDVrPObOmA3cgOCm0z7d60SFTQZsJY5Ie2qig7M7tcD6xtiI4XDzag7aj5i7fSsbl ebSw08jQPmf4VanLoQplXR7Da8fSds+0a5X3l7RQehlMiHElS5/UVIW0jSYBv3eqBc mmSz9Urd7gvFeww7pkTf+yWJQSjjGviHVnEy6lAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Borislav Petkov , Sasha Levin Subject: [PATCH 5.15 149/167] x86: Clear .brk area at early boot Date: Tue, 19 Jul 2022 13:54:41 +0200 Message-Id: <20220719114710.861804071@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Juergen Gross [ Upstream commit 38fa5479b41376dc9d7f57e71c83514285a25ca0 ] The .brk section has the same properties as .bss: it is an alloc-only section and should be cleared before being used. Not doing so is especially a problem for Xen PV guests, as the hypervisor will validate page tables (check for writable page tables and hypervisor private bits) before accepting them to be used. Make sure .brk is initially zero by letting clear_bss() clear the brk area, too. Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20220630071441.28576-3-jgross@suse.com Signed-off-by: Sasha Levin --- arch/x86/kernel/head64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index de01903c3735..5036104d5470 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -418,6 +418,8 @@ static void __init clear_bss(void) { memset(__bss_start, 0, (unsigned long) __bss_stop - (unsigned long) __bss_start); + memset(__brk_base, 0, + (unsigned long) __brk_limit - (unsigned long) __brk_base); } static unsigned long get_cmd_line_ptr(void) -- 2.35.1