Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4428818imw; Tue, 19 Jul 2022 06:31:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tE7YjOQITZyDFn4bHA3pCL/c4hUTSAGl17ljfQYpR87mt2l+SH+FBGZmxX7wb3m/2NibUl X-Received: by 2002:a17:907:6d86:b0:72b:5ad6:6df1 with SMTP id sb6-20020a1709076d8600b0072b5ad66df1mr32234470ejc.264.1658237468748; Tue, 19 Jul 2022 06:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658237468; cv=none; d=google.com; s=arc-20160816; b=CgyCgNPih3IEAMuDpdj8cJvckv643u2ZXVlEa23AY2JmRV1STPj1c7xQ0H+1ATQnMr +OwI7rX9VPvTG948PjUXsFX3neDyZVQzdK61uozWha9hNATwllcSZNGAVb4i9HdMLbQ6 6DCS8p8deYdtroen11F0pq2Z+SCXYKHRoI69mCKPgv5qBzzD5B089rsppZeuAdheFlU9 8BN3MSPX+z/LrjAmBjyy7QCpwIPkYmuztZqcDX6FmvnBlpE0Hmcs9/joquCrBd5R/w5Q eHnmWHhKy9fM4tunaviOcwFbNFZeoBqvbyrqgWwdruMP/Ck2CHFsJrBIQFSw9Q9wdF6v WrXQ== 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=SCddgAOa1YlKH30nN3jYAbojeyjBitopNsEiUfgEqw0=; b=G+FTl2PfW8pOptke+T/BzBD1Wi1QKkYFX+JfX/ueByctRq8S5O3O7Cv6trWxCfjNEx LvFj7GnZh8TQWQrJM0aDHYq2e2mMh9doNpjzKO/Wsrxx8W7w16/QAnZu/1GzHEnoMrim ZOQ1C98hjFlnP3z+rjdeMw5MPI2/MmuOB08hwjTSS8THLMQ8pqnmDhouKEEFAml74hAM VSCDPiU5WH9gRLwH0iMCn2FePot7cz/4FBPT2zABy+jempu64D0wThj2JoCxjrVIbsfT 3N72GieGDAmXPeucVUUTXorV1sUoc2Un9ZHS0tmdChi7ah8L6ARXWJThPtCqXWG4K6C2 vgnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="k/FtEi+8"; 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 w6-20020a056402268600b0043aad9460dfsi21179724edd.19.2022.07.19.06.30.44; Tue, 19 Jul 2022 06:31:08 -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="k/FtEi+8"; 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 S239960AbiGSM1s (ORCPT + 99 others); Tue, 19 Jul 2022 08:27:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239911AbiGSM0O (ORCPT ); Tue, 19 Jul 2022 08:26:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56003DFED; Tue, 19 Jul 2022 05:10:10 -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 ams.source.kernel.org (Postfix) with ESMTPS id 745F3B81B25; Tue, 19 Jul 2022 12:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A32C341C6; Tue, 19 Jul 2022 12:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232608; bh=IY9obyUbaF68yfYZpMGSF3IiznXLM6j2my70GgvTAUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k/FtEi+8tX70SJw8ASSxF6bZRjdvJ+ckXUDNj1nnkQHMoOnKymvk1SkmfiOo9iqEB 7VSqr7vdETgdCA6od6XckFLZ/gno8/PPCSDFFBu8A+vLWh+dfDgNVYMKI7XXXAdjpH BeKwMPtpp9bP4+4w3+mNJu9yXlkJLr/zhcFDiNeo= 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.10 097/112] x86: Clear .brk area at early boot Date: Tue, 19 Jul 2022 13:54:30 +0200 Message-Id: <20220719114636.205046014@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@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 05e117137b45..efe13ab366f4 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -419,6 +419,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