From patchwork Fri Apr 28 09:50:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Wenlong X-Patchwork-Id: 88571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp821644vqo; Fri, 28 Apr 2023 03:12:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7c8SN5db8y0Jq+gkxazGecL5uxC4mluA045pzkfctfB6e1+g01mNn29MPlNl0ulotC3yTr X-Received: by 2002:a17:902:ec84:b0:1a9:9dd3:6e with SMTP id x4-20020a170902ec8400b001a99dd3006emr12840874plg.16.1682676730153; Fri, 28 Apr 2023 03:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682676730; cv=none; d=google.com; s=arc-20160816; b=EQhlkNtdCdq9cct2lDq0fiUf/Dy78EuQFSPVlXHWE2GQc4trIPjkjo+LoD7y0fpBZn B630D9xVLWqFsRYaLq1Jn20pXwSHAO5DWpxgZMcaH9WTYDyBrf7WsoUXyA6A8AIPW43E r9vQGPtH1+A0KAcE+iMI6oBAT/ZSha+y3bhicCpGRcWFOiQGPXKJeWUxYGrvQ9qE0sWT K1CWJIBpKabrU4bsZaMWcFaztu5pobbNuON175IxWr3Xpe0DzOXuUQJjspDURpI/svR6 giCN4/elZ0x42SX9pdo4+671OZnhAQxKBeowZ3Bg0V6fPWd/7pZIe0wMJTf5H+nisCqB xDog== 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=Ee5H+WD+CgTi2Z0fkTjgtk88ZrZst7JG8IeeyEgZ6HY=; b=QMJWrGNDkUjz5RQucDNBwOSuzj4A2rZJONLHVjx4SJwW4YbPeDmN2hjeCkGTqPWZ6u KXjKygpSstLTJXKrAlgGeQFbVBtAdpcrPwP23c8YPUHSAx51KSBgPxuFE8WxQSuCdRzb +pA/wSxHaA+vVYvnY+Jcg/xbaf9WLJG3LA9jv2ivz0hVlT6QkAY3/uir+cR8m8dRDuTH 1ZkxsPGaY9uMg+986m86D7nrtCXvA0JVWf1HSCMO9U1ayChdMsZdYqqypWh5IeKlerql IDu4aQUfeoBf3L1KtO/urcD86fCAqeH/ZImvUc3Rpf+sD5psRV41Aoeqg7hnc7rMqvbY aF8Q== 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 p13-20020a170902e74d00b001a814f7db5fsi15172020plf.632.2023.04.28.03.11.55; Fri, 28 Apr 2023 03:12:10 -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 S1345825AbjD1Jxc (ORCPT + 99 others); Fri, 28 Apr 2023 05:53:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345792AbjD1JxP (ORCPT ); Fri, 28 Apr 2023 05:53:15 -0400 Received: from out0-206.mail.aliyun.com (out0-206.mail.aliyun.com [140.205.0.206]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9353044A2 for ; Fri, 28 Apr 2023 02:52:51 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R251e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047208;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---.STFoGIL_1682675546; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.STFoGIL_1682675546) by smtp.aliyun-inc.com; Fri, 28 Apr 2023 17:52:27 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Thomas Garnier" , "Lai Jiangshan" , "Kees Cook" , "Hou Wenlong" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" Subject: [PATCH RFC 14/43] x86/Kconfig: Introduce new Kconfig for PIE kernel building Date: Fri, 28 Apr 2023 17:50:54 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764414434968540506?= X-GMAIL-MSGID: =?utf-8?q?1764414434968540506?= Add a new Kconfig to control the behaviour of PIE building, and disable it now. Suggested-by: Lai Jiangshan Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Kees Cook --- arch/x86/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c94297369448..68e5da464b96 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2208,6 +2208,10 @@ config RELOCATABLE it has been loaded at and the compile time physical address (CONFIG_PHYSICAL_START) is used as the minimum location. +config X86_PIE + def_bool n + depends on X86_64 + config RANDOMIZE_BASE bool "Randomize the address of the kernel image (KASLR)" depends on RELOCATABLE