Message ID | 86defd5e8ee1328bbfbe7f6b293bacb4f1b7d23a.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 b10csp819334vqo; Fri, 28 Apr 2023 03:07:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5LWMxTqVHs+ZhJ/NY7BtmFjznR7YEI2qZ8uqvtgugy6CmFNdh0dnONmS4bayTIuwE6XpdM X-Received: by 2002:a05:6a20:1455:b0:ee:d266:32b9 with SMTP id a21-20020a056a20145500b000eed26632b9mr6294303pzi.10.1682676473695; Fri, 28 Apr 2023 03:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682676473; cv=none; d=google.com; s=arc-20160816; b=VDtakxni9BLmgoUHwAa7UtD8387ccKdVNlPiHG8jveuivdfBW6faQP16I2QORxx1Qx ykJ1IBNYV2TNz99Zt1h/CRx0F549yL3jSY5KjAKRTF+dqBPTB8OUPb/SMvqC8aylKrNR S8/3A1FI4ppupYUKkyGC3zZKWYCtlGXL9OzjL2PinpUAvP8pTyQdSIvzIFb7ShAsSXjw nwdzGmI4ObbZWHI8ce/bjJCvkEmCGkFvYZ9qwUlJvYMDb75rHWiYi4WOunSonZcRZr86 oDHISw9ERDFhQBvKk3CksAHpRiPRGtKtGTEwfy4ghULrL7i0gNq9lY3pdqlPwwkbNLGK hGOA== 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=PBYiiSI3kD7uz/xUeuO8fV8NvPtrztGj5TD65Y8Qtu0=; b=XuHN3KkIlSPLAm9rG2Jn8PGsNvFlo/3DetzzLCoNioAXnVfM2mmMTln0gMi5JF9cUo /Tq7SaHLgWHWsyt4xMl11rj+mjk/s+8Cd0j9jXLiWcKwL7Nz9t3Rnt+UPoOwrqaRguqI vqkdkXZYs1KB+1LGu368C307V/ENsAI+e15S04XZ1xSc8r0bIQ3KKtcLTiJlKCmGa2JX +1g4wxSXK0PlhePGOlGfSZxV81BASkwlGSzAOYiuIw33yhd9P1DR2rKD+oYV6DbexIhS uZXZeuapN7y4T478xaElAUkhR3jSU7o8pMq2rH8uSe5gqrqYebeLGbYOypH489t6opWB b9gg== 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 w190-20020a6382c7000000b0050fb7c5a656si21350952pgd.190.2023.04.28.03.07.38; Fri, 28 Apr 2023 03:07:53 -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 S1345403AbjD1Jw2 (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 99 others); Fri, 28 Apr 2023 05:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345760AbjD1JwP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Apr 2023 05:52:15 -0400 Received: from out0-201.mail.aliyun.com (out0-201.mail.aliyun.com [140.205.0.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A67755BD for <linux-kernel@vger.kernel.org>; Fri, 28 Apr 2023 02:52:03 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R471e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047205;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---.STDfru9_1682675517; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.STDfru9_1682675517) by smtp.aliyun-inc.com; Fri, 28 Apr 2023 17:51:57 +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> Subject: [PATCH RFC 06/43] x86/CPU: Adapt assembly for PIE support Date: Fri, 28 Apr 2023 17:50:46 +0800 Message-Id: <86defd5e8ee1328bbfbe7f6b293bacb4f1b7d23a.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?1764414165979378386?= X-GMAIL-MSGID: =?utf-8?q?1764414165979378386?= |
Series |
x86/pie: Make kernel image's virtual address flexible
|
|
Commit Message
Hou Wenlong
April 28, 2023, 9:50 a.m. UTC
From: Thomas Garnier <thgarnie@chromium.org> From: Thomas Garnier <thgarnie@chromium.org> Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Signed-off-by: Thomas Garnier <thgarnie@chromium.org> Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com> Cc: Lai Jiangshan <jiangshan.ljs@antgroup.com> Cc: Kees Cook <keescook@chromium.org> --- arch/x86/include/asm/sync_core.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/sync_core.h b/arch/x86/include/asm/sync_core.h index ab7382f92aff..fa5b1fe1a692 100644 --- a/arch/x86/include/asm/sync_core.h +++ b/arch/x86/include/asm/sync_core.h @@ -31,10 +31,12 @@ static inline void iret_to_self(void) "pushfq\n\t" "mov %%cs, %0\n\t" "pushq %q0\n\t" - "pushq $1f\n\t" + "leaq 1f(%%rip), %q0\n\t" + "pushq %q0\n\t" "iretq\n\t" "1:" - : "=&r" (tmp), ASM_CALL_CONSTRAINT : : "cc", "memory"); + : "=&r" (tmp), ASM_CALL_CONSTRAINT + : : "cc", "memory"); } #endif /* CONFIG_X86_32 */