From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC821C432BE for ; Thu, 2 Sep 2021 09:20:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4E0461051 for ; Thu, 2 Sep 2021 09:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245350AbhIBJV3 (ORCPT ); Thu, 2 Sep 2021 05:21:29 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:60994 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245147AbhIBJV1 (ORCPT ); Thu, 2 Sep 2021 05:21:27 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=laijs@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0Un-mOGW_1630574426; Received: from C02XQCBJJG5H.local(mailfrom:laijs@linux.alibaba.com fp:SMTPD_---0Un-mOGW_1630574426) by smtp.aliyun-inc.com(127.0.0.1); Thu, 02 Sep 2021 17:20:26 +0800 Subject: Re: [PATCH 04/24] x86/entry: Expose the address of .Lgs_change to traps.c To: Peter Zijlstra , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" References: <20210831175025.27570-1-jiangshanlai@gmail.com> <20210831175025.27570-5-jiangshanlai@gmail.com> From: Lai Jiangshan Message-ID: <1a33582b-63ef-581e-07da-3e3b970df4ab@linux.alibaba.com> Date: Thu, 2 Sep 2021 17:20:26 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/2 17:14, Peter Zijlstra wrote: > On Wed, Sep 01, 2021 at 01:50:05AM +0800, Lai Jiangshan wrote: > >> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S >> index e38a4cf795d9..9164e85b36b8 100644 >> --- a/arch/x86/entry/entry_64.S >> +++ b/arch/x86/entry/entry_64.S >> @@ -729,6 +729,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: > > After all the patches, there's only a single .Lgs_change reference left. > Can't we convert the _ASM_EXTABLE() entry to use the new label and > totally remove it? The label .Lgs_change is still needed in ASM code for extable. I tried the way as you suggested, and the result is: warning: objtool: __ex_table+0x0: don't know how to handle non-section reloc symbol asm_load_gs_index_gs_change But never mind, I have already converted load_gs_index into C code. I will send it later. > >> movl %edi, %gs >> 2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE >> @@ -1011,7 +1012,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