From patchwork Mon Nov 14 11:43:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097701wru; Mon, 14 Nov 2022 03:47:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf55FQUzNnSvfMtyQSi+HuwGgkofxV8IzfHCgqjOr6TVQ0OYtuuUOatg56dk36ax8/7Q9zeq X-Received: by 2002:a17:906:a896:b0:7ab:afd4:d7ed with SMTP id ha22-20020a170906a89600b007abafd4d7edmr9817019ejb.228.1668426475443; Mon, 14 Nov 2022 03:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426475; cv=none; d=google.com; s=arc-20160816; b=PuDC7xqQhXSTOsj0Kz34u1hBPx3qFmw3zw2RuGisChyW6yKLiN61lfg8rZqFU0dqIB vWNlVkFvwrJEf7jckMzbmJ0D+fJQRb9kvCYjfE1VnIhHUI51IArK9pxaPRlCWYpEwKvh xGRsEbOMt1r1NJHQAd/CrHxNSGt6BmrQh3njdz6SgGS+ZEH0pUS5mqRMixL+YhRZGWCT T5IzXHRs723YHJrUIuN/nkHcOAd+6tbCgf5SUQrSBvuZVezABSw/tWKKwoWovyO9N+YV 5RBG6sMdAj2+MupJxW5NTQ3e97DOb5XgSDFxk0zPbzLcGDcW0WKw/lrAD2VbDa0pmGvk YXQg== 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=sO/Boqy8h96nAJpY/pijxc+R1C7C8zn75T+KfteTp0k=; b=Hdhbt6h/rtRryYzBL7lr7vA8nFKF7QJA2wntsIazLsLhdekyNZAlKpheNYLZPPzigm Gx+jUAT0oXF9X7wugaJHWfreoNzCPghrzf1/Mi1jHWjhSPUnuNOOvzYyNY5bZT9RPtfx okqbPYKPPcYlejnCD/zj+gKWSjsNnuJiwiKK6OO9PdN8o5GM2gwNL+6sMSmWCIOFmRip B3D9uCzTJHPi/cu/3jUaBKviu+j00NcqibgUWSYxgEoDY2n1qE8xOtEI1BLW7Winfc5C tPoqLE/7m4aLdmAwBhsU9KCjdMYeLDFxNJ8N7sRPkUKtGNdvZ8eOrJR/1j4I/S3SXeAL sW8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fPJIeLVK; 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=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q26-20020a50cc9a000000b0045c3f6adb7csi8266318edi.215.2022.11.14.03.47.31; Mon, 14 Nov 2022 03:47:55 -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=@kernel.org header.s=k20201202 header.b=fPJIeLVK; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236444AbiKNLpD (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236642AbiKNLo3 (ORCPT ); Mon, 14 Nov 2022 06:44:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A42FA443 for ; Mon, 14 Nov 2022 03:44:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B278D61045 for ; Mon, 14 Nov 2022 11:44:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F37ABC433D6; Mon, 14 Nov 2022 11:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426260; bh=IHoKQKrRrTt+P5k/IAfDdtfWsTsoL9pAz/rh5KwFgsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fPJIeLVKEPphF5Jd/ZBtMLYLlwXq2jNC6yM/rnlSjD/oEDQPHp1ZE7kCqMJrdANgg OYx54IDoHISHcJxw3pc63Qs2tcOYxTtRHcTJ4W9F7HcoW5/trhw8vxeyyBHq+m/Pis eVp7HVYPXPjZu/8kvjDRf+wsLTPWpFOJXSIB9ygDzr+QGCKYC9YzaiJGp+oM9zBEML XaRGFyOztx/UxUgwt2iThXV+acWKlYmMWdcI+N5dtWuxNIMlKfJRSY9V6c/13B3Uj9 OBttxZPrsD3xy5aYX5kXeCwCk+/s7m658Lv3c+TMu6DYODrLIFZWoGZ5JMdKyP8xcJ WYpEU/+a4AW3w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 11/46] x86/alternative, lto: Mark int3_*() as global and __visible Date: Mon, 14 Nov 2022 12:43:09 +0100 Message-Id: <20221114114344.18650-12-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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?1749471959689196391?= X-GMAIL-MSGID: =?utf-8?q?1749471959689196391?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark int3_magic() and int3_selftest_ip() as global and __visible. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/kernel/alternative.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 5cadcea035e0..05e5eb9cbd51 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -823,11 +823,12 @@ extern struct paravirt_patch_site __start_parainstructions[], * convention such that we can 'call' it from assembly. */ -extern void int3_magic(unsigned int *ptr); /* defined in asm */ +extern __visible void int3_magic(unsigned int *ptr); /* defined in asm */ asm ( " .pushsection .init.text, \"ax\", @progbits\n" " .type int3_magic, @function\n" +" .globl int3_magic\n" "int3_magic:\n" ANNOTATE_NOENDBR " movl $1, (%" _ASM_ARG1 ")\n" @@ -836,7 +837,7 @@ asm ( " .popsection\n" ); -extern void int3_selftest_ip(void); /* defined in asm below */ +extern __visible void int3_selftest_ip(void); /* defined in asm below */ static int __init int3_exception_notify(struct notifier_block *self, unsigned long val, void *data)