Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5660405iog; Thu, 23 Jun 2022 02:48:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1umouQrVSy+Ir2U6b2fX7OgFKtBaB73rvGRQ9sPWljmajnDwPSN7/DAKd3ytBYHuzI/CBuz X-Received: by 2002:a17:907:94d2:b0:722:e4fa:89f7 with SMTP id dn18-20020a17090794d200b00722e4fa89f7mr7490623ejc.603.1655977698185; Thu, 23 Jun 2022 02:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655977698; cv=none; d=google.com; s=arc-20160816; b=w30mjUa4+zCI4Cpy2mnaOQU9pD07S+2YRpM7b6eJBUH/bcu+9dZP5vCWAfKsRg3o0Q vUkl71cDSpZiD2ACtkf/k7qAP3bgb/AtgyseSSmQ+Ik2EAto8qRTkvhGVr+qf8JWPimp aOJ44ZQD05l4XAuruNiwUdX001Lzwjyik6kpxBfqn1nWMa7PZxSFFpP04CcL82Ljv9Ed ilJ4mPaRGVJ2OqHlWm7VcukMr5lX4R5+2100ei8Z15vbyV/PTtkEQmJzD4rikdtfqw2j sMtkY75iWjA9oGXj4ZyvvdTJZQ7Io5yfsh5tdYpqhD75XNARWYNtpOqKC3fvXJa3iYQk TzdA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bYI7V/dmnXpWZM2zlRb/pc+ci8hD5Th5E8mJSClVr9Q=; b=wpnF8fgUHKGl3gHbH09JyR1JF8kipQ1NUxkM/sRood7gKgT/n/kgdoCZPgeFI00hPz jsIG6Znurf+EYzlhgw74dvVhi2q+KogZ6efWqWzvPQTHpK2iFRjsF51R9rsdmqnFGeWV yf0WmgrxgD7eKzF9SCCwCI5O60tqykd/ZV0fAzhsavL8xfg4mVZqUqupM+K3+0NwYaTs ayC8NCZIDqHOOihdIghBJw3Izs9g6utjv/CqU6Bql0dYKS0aK9PTxoDuUaud784d16kM Wfxy40ron6aTpMdBWdmHuwPKhIJOHZssiO1DKXwU96ArqGyvsH3lr6fFFXhzB3JNpyOf EghA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ibWYLSIp; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h39-20020a0564020ea700b004356df20690si15081519eda.211.2022.06.23.02.47.53; Thu, 23 Jun 2022 02:48:18 -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=@suse.com header.s=susede1 header.b=ibWYLSIp; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231247AbiFWJq0 (ORCPT + 99 others); Thu, 23 Jun 2022 05:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231154AbiFWJqO (ORCPT ); Thu, 23 Jun 2022 05:46:14 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EF1C4992A for ; Thu, 23 Jun 2022 02:46:13 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0B5AB21D14; Thu, 23 Jun 2022 09:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1655977572; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bYI7V/dmnXpWZM2zlRb/pc+ci8hD5Th5E8mJSClVr9Q=; b=ibWYLSIpJW3cxc8VSyWjDZrMrjlU3h6E5ttl0nic13fOU+GJYulTpVShiW7JRjZs1Cdb/g 3Sm4LdhKI2YpIuuRVieTgokm3PWXoIahWFwWWt60PzWC0PDY9EPCX1U7ReIJOg3y7Oi81V XzYONG1YZZnLXEbgbiBqj/5espOq4aw= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BE492133A6; Thu, 23 Jun 2022 09:46:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EFUOLWM2tGLmLwAAMHmgww (envelope-from ); Thu, 23 Jun 2022 09:46:11 +0000 From: Juergen Gross To: xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH v2 3/3] x86: fix .brk attribute in linker script Date: Thu, 23 Jun 2022 11:46:08 +0200 Message-Id: <20220623094608.7294-4-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220623094608.7294-1-jgross@suse.com> References: <20220623094608.7294-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Commit e32683c6f7d2 ("x86/mm: Fix RESERVE_BRK() for older binutils") added the "NOLOAD" attribute to the .brk section as a "failsafe" measure. Unfortunately this leads to the linker no longer covering the .brk section in a program header, resulting in the kernel loader not knowing that the memory for the .brk section must be reserved. This has led to crashes when loading the kernel as PV dom0 under Xen, but other scenarios could be hit by the same problem (e.g. in case an uncompressed kernel is used and the initrd is placed directly behind it). So drop the "NOLOAD" attribute. This has been verified to correctly cover the .brk section by a program header of the resulting ELF file. Fixes: e32683c6f7d2 ("x86/mm: Fix RESERVE_BRK() for older binutils") Signed-off-by: Juergen Gross --- V2: - new patch --- arch/x86/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 81aba718ecd5..9487ce8c13ee 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -385,7 +385,7 @@ SECTIONS __end_of_kernel_reserve = .; . = ALIGN(PAGE_SIZE); - .brk (NOLOAD) : AT(ADDR(.brk) - LOAD_OFFSET) { + .brk : AT(ADDR(.brk) - LOAD_OFFSET) { __brk_base = .; . += 64 * 1024; /* 64k alignment slop space */ *(.bss..brk) /* areas brk users have reserved */ -- 2.35.3