From patchwork Fri Apr 28 09:50:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Wenlong X-Patchwork-Id: 88565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp819956vqo; Fri, 28 Apr 2023 03:09:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qZ7bhm6y2wgB2n+FTWOsOb7HhL/PbyH44JQp+8Ah+vlLnmif/uHO5EcJjqvkIG3B+yKlV X-Received: by 2002:a05:6a21:398e:b0:f0:6aaf:1abf with SMTP id ad14-20020a056a21398e00b000f06aaf1abfmr5869552pzc.4.1682676549214; Fri, 28 Apr 2023 03:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682676549; cv=none; d=google.com; s=arc-20160816; b=tI7y+8UGaQT728fNMMsDPHdGJ0mhFZgvz39ePhxhmgf2P/ZUJcktWgkqjIF+8+vg8K AszkU6J8PqUmARJXot+6qg9JMS8suu9AgcHpiI6RG7EtmjHKLE31NRKBLAbvTUqo16Ou JDaR1RH4uPwmO3E2dE1+vt/ryISWfkSE5gwUkLz6CQI8TxLv0rIvDM7859zJWTtAiFlA XuqxAVC8skVM115saa0YsAwcyp1bM45Jhg+cilbNBIn9UenjJBpTeyLN4C6zhq/LZMiP WW+wU3Xb0Mf6conS1tPx3xXdfltxBwebVALm8jLsEYYUgI0vxPIeqn2RrFwd6g5DfxUI feZg== 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=Tz1eBnWwuFKalpgC5LSYWF0H5qhfVAcDAFCNr+uxfWg=; b=usfL+FK4JlFz1cUoHR3smmwswcvzh9Y+mvcoYDcatqtjmLNvJke+edPwTZrl5E/4vc W+deY7V1yxTqqWcpKY3CIFNr0xUhjB/425v5QOHwqZ5T/xTgRYpgGpcaUZw54rhW+nqi phPXSb31EHHMsXSb/oJZ8bJUzTJHKIa4YT0svvVBfwZA1lacEd7MFWzGTe/zUDuwtsQ6 cognE6juXfttaGfdng6zGRKE9gjwrYLJtxl+y+qNlRp4Z9RdFmDpI70/itxrAmo48/m6 63d+3DbruoShhBbfUXmFNs4+FRheCrMNVD+IjaKLa+GN8gafhnuoXi+ckgLy1tzepkAV tnGQ== 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 k26-20020a63ba1a000000b00517aaf50a82si21584239pgf.854.2023.04.28.03.08.54; Fri, 28 Apr 2023 03:09:09 -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 S1345755AbjD1Jwq (ORCPT + 99 others); Fri, 28 Apr 2023 05:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345790AbjD1Jwf (ORCPT ); Fri, 28 Apr 2023 05:52:35 -0400 Received: from out0-216.mail.aliyun.com (out0-216.mail.aliyun.com [140.205.0.216]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 248BA10E7; Fri, 28 Apr 2023 02:52:11 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047204;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---.STCEPMn_1682675524; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.STCEPMn_1682675524) by smtp.aliyun-inc.com; Fri, 28 Apr 2023 17:52:05 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Thomas Garnier" , "Lai Jiangshan" , "Kees Cook" , "Hou Wenlong" , "Rafael J. Wysocki" , "Pavel Machek" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" , Subject: [PATCH RFC 09/43] x86/power/64: Adapt assembly for PIE support Date: Fri, 28 Apr 2023 17:50:49 +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?1764414245358060961?= X-GMAIL-MSGID: =?utf-8?q?1764414245358060961?= From: Thomas Garnier From: Thomas Garnier Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Signed-off-by: Thomas Garnier Signed-off-by: Hou Wenlong Cc: Lai Jiangshan Cc: Kees Cook --- arch/x86/power/hibernate_asm_64.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/power/hibernate_asm_64.S b/arch/x86/power/hibernate_asm_64.S index 0a0539e1cc81..1d96a119d29d 100644 --- a/arch/x86/power/hibernate_asm_64.S +++ b/arch/x86/power/hibernate_asm_64.S @@ -39,7 +39,7 @@ SYM_FUNC_START(restore_registers) movq %rax, %cr4; # turn PGE back on /* We don't restore %rax, it must be 0 anyway */ - movq $saved_context, %rax + leaq saved_context(%rip), %rax movq pt_regs_sp(%rax), %rsp movq pt_regs_bp(%rax), %rbp movq pt_regs_si(%rax), %rsi @@ -70,7 +70,7 @@ SYM_FUNC_START(restore_registers) SYM_FUNC_END(restore_registers) SYM_FUNC_START(swsusp_arch_suspend) - movq $saved_context, %rax + leaq saved_context(%rip), %rax movq %rsp, pt_regs_sp(%rax) movq %rbp, pt_regs_bp(%rax) movq %rsi, pt_regs_si(%rax)