Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp423533pxh; Wed, 10 Nov 2021 04:02:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5S35fxxYQfYLtPgusyqqPLShJKS6qn2vYcoF0mHuQ2OEkHP3F5eEv23oiQ/lJ3N+IZ9wx X-Received: by 2002:a05:6a00:1514:b0:49f:b5ef:affb with SMTP id q20-20020a056a00151400b0049fb5efaffbmr31740314pfu.7.1636545761478; Wed, 10 Nov 2021 04:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636545761; cv=none; d=google.com; s=arc-20160816; b=X4UAqSimfGTw+TpuVTr8o55eqAtu7zx+/gGRDor0GUg9Zr/cgstSwaoKd5nTkhDpa9 TaOUUjF+KCcAMPxnfKNM07JOne315LZAtoRWIjBHKe/ufKdqZrBijqQyoVufYg443oNV BXDy9hCnoGQIcfpEWsJV5O7+vSxqN3GEKpMttNxTJMq7pB05F8jsNC1PhyCDM1/puvvE R933W8Bhu0C5c4M8rj8eHfc3XXftOt0ErUmJwNh2IzCgsRMKHLMNKmT2dh4QauU6L2h/ 4AfARx4VgA6Jzkcyh5WWLKTapgfoaDVMUqpBAo2NSqCuPS3Oq7+0tjj8iSnXQfUlvzG6 liFg== 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 :dkim-signature; bh=ca+sb+meZwHAb+91W5mI2yDSsqaR+Wc14MEA+LhBOAY=; b=p+FE27mXQIRDHGhGFtzhj+VyRNb28aoqeR0KQSlKZkcWT69XC8prKDcs13S01TnRDa ombFnI1wAaNhC6y8CZIPjlwly799LLywKP75XR1lKHePymXV/Vhko0bSEE5nqp5gC4vR aZC6FF+bSx2Ue4iuEDrrljE4mhwRjcdecmOZfLiS8oc5o2d1RNAHNQCriZndoZAzR4d8 Y1T8k+ww/hK2UCho1+vn31CA/dBAc9z8lUyydMHjZQjWZZz81Q2NmtirqJjqr+5rQAUy Ehh4P6kx19YWXkcoYfAquTXCbHSdMvMvzeh8mUm3ZPKD2rIvfidzRlM4QM/g4FbD8zep rCjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MqPElQbT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x2si8901304pjp.171.2021.11.10.04.02.25; Wed, 10 Nov 2021 04:02:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MqPElQbT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbhKJMBt (ORCPT + 99 others); Wed, 10 Nov 2021 07:01:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbhKJMBq (ORCPT ); Wed, 10 Nov 2021 07:01:46 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CC62C061766 for ; Wed, 10 Nov 2021 03:58:59 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id o6-20020a17090a0a0600b001a64b9a11aeso1472449pjo.3 for ; Wed, 10 Nov 2021 03:58:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ca+sb+meZwHAb+91W5mI2yDSsqaR+Wc14MEA+LhBOAY=; b=MqPElQbTSluatc93L4wJnAbqXZLz8PFKqKaiN8oGS/fcjxzU50yUJlynMSzUCeFBaL 6o+xArIGPkV95kb17JcX5K0frQU6gd5zWxZrP4/Vv1aPRWPTWGeFSh5aKLhXG0I5jROi CDq5jHESuWzm5VTBkOvhilXdJXGRWJf/j3WrRkKrhP8hYQpXXiRZg22RsrgiBU66X3TI HN/L0k3Me3ek4l0I8SNoEaioEHuKrWGDCPaeaWMSqkg8TD67sBpX9G93mluIJXGp8oy3 2NAkfaDbPmw3Arb2PIgcPpkI/W+qYwlU+nfea9VzqYye7Xf18x6PUIwiIcrqI7o0S80f nLrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ca+sb+meZwHAb+91W5mI2yDSsqaR+Wc14MEA+LhBOAY=; b=f9T1WQ+TFgr8JayFgLBoYtnKx144ukOaLXGsk6o8mRJoqVT1PG2kRBGadT/OsJxypr ZZA2InF5cZ3VEFYmo2HT7J0uHT1doKyaX+BAq+xbholyXqM/dvB2/DmexIRDe6rPg8WQ pGFCvv2cEK9SndxC4kddRkhjF+ljjEtxgm7wsaZ0hnccINEDA0ulQHrfJZNqv1Iarf9Q Za6cv7c/Wcc6pz3SHXrs6736NBGV9eyRJd+I3g5US4fas8Jwjsr6Z/cpBwM7g5UiNXMN gk0XhhBkqeXWMtpUdb6oqDL45B6MnR7rr2Gxf+SJAXDxyEKVHEenNM4xepWfjMTAZa5v edyQ== X-Gm-Message-State: AOAM5306bLa30ET54QzTDsA160swdsusfIdrLhEaFEStaT+gkE1+sQE4 98OZaFcFcN2Hj6h7p3tP7sObQNqpAtQ= X-Received: by 2002:a17:902:c713:b0:141:bbb2:1ec7 with SMTP id p19-20020a170902c71300b00141bbb21ec7mr15095341plp.57.1636545538886; Wed, 10 Nov 2021 03:58:58 -0800 (PST) Received: from localhost ([198.11.178.15]) by smtp.gmail.com with ESMTPSA id v10sm10729488pfg.162.2021.11.10.03.58.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 03:58:58 -0800 (PST) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Lai Jiangshan , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH V5 14/50] x86/entry: Expose the address of .Lgs_change to entry64.c Date: Wed, 10 Nov 2021 19:57:00 +0800 Message-Id: <20211110115736.3776-15-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20211110115736.3776-1-jiangshanlai@gmail.com> References: <20211110115736.3776-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan The address of .Lgs_change will be used in traps.c in later patch when some entry code is implemented in entry64.c. So the address of .Lgs_change is exposed to traps.c for preparation. The label .Lgs_change is still needed in ASM code for extable due to it can not use asm_load_gs_index_gs_change. Otherwise: warning: objtool: __ex_table+0x0: don't know how to handle non-section reloc symbol asm_load_gs_index_gs_change Signed-off-by: Lai Jiangshan --- arch/x86/entry/entry64.c | 2 ++ arch/x86/entry/entry_64.S | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/entry/entry64.c b/arch/x86/entry/entry64.c index 762595603ce7..9813a30dbadb 100644 --- a/arch/x86/entry/entry64.c +++ b/arch/x86/entry/entry64.c @@ -12,3 +12,5 @@ * is PTI user CR3 or both. */ #include + +extern unsigned char asm_load_gs_index_gs_change[]; diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index fb977d958889..e7e56665daa2 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -733,6 +733,7 @@ _ASM_NOKPROBE(common_interrupt_return) SYM_FUNC_START(asm_load_gs_index) FRAME_BEGIN swapgs +SYM_INNER_LABEL(asm_load_gs_index_gs_change, SYM_L_GLOBAL) .Lgs_change: movl %edi, %gs 2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE @@ -1010,7 +1011,7 @@ SYM_CODE_START_LOCAL(error_entry) movl %ecx, %eax /* zero extend */ cmpq %rax, RIP+8(%rsp) je .Lbstep_iret - cmpq $.Lgs_change, RIP+8(%rsp) + cmpq $asm_load_gs_index_gs_change, RIP+8(%rsp) jne .Lerror_entry_done_lfence /* -- 2.19.1.6.gb485710b