Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2318212ybl; Thu, 9 Jan 2020 10:36:12 -0800 (PST) X-Google-Smtp-Source: APXvYqx1Xq2nJURwQAD4jRoRbgYgh1OjvI4OusGbogNsZnIEk6Xn6ltO174ouCpLC3vlI2pZ5V0S X-Received: by 2002:a54:4086:: with SMTP id i6mr4346695oii.65.1578594972337; Thu, 09 Jan 2020 10:36:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578594972; cv=none; d=google.com; s=arc-20160816; b=I/btRB6ZWsD6NEBYBO0CzYHZ5lsEL1JFE1w0zvo0s7T4xA4tDH6UOpsvYm3gITwTim eMyHNocFFQYAgoerbJK3D6YTKi2FM10sFALvE2mtWkSsfnsKM/RathevZHrGuWo0a+2Y 7TtULSCDJt9lRDSy4SsgoGCCzbyzoBsjROEHDePmvYALLTpqctT2FOjRSUVSOJKGsYlX N1q5uxvR79Vbkacilc7X+lYBotsCBx4bvAU3SKHsq3Myp54Fpjl72fyrRLGlSC+4UH1G Wc3TaHfQedEOFv51Cx2PrxfVLbCpZOQs5mRrnh7g7ZpYpDxF6PbauNzdatkzLr9TuAys xgIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Drfn39aW4Rl8/ELEX75gHz2oq+AVmNe3gvmjo+MZ5To=; b=K/9+9YWKaSv9+feJAR9fdqbSK9okS508J4d/bQo1jXGzWZUf2xtR7+N8ITf6Wx1Ggr GodLSyNU+aSPG3ueAidvDJLZAxuEeE5geWaoMAP+WTNsA03bdTi4LHF9x+WSo1a76OuJ IWyjvtuyhrFkEm+5PjA5c++YVBK0QdseWjHMeY/95yC1W/LTTj8PNpUPzi0BmyVMVSy5 W9nxI1ALIDdrpwkZIbnbqQCxnQxLbmu5gBhb8QPtlu+q/B6/givejPj+ierI9t1Txptt X0WB6qM/9uD1haS2P3qBDDsuOYuA43Nu2vZjPO9qojzVUHHBJ+bK8pyd4UiiqH/xP94p /L5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10si5066775otf.237.2020.01.09.10.36.00; Thu, 09 Jan 2020 10:36:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730430AbgAIPCV (ORCPT + 99 others); Thu, 9 Jan 2020 10:02:21 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:35060 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730273AbgAIPCU (ORCPT ); Thu, 9 Jan 2020 10:02:20 -0500 Received: by mail-qk1-f193.google.com with SMTP id z76so6245724qka.2 for ; Thu, 09 Jan 2020 07:02:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Drfn39aW4Rl8/ELEX75gHz2oq+AVmNe3gvmjo+MZ5To=; b=aMOz6sQkvEJHOw0XKPIfdnr4WL6lLwaaVZXjBeC4+h+m9qO3OFBvrdNoYEug4jvCdX YMDLpsMeZ4p4GV9ss4y/Kx/5niJw+xNqfRgdOEBIU9HiBcPjMacQXRRNZQuRDKOJWBDP CDVh5q+m3wC6LFzkkvnACwpa97Zq/Do13/wmsXb4RJZsXo1gNAlcJ9lN7cbnLQm1vRbz ccDCrGjbJ1qJepcrvCFFS48WLVQfYMHdocLZZcF3n0pQqSvcSbswedvhlTsgZ1rMeyjB l76CXUdq99zYbRdamCX3hotiV+92SWttU33mIXFjWW8iSpzKDP/pdMiKL9SyPzXUtbqa l0Hg== X-Gm-Message-State: APjAAAX0oHNz+0UPbmViM/9Al8tMopsO7Ik9INN1T7eIg6C0r8QPpTLQ 1r9iEnbq7fMxWfNgm/7NT2Q= X-Received: by 2002:a37:a00b:: with SMTP id j11mr9879780qke.268.1578582139738; Thu, 09 Jan 2020 07:02:19 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id t73sm3217837qke.71.2020.01.09.07.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2020 07:02:19 -0800 (PST) From: Arvind Sankar To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] x86/boot/compressed/64: Remove .bss/.pgtable from bzImage Date: Thu, 9 Jan 2020 10:02:17 -0500 Message-Id: <20200109150218.16544-1-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 5b11f1cee579 ("x86, boot: straighten out ranges to copy/zero in compressed/head*.S") introduced a separate .pgtable section, splitting it out from the rest of .bss. This section was added without the writeable flag, marking it as read-only. This results in the linker putting the .rela.dyn section (containing bogus dynamic relocations from head_64.o) after the .bss and .pgtable sections. When we use objcopy to convert compressed/vmlinux into a binary for the bzImage, the .bss and .pgtable sections get materialized as ~176KiB of zero bytes in the binary in order to place .rela.dyn at the correct location. Fix this by marking .pgtable as writeable. This moves the .rela.dyn section earlier so that .bss and .pgtable are the last allocated sections and so don't appear in bzImage. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/head_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 58a512e33d8d..6eb30f8a3ce7 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -709,7 +709,7 @@ SYM_DATA_END_LABEL(boot_stack, SYM_L_LOCAL, boot_stack_end) /* * Space for page tables (not in .bss so not zeroed) */ - .section ".pgtable","a",@nobits + .section ".pgtable","aw",@nobits .balign 4096 SYM_DATA_LOCAL(pgtable, .fill BOOT_PGT_SIZE, 1, 0) -- 2.24.1