Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2850808rdb; Tue, 12 Sep 2023 14:16:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3ARMBkaXbDveh37LfW9EwcIWjonMW+SVSfEDVtZ0R4OVP9jFLk7oJflMqz0TCLd8hZxwd X-Received: by 2002:a17:902:f80a:b0:1be:ff74:ec21 with SMTP id ix10-20020a170902f80a00b001beff74ec21mr981809plb.27.1694553413839; Tue, 12 Sep 2023 14:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694553413; cv=none; d=google.com; s=arc-20160816; b=Da+Mi82pek6mq1f5sScEc+TBSJmuOEcHeqPHsMOulemqDhAdKkt1pLYBdJ5gzY1SAw jXUUxOjeKLaXJVdtaxt6kvlcIqzSv84FNLZajMFx2WPTa9m/2sQ7ITCE4RkCBVPpWfma 7C8nJm6tytc2ZvpiExDwVUIxznihiPYO+UWTKty8+4PvdSRWUUZJnsTGv0lbHMDfCrxs NwPYuK4zxSu5U1ledwwKADIB/cGdtMheWMgFrOnuMGBsDn7TJJP442RskzvwJB6DDSet 4gzsWbfZjCUsRnhtIAkibucy8NyyRD4WZMWyOcAPCRm/xZ68jcPXJZxG74PfWG0FZKW2 8nag== 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=pVbz4fjFo4+ir2yqSB/ysImzl14Df/jDMfhZQ3/BbwM=; fh=yd5qbrVKTDJRlvjkVe0iKy2AvAnK9tlu0lXRbMaKDZU=; b=VM7Wnbsb8SGt2oHJzr3eT9XnOrtCf9A+rqKeVZ165eBX+06hXsvJX+WHS+GF9uc6u3 7HeQ9S7Wxmtst54M22bD1USbXNgxNAZNhjjuVp/w62Cb09lJhz4JzStdQi+i7AUvKGaW 9TdNsexoMA/+QP9vlp+yzA6CW8rzLlA4blIE6nKUw4jggTfzQnRlKMSUlui7H7D5ji2p sggB86zafxf0vewdczYSB3U87f/cEA+kX7UNddMmZwgjPtDA9FZOBWIgn7vd8+kIA+vD Lat8tpTk0lE3aHJrcMOyohFtVUs2Lv/E6qTjHSGBbAV2cPrm5oOwhdA9SwqUMCTILzVY qplg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YnRzXMFy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ay6-20020a1709028b8600b001badbe8e441si8544206plb.106.2023.09.12.14.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 14:16:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YnRzXMFy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 94839818909C; Mon, 11 Sep 2023 21:11:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238185AbjILC2W (ORCPT + 99 others); Mon, 11 Sep 2023 22:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237848AbjILC2B (ORCPT ); Mon, 11 Sep 2023 22:28:01 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E0F11411D for ; Mon, 11 Sep 2023 18:52:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4199C433BA; Mon, 11 Sep 2023 23:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694476581; bh=u8grHSUih0zlT7CklXW0wcQgc5UDX4ocDwoCjXz+YmA=; h=From:To:Cc:Subject:Date:From; b=YnRzXMFyyF3dBrvBj16uexyMo4wqHU4lETNKicL+cfyBex9ZS0TN4zPYnSCfJz2m0 KQycwz1aNJrMtq+UTlY1AWW6vhYKYXNRPu4NYdiGUl9Q4fbHUraiLt2q4dgGHGZiIX i88MYFkn1AEOmbxgElmBMd6DvJfSwVuqskZx+iHBJFLUghyMcTmlTIRITgxQ4uK9st toTf/fGcll9uW+r+dWVM6M2e9S//jXpR39mhhgIFvgW1+lRGdIpLBUqjCnMCt5UBXQ NAUSfRVYgskJ5asuyl5XKQDeAe1dMjDbqemZrlqFbx9X6014jhlJytMT39f2f2AOMw r0UEqsXP5exlg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra Subject: [PATCH] objtool: Fix _THIS_IP_ detection for cold functions Date: Mon, 11 Sep 2023 16:56:13 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Sep 2023 21:11:33 -0700 (PDT) Cold functions and their non-cold counterparts can use _THIS_IP_ to reference each other. Don't warn about !ENDBR in that case. Note that for GCC this is currently irrelevant in light of the following commit c27cd083cfb9 ("Compiler attributes: GCC cold function alignment workarounds") which disabled cold functions in the kernel. However this may still be possible with Clang. Fixes several warnings like the following: drivers/scsi/bnx2i/bnx2i.prelink.o: warning: objtool: bnx2i_hw_ep_disconnect+0x19d: relocation to !ENDBR: bnx2i_hw_ep_disconnect.cold+0x0 drivers/net/ipvlan/ipvlan.prelink.o: warning: objtool: ipvlan_addr4_event.cold+0x28: relocation to !ENDBR: ipvlan_addr4_event+0xda drivers/net/ipvlan/ipvlan.prelink.o: warning: objtool: ipvlan_addr6_event.cold+0x26: relocation to !ENDBR: ipvlan_addr6_event+0xb7 drivers/net/ethernet/broadcom/tg3.prelink.o: warning: objtool: tg3_set_ringparam.cold+0x17: relocation to !ENDBR: tg3_set_ringparam+0x115 drivers/net/ethernet/broadcom/tg3.prelink.o: warning: objtool: tg3_self_test.cold+0x17: relocation to !ENDBR: tg3_self_test+0x2e1 drivers/target/iscsi/cxgbit/cxgbit.prelink.o: warning: objtool: __cxgbit_free_conn.cold+0x24: relocation to !ENDBR: __cxgbit_free_conn+0xfb net/can/can.prelink.o: warning: objtool: can_rx_unregister.cold+0x2c: relocation to !ENDBR: can_rx_unregister+0x11b drivers/net/ethernet/qlogic/qed/qed.prelink.o: warning: objtool: qed_spq_post+0xc0: relocation to !ENDBR: qed_spq_post.cold+0x9a drivers/net/ethernet/qlogic/qed/qed.prelink.o: warning: objtool: qed_iwarp_ll2_comp_syn_pkt.cold+0x12f: relocation to !ENDBR: qed_iwarp_ll2_comp_syn_pkt+0x34b net/tipc/tipc.prelink.o: warning: objtool: tipc_nametbl_publish.cold+0x21: relocation to !ENDBR: tipc_nametbl_publish+0xa6 Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 1384090530db..e308d1ba664e 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4333,7 +4333,8 @@ static int validate_ibt_insn(struct objtool_file *file, struct instruction *insn continue; } - if (insn_func(dest) && insn_func(dest) == insn_func(insn)) { + if (insn_func(dest) && insn_func(insn) && + insn_func(dest)->pfunc == insn_func(insn)->pfunc) { /* * Anything from->to self is either _THIS_IP_ or * IRET-to-self. -- 2.41.0