Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1861338rwr; Fri, 28 Apr 2023 02:55:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ71+/7C9ATaOWBPleVMpH8dma2r9L/+OrnAK3kHbMSefak09s3Tp6RcRvqAz/QUWqE3wdkH X-Received: by 2002:a17:902:d4c9:b0:1a6:db0a:8005 with SMTP id o9-20020a170902d4c900b001a6db0a8005mr4485025plg.68.1682675759417; Fri, 28 Apr 2023 02:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682675759; cv=none; d=google.com; s=arc-20160816; b=a/e/eNLLf5wkhWSsGFNFjJQjjYkMVDzklHqJ2tTvJ6dAqulyXiSkjJfJflEARsLKOW OL08aIA4sEPvNng5DMuh2YD4WGqDvLe4GzMfmFwwBj7hkr9obCD0kRLSrPxJ6xMeZWao OXXj20KwbpDMHtMgb2NQpCxqy1ipgfI+0ljwP6ZllFq62K4xUlwDKqem3Y2czt22yeHA ijKdRg0DmuZx1GKaJJOBeXNDqUu685RU2XAEQLxdRzKn5i98GIrPo2YCa8OzAeide/wv 4vdDtj1ItB8G6LJPvDpQhpw5d+ZdEud3E/gF1dKmMfa1/jVWfO4iwxpMQZ4GQw6hVOd/ ImRg== 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=gJj0mM+QMs8jm2xywIqqlCqsrJDS93vdCd3aQWQVT0Q=; b=ioOrFU0616bKrjwKf42gRcBbFehmUaYbHWPbZgResBsNAUAK2ckqIvkEepyWa5UNM0 xbQusxhFEZ3HuTB+ijmXICO9dY8M013OLxfj8Smcmk/A6M4zzt/FjjmmTwAMUOr8r++Y o/MIHCWXVu+imy+eFThA3/XPzVlz+v9GidkdpC6/DbB84ilq3EbCSRGwpTGKVBYvxlBb zNplD/ufRriI/uJaaTtoYX5UdX1lEU4orJJ7Z1iaqibapxallm2TARQNpj43lmyYjLTK Rw3UvaZMQUmLhiij4TCtMaDxzA5KCFLw24x7ahTUtlzSqKZmwQIID2TXHAgUsua1cgZD jCXQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj13-20020a170903048d00b001a92875cda9si16807045plb.288.2023.04.28.02.55.47; Fri, 28 Apr 2023 02:55:59 -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 S1345957AbjD1Jz0 (ORCPT + 99 others); Fri, 28 Apr 2023 05:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345879AbjD1JzH (ORCPT ); Fri, 28 Apr 2023 05:55:07 -0400 Received: from out0-217.mail.aliyun.com (out0-217.mail.aliyun.com [140.205.0.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F16226186; Fri, 28 Apr 2023 02:54:44 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047198;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---.STCEPkM_1682675599; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.STCEPkM_1682675599) by smtp.aliyun-inc.com; Fri, 28 Apr 2023 17:53:20 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Thomas Garnier" , "Lai Jiangshan" , "Kees Cook" , "Hou Wenlong" , "Sean Christopherson" , "Paolo Bonzini" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" , Subject: [PATCH RFC 28/43] KVM: x86: Adapt assembly for PIE support Date: Fri, 28 Apr 2023 17:51:08 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: 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: X-Mailing-List: linux-kernel@vger.kernel.org Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Lai Jiangshan Cc: Kees Cook --- arch/x86/kvm/svm/vmenter.S | 10 +++++----- arch/x86/kvm/vmx/vmenter.S | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/svm/vmenter.S b/arch/x86/kvm/svm/vmenter.S index 8e8295e774f0..25be1a66c59d 100644 --- a/arch/x86/kvm/svm/vmenter.S +++ b/arch/x86/kvm/svm/vmenter.S @@ -270,16 +270,16 @@ SYM_FUNC_START(__svm_vcpu_run) RESTORE_GUEST_SPEC_CTRL_BODY RESTORE_HOST_SPEC_CTRL_BODY -10: cmpb $0, kvm_rebooting +10: cmpb $0, _ASM_RIP(kvm_rebooting) jne 2b ud2 -30: cmpb $0, kvm_rebooting +30: cmpb $0, _ASM_RIP(kvm_rebooting) jne 4b ud2 -50: cmpb $0, kvm_rebooting +50: cmpb $0, _ASM_RIP(kvm_rebooting) jne 6b ud2 -70: cmpb $0, kvm_rebooting +70: cmpb $0, _ASM_RIP(kvm_rebooting) jne 8b ud2 @@ -381,7 +381,7 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run) RESTORE_GUEST_SPEC_CTRL_BODY RESTORE_HOST_SPEC_CTRL_BODY -3: cmpb $0, kvm_rebooting +3: cmpb $0, _ASM_RIP(kvm_rebooting) jne 2b ud2 diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S index 631fd7da2bc3..b7cc3c17736a 100644 --- a/arch/x86/kvm/vmx/vmenter.S +++ b/arch/x86/kvm/vmx/vmenter.S @@ -289,7 +289,7 @@ SYM_INNER_LABEL(vmx_vmexit, SYM_L_GLOBAL) RET .Lfixup: - cmpb $0, kvm_rebooting + cmpb $0, _ASM_RIP(kvm_rebooting) jne .Lvmfail ud2 .Lvmfail: -- 2.31.1