From patchwork Tue Nov 22 07:15:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 24173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2052082wrr; Mon, 21 Nov 2022 23:19:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf6B+eDrQF2yoffZhn4KW1Mwya6r7RzXAq6k/wfKrj9tq8A6n6uCqGU20MULAQYUM/J2KhxT X-Received: by 2002:a17:907:2143:b0:7ae:27ed:e90e with SMTP id rk3-20020a170907214300b007ae27ede90emr18395784ejb.224.1669101588234; Mon, 21 Nov 2022 23:19:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669101588; cv=none; d=google.com; s=arc-20160816; b=Fb9JiN544KaEeb9yvA0N21RfnqQktj8AnmSOBQdjRBmg0/TK8uZj6wPAy340WTbJ74 k/5Y2XeHp0K9uZRsvEjZIwdriK0zDs32mH79K62367rZXWFKxgbvj/oHjvyit74aypBQ hfxZ4cvHA49D/7EupvNgqI4+XoTgRqQu5EUUUi5+OE21+hgqLLiTfPwTo8wupQoJYFD+ 8ewge+Yd3bLC01qRdfx1ITs3Lm+h+FhnMkN2RjPU2izd57Ny/9K72z3jm5KvypShbs7L E4WVtZQbTJWheku8i0iuWuD9BYwZcxRI0sMXsbXJFP2HfAb7BthgSkq4+jug3YqC1rNO gw5w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=9cH3XUOlDzLJq6dhclj6pjTqONBWIigRQAqYPPPqneg=; b=JyvPFYX54bJ0BY35Iw785XiWYsKKigkE98rThv4V2bI7tKqsT+26htSLdOqWN6M8Yg x5mFw5CziFCfJxEoyDFG7CYrpV7u/Xf1gp1wtkUbvFGivaJa1Q5YBAuVerArD+jzstU4 4fSoHkbvfWtoFcXlBEmBQo/xbB02IApgAoA1GfqBQ542CYbDvKbzyM5Gy2q+Rw+8zfa7 nNHgZ5NxucGw5K1NyoKvv0eUnQrzcGzGSZEpNzNJa8tGBMbKg6TF0qT9D0xpLI/AAP0O u81T0/iZOu9ZE0A5GByBmYXQRraGcgpa3oHZq3dzgxytQVNK/MGQym6N2SnBnX48Z7Ko LOFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Vnm+P7Tj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a056402524300b00461b84a010fsi9255699edd.295.2022.11.21.23.19.24; Mon, 21 Nov 2022 23:19:48 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Vnm+P7Tj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232167AbiKVHP4 (ORCPT + 99 others); Tue, 22 Nov 2022 02:15:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbiKVHPx (ORCPT ); Tue, 22 Nov 2022 02:15:53 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 794533121B for ; Mon, 21 Nov 2022 23:15:52 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id b62so13373768pgc.0 for ; Mon, 21 Nov 2022 23:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9cH3XUOlDzLJq6dhclj6pjTqONBWIigRQAqYPPPqneg=; b=Vnm+P7TjjenvMiUbjymitiEvEMZiWLaP4jiBbrVu3fciCG3Vdy7UFfLtAIkdDsLNw9 GR/9D5fb4a64eMzKQFRRR/MxGlBG8+Sud+/1KAi1CODGiltst5PVnHUVMBtxZSBbAHSD FCneXl6zoV52BYzLxZVbT0UMf+dXk9XWZl8kX7Q97nER9DuPZFcz8i28OBa1DJAYHcum t7EXzgxwamH0E2Zj8r07RdSboaj61octPpoELFLpL9r9VaHdDM0a5AgiUYMtnLsqC2XS 32/OOZjU6OLA9lENFi/i+I7KdK3ifVzC7k0VfJWUIlChT8MEx8EY6RBvhP700Y2EXrpQ fzNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9cH3XUOlDzLJq6dhclj6pjTqONBWIigRQAqYPPPqneg=; b=2FD6HrNzvR5eWPupkbIJsunwqNwUAj6tjlD+95SuBj1p9R2i1lrVTbWRkVw/ElySiX 5g2CxtNGgvK/27J0SbyzFbZjDEyYsXKIjzJWnrv+vJhoA5aTJwdDSsel+wmqipNq/d9s cGXI+DgvKrGzyw2rzGb2y++mijNWL1CMA20IfjgFYhGi+YAWY0VTa1tCfAwgeDN1+Hi9 LfvKvoC046I7eJmCsZtKEyQQ+icZt+yNtZJpBb72lBOkiREkQNHczSjDtk9m0scnvOFm FJTiPJea1vdJ3Q4Yc7lE27En8PxTcRfzCo9JSnQkJjEmSkZ/1fz4r/skqgvnJ3cBRUT+ 721A== X-Gm-Message-State: ANoB5pk8MGJOUn2tw4pOQDEAAe9tj0/DPimNBbq+jTucawIoIpq1kcL1 IS/FOFYkLG2GCtZcvFpVzaQ= X-Received: by 2002:a63:ff17:0:b0:470:8f8d:eb51 with SMTP id k23-20020a63ff17000000b004708f8deb51mr7337369pgi.69.1669101351597; Mon, 21 Nov 2022 23:15:51 -0800 (PST) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id u8-20020a1709026e0800b00186b06963f9sm10988969plk.180.2022.11.21.23.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 23:15:51 -0800 (PST) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Thomas Gleixner Cc: Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org, Nadav Amit Subject: [PATCH] x86/lib: Do not use local symbols with SYM_CODE_START_LOCAL() Date: Mon, 21 Nov 2022 23:15:47 -0800 Message-Id: <20221122071547.165296-1-namit@vmware.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE 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?1750179867104379112?= X-GMAIL-MSGID: =?utf-8?q?1750179867104379112?= From: Nadav Amit When SYM_CODE_START_LOCAL() is used, the symbols are local but should be saved to the object. In contrast, using ".L" label prefix causes the symbols not to be saved in the object. Since it is preferable to be able to map instruction pointers back to symbols, the local symbol should be saved in the object. Therefore, when SYM_CODE_START_LOCAL() is used, the ".L" label prefix should not be used. Two symbols, however, have both SYM_CODE_START_LOCAL() and ".L" prefix: .Lbad_put_user_clac and .Lcopy_user_handle_tail. Remove the ".L" prefix from them. No functional change, other then emitting these symbols into the object, is intended. Signed-off-by: Nadav Amit --- arch/x86/lib/copy_user_64.S | 16 ++++++++-------- arch/x86/lib/putuser.S | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S index 9dec1b38a98f..92b4c17c95cd 100644 --- a/arch/x86/lib/copy_user_64.S +++ b/arch/x86/lib/copy_user_64.S @@ -83,7 +83,7 @@ SYM_FUNC_START(copy_user_generic_unrolled) 30: shll $6,%ecx addl %ecx,%edx - jmp .Lcopy_user_handle_tail + jmp copy_user_handle_tail _ASM_EXTABLE_CPY(1b, 30b) _ASM_EXTABLE_CPY(2b, 30b) @@ -139,7 +139,7 @@ SYM_FUNC_START(copy_user_generic_string) 11: leal (%rdx,%rcx,8),%ecx 12: movl %ecx,%edx /* ecx is zerorest also */ - jmp .Lcopy_user_handle_tail + jmp copy_user_handle_tail _ASM_EXTABLE_CPY(1b, 11b) _ASM_EXTABLE_CPY(3b, 12b) @@ -169,7 +169,7 @@ SYM_FUNC_START(copy_user_enhanced_fast_string) RET 12: movl %ecx,%edx /* ecx is zerorest also */ - jmp .Lcopy_user_handle_tail + jmp copy_user_handle_tail _ASM_EXTABLE_CPY(1b, 12b) SYM_FUNC_END(copy_user_enhanced_fast_string) @@ -190,7 +190,7 @@ EXPORT_SYMBOL(copy_user_enhanced_fast_string) * Output: * eax uncopied bytes or 0 if successful. */ -SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail) +SYM_CODE_START_LOCAL(copy_user_handle_tail) cmp $X86_TRAP_MC,%eax je 3f @@ -209,9 +209,9 @@ SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail) .Lcopy_user_handle_align: addl %ecx,%edx /* ecx is zerorest also */ - jmp .Lcopy_user_handle_tail + jmp copy_user_handle_tail -SYM_CODE_END(.Lcopy_user_handle_tail) +SYM_CODE_END(copy_user_handle_tail) /* * Finish memcpy of less than 64 bytes. #AC should already be set. @@ -252,7 +252,7 @@ SYM_CODE_START_LOCAL(copy_user_short_string) 40: leal (%rdx,%rcx,8),%edx jmp 60f 50: movl %ecx,%edx /* ecx is zerorest also */ -60: jmp .Lcopy_user_handle_tail +60: jmp copy_user_handle_tail _ASM_EXTABLE_CPY(18b, 40b) _ASM_EXTABLE_CPY(19b, 40b) @@ -382,7 +382,7 @@ SYM_FUNC_START(__copy_user_nocache) movl %ecx,%edx .L_fixup_handle_tail: sfence - jmp .Lcopy_user_handle_tail + jmp copy_user_handle_tail _ASM_EXTABLE_CPY(1b, .L_fixup_4x8b_copy) _ASM_EXTABLE_CPY(2b, .L_fixup_4x8b_copy) diff --git a/arch/x86/lib/putuser.S b/arch/x86/lib/putuser.S index 32125224fcca..3c33071cec97 100644 --- a/arch/x86/lib/putuser.S +++ b/arch/x86/lib/putuser.S @@ -137,22 +137,22 @@ SYM_FUNC_START(__put_user_nocheck_8) SYM_FUNC_END(__put_user_nocheck_8) EXPORT_SYMBOL(__put_user_nocheck_8) -SYM_CODE_START_LOCAL(.Lbad_put_user_clac) +SYM_CODE_START_LOCAL(bad_put_user_clac) ASM_CLAC .Lbad_put_user: movl $-EFAULT,%ecx RET -SYM_CODE_END(.Lbad_put_user_clac) +SYM_CODE_END(bad_put_user_clac) - _ASM_EXTABLE_UA(1b, .Lbad_put_user_clac) - _ASM_EXTABLE_UA(2b, .Lbad_put_user_clac) - _ASM_EXTABLE_UA(3b, .Lbad_put_user_clac) - _ASM_EXTABLE_UA(4b, .Lbad_put_user_clac) - _ASM_EXTABLE_UA(5b, .Lbad_put_user_clac) - _ASM_EXTABLE_UA(6b, .Lbad_put_user_clac) - _ASM_EXTABLE_UA(7b, .Lbad_put_user_clac) - _ASM_EXTABLE_UA(9b, .Lbad_put_user_clac) + _ASM_EXTABLE_UA(1b, bad_put_user_clac) + _ASM_EXTABLE_UA(2b, bad_put_user_clac) + _ASM_EXTABLE_UA(3b, bad_put_user_clac) + _ASM_EXTABLE_UA(4b, bad_put_user_clac) + _ASM_EXTABLE_UA(5b, bad_put_user_clac) + _ASM_EXTABLE_UA(6b, bad_put_user_clac) + _ASM_EXTABLE_UA(7b, bad_put_user_clac) + _ASM_EXTABLE_UA(9b, bad_put_user_clac) #ifdef CONFIG_X86_32 - _ASM_EXTABLE_UA(8b, .Lbad_put_user_clac) - _ASM_EXTABLE_UA(10b, .Lbad_put_user_clac) + _ASM_EXTABLE_UA(8b, bad_put_user_clac) + _ASM_EXTABLE_UA(10b, bad_put_user_clac) #endif