Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4434883imw; Tue, 19 Jul 2022 06:36:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sg8+Ks7eNro2Z/0GdLH7rOe8Z8KBk4/eafHyQVuutnn4k3ussaVXLghinwKD8ofueaitdn X-Received: by 2002:a05:6808:17a6:b0:33a:7cc7:a074 with SMTP id bg38-20020a05680817a600b0033a7cc7a074mr4265678oib.227.1658237787407; Tue, 19 Jul 2022 06:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658237787; cv=none; d=google.com; s=arc-20160816; b=q8v8brC4uQhHZUWBVf+wzbcKfn4hI0yx1mwmFVDbxaYErLNAmaocOMLwCHa1EUN+ql ir7vbv7dBNfRzVVqkUazmDi12syumXK1iASV9TdEk9x18EK6bmlreJmW13/LN1eCGQq6 kwlFGEPF170Y/spVoUKFrhbn2cnaHtlwjWZNdCCBJ55tez/2KZ3eQRv3lEcto0RvoEdg fmKUJYEgvVBfqmXNBZopLOZNXXb8LMNgT5WvECQJ+c3x2a+UcMuvGy50PHLpHkVZ6whx vJTeFQKy6B2kEEiz7aAAkbcuN5CJ3VJuIqnRCQuVxqRKbouWN2Ax6quD+6ZK0ki2d7Tb gXjw== 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=lYkc6ts2Ayr1tdEnxGITNWK4EirlAICnCbw2kKG0XEs=; b=pK/IhsLTLgG2a09daEf1KP5MsNFmvdObMzPyV0900kxdPDJ09hzr/RBH1uyInVTZ0X 9/Of4YXerGFdJY2XhCTVGgDJ46EgW0Se+NhJU8XNGpmzCR0kIsgXkHz3FgYgV3oaw+ws unlKFa4NVgo6chu7nQLyhcXNc5hQfXeny9yFIF6yvSvwmqP9gM8+auUkuRENOpfNKlV+ KuIKh3s8PnTZRsyiGf4JCFv7AhT3H5uSOQNa5t8Q5bs7xYw3bwZ/togwzpgnjcvjdMee 0VIrzadOKEwDr+UVxftb/I0vHQXxKMf90cEpz+w1JUOuM9uEnPOEfBQxIg0M0nFWvUCq euaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bLMIUgZk; 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 v6-20020a056870b50600b000f1be2642besi13024573oap.110.2022.07.19.06.36.13; Tue, 19 Jul 2022 06:36: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=bLMIUgZk; 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 S239140AbiGSMQR (ORCPT + 99 others); Tue, 19 Jul 2022 08:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239444AbiGSMOl (ORCPT ); Tue, 19 Jul 2022 08:14:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6D9348E94; Tue, 19 Jul 2022 05:05:36 -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 3247961632; Tue, 19 Jul 2022 12:04:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13D3FC341CA; Tue, 19 Jul 2022 12:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232279; bh=aCxKvGgvHIIyXlj7KbS97sr9G2YeS9r+HloRo3tKYo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bLMIUgZkTSkNz0sU4ocm6gjmQ5o5/ZlHU3nPPg/hXxmm2V/z3GiKbcE+kZWw52spv DirzHAoEoWKx3VrgiIbdBkpAy+CH+8x/If01iwaQfZ54n3Sx+Y5m+0yad1idkMo1hB 97zfq29fTFYAUat8ZKQI8dPwgLmJwH77jtns1ToE= 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.4 60/71] x86: Clear .brk area at early boot Date: Tue, 19 Jul 2022 13:54:23 +0200 Message-Id: <20220719114558.170826862@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114552.477018590@linuxfoundation.org> References: <20220719114552.477018590@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 206a4b6144c2..950286016f63 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -383,6 +383,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