[RFC,24/43] x86/boot/compressed: Adapt sed command to generate voffset.h when PIE is enabled
Message ID | 8d6bbaf66b90cf1a8fd2c5da98f5e094b9ffcb27.1682673543.git.houwenlong.hwl@antgroup.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp818122vqo; Fri, 28 Apr 2023 03:05:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7tDigeBj/A6CvftQFZz9cfQbuZ6/sNab4WWgUHY23xS45cy7Z9FP0aabq0y1drrkYrSdZ8 X-Received: by 2002:a05:6a00:1a89:b0:63d:a0d:6fa1 with SMTP id e9-20020a056a001a8900b0063d0a0d6fa1mr5826816pfv.21.1682676327526; Fri, 28 Apr 2023 03:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682676327; cv=none; d=google.com; s=arc-20160816; b=jUAOfDNek8Hfc2H7bDD3Nu4RuMGXRpjW/hV4WDnsUuul3wYTMoPZ++1impNYYGPDJ2 Q6+tMX9WywDpVIHjLfjJ0uZr+UFmbWIIqri8WjDCdbcNopopcaxQwJXWqT1D4kcvLetM SnKOlSMLCAmkJ9doSgxSS4OKlmkcdDG+XCnV25OR0S1j3eX6IO+kMaMB3+cHFESf4Pk7 LQYvVhXqDOvtw1trKCKjBe0DGo/BxI+6DgCEpEVCDYYu7BrS/3LIjjXQu5h8OWg1b54f Cl6s84pLjzYorSa9Jnc8EFgGfdksl7RpdFvnJtOZaYQSHZzdd8vtzzomQmbQlGHlXIt2 FU8w== 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; bh=XCHtupLXJ2rBPBM5wmy9RIEtiY61kV4Rb+rfVN2Uc40=; b=D6EIngXz8P2ofmDSWqLOlRIjGcWxi0LijsB7LOz9+HC2ETK5h8iJcPH3t/GgOpnGc9 G39HaAzYmSYIuFP/Q719Pax4J53CyXKSeIVTdXkt3F2yRvnKdRGwaI3cdVcNxNimysUO Uc1osxg/b3lrQI9gw3EQb/+vGo9etYQ7ftcrcVKFGfMGwEpLUS+CdQ+jz4H2I1WKvbZP BPgoF7jTibeIAvftTd9wLByXemMiBMUiShUO6XrzlYpdFZKhhF7Lu5aA1l4OCq2fBRSS bRJoB7pj8HDwyEE1c+yMNrhDscLrZ9kg64E09hkV/dzmAAh4YWxw8rradfx5qnIU6qWW b2yg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020aa7950a000000b0063b7f1093e1si5166589pfp.110.2023.04.28.03.05.15; Fri, 28 Apr 2023 03:05: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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345967AbjD1Jzd (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 99 others); Fri, 28 Apr 2023 05:55:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345897AbjD1JzJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Apr 2023 05:55:09 -0400 Received: from out187-6.us.a.mail.aliyun.com (out187-6.us.a.mail.aliyun.com [47.90.187.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDB935584 for <linux-kernel@vger.kernel.org>; Fri, 28 Apr 2023 02:54:47 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047212;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---.STFQGPs_1682675586; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.STFQGPs_1682675586) by smtp.aliyun-inc.com; Fri, 28 Apr 2023 17:53:07 +0800 From: "Hou Wenlong" <houwenlong.hwl@antgroup.com> To: linux-kernel@vger.kernel.org Cc: "Thomas Garnier" <thgarnie@chromium.org>, "Lai Jiangshan" <jiangshan.ljs@antgroup.com>, "Kees Cook" <keescook@chromium.org>, "Hou Wenlong" <houwenlong.hwl@antgroup.com>, "Thomas Gleixner" <tglx@linutronix.de>, "Ingo Molnar" <mingo@redhat.com>, "Borislav Petkov" <bp@alien8.de>, "Dave Hansen" <dave.hansen@linux.intel.com>, <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>, "Nathan Chancellor" <nathan@kernel.org>, "Ard Biesheuvel" <ardb@kernel.org>, "Nick Desaulniers" <ndesaulniers@google.com>, "Andrew Morton" <akpm@linux-foundation.org>, "Alexander Potapenko" <glider@google.com>, "Xin Li" <xin3.li@intel.com> Subject: [PATCH RFC 24/43] x86/boot/compressed: Adapt sed command to generate voffset.h when PIE is enabled Date: Fri, 28 Apr 2023 17:51:04 +0800 Message-Id: <8d6bbaf66b90cf1a8fd2c5da98f5e094b9ffcb27.1682673543.git.houwenlong.hwl@antgroup.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <cover.1682673542.git.houwenlong.hwl@antgroup.com> References: <cover.1682673542.git.houwenlong.hwl@antgroup.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764414012838915525?= X-GMAIL-MSGID: =?utf-8?q?1764414012838915525?= |
Series |
x86/pie: Make kernel image's virtual address flexible
|
|
Commit Message
Hou Wenlong
April 28, 2023, 9:51 a.m. UTC
When PIE is enabled, all symbols would be set as hidden to reduce GOT
references. According to generic ABI, a hidden symbol contained in a
relocatable object must be either removed or converted to STB_LOCAL
binding by the link-editor when the relocatable object is included in an
executable file or shared object. Both gold and ld.lld change the
binding of a STV_HIDDEND symbol to STB_LOCAL. But For GNU ld, it will
keep global hidden. However, sed command to generate voffset.h only
captures global symbol, then empty voffset.h would be generated when PIE
is enabled with lld. So capture local symbol too in sed command.
Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Cc: Thomas Garnier <thgarnie@chromium.org>
Cc: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Cc: Kees Cook <keescook@chromium.org>
---
arch/x86/boot/compressed/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 6b6cfe607bdb..678881496c44 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -79,7 +79,7 @@ LDFLAGS_vmlinux += -T hostprogs := mkpiggy HOST_EXTRACFLAGS += -I$(srctree)/tools/include -sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p' +sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVWabcdgrstvw] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p' quiet_cmd_voffset = VOFFSET $@ cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@