Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3085397rwl; Mon, 27 Mar 2023 09:03:18 -0700 (PDT) X-Google-Smtp-Source: AKy350ZYVd+jE6t2iKfyvyLosdLFgpTfml8uEvW+bLvJhXFocSlj/khriPBu8d57i+xRTv795eeW X-Received: by 2002:a17:90a:7062:b0:240:6623:733a with SMTP id f89-20020a17090a706200b002406623733amr6639051pjk.8.1679932998340; Mon, 27 Mar 2023 09:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679932998; cv=none; d=google.com; s=arc-20160816; b=qmOIGJsB97s78B3x6ugu1zCubRRqCpa99dhNX3teit8kgVjEm+iCtX7OY38LL0i5lO KPgdd44DdxmO1HS53I816AaT8zB4PQYmXmgT5dhckgL7qYh32UurbCK0JUU33NMWdQPz XECVXhSWYKSN//33bJoB5IeDJ5xpCmSPz0L42Td2xbJTeg9L4VVdKIRjAnzK54ulpfaT hAPBftWuagILJlGyezwm4xq9j2FDWXcJ1d7seE09A5yXioYhMguOB9/uociDBAvfxzqI X/NVRIIim0IlEvl8r9NLkBqpMCPWTmt3Oclyt0dHPvjsWpZT+KpNzjQz+4vhtoaugGOg hIzg== 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=MlPzgOjIgaQbuDlp+ewku2BEejtll/oMFOYC56z/60s=; b=vcu3kl4raXGlzX+1E/rDBbD9g9sPJq/Qg8Zd6D9CPoZyHVRPrSzD4oHpL6Yo2dmVvm 2ukwn569D8i9XuhIqwU//BCqXs9FActZO1m6mYjNklvhUqJbZus7Pw7L9xcY2ILI0u0J sy8RkoCCv7A69mFmNrxUExTpWW5a+/OGFqXnjGzZIyAkkiAThCuYoPnW0O1uB9Rq2Ox1 bW2GO3oKHoN/87IlXXAjYw7DJcWPj1aaBJExahf51kQPaLMl308GLCD0h+KXagbq2HnT fnCA2G2rENWp90hwGtyONmiYJcY61dOMruvEyhCli6VS3fwaNeqj3YXuQTxcTFwHRDEQ umhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="W9sFA8/7"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a17090a854800b00240262caf83si10530016pjw.82.2023.03.27.09.03.00; Mon, 27 Mar 2023 09:03:18 -0700 (PDT) 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="W9sFA8/7"; 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 S232908AbjC0QBa (ORCPT + 99 others); Mon, 27 Mar 2023 12:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232781AbjC0QBN (ORCPT ); Mon, 27 Mar 2023 12:01:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60707659E for ; Mon, 27 Mar 2023 09:00:57 -0700 (PDT) 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 E42F46136A for ; Mon, 27 Mar 2023 16:00:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CE07C433A7; Mon, 27 Mar 2023 16:00:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679932856; bh=u69Tg1vdhRZztJGiueD2tMeEsNcJF/AVA/Gcuwho7Uw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W9sFA8/7euAUx/U00p8kXj+DzpvXxXElLAYtrLNsyf+VP/iQWZsdLAt8Qwu0XaJNH TxHgm5nbvc8dBKA2gh2kcYT7mlqCHwLCKedOZe9VuPZMEr6jqHTKtaNSQtyUTKZMFW +UAHxmvcdxn+WoTt5gbwCHWCRQvZCLBcfnloCe26Km1AgLIGuJLwnmAlm4y9Uo6vH2 WW1C8nAHkmp7NmFuDpTDyk/Q0PLWnU3d3LaTHqDRh3VHM7AMYj0bjf7LR2Zn8JUP/1 n563m3/LNTN0axjJBXYCHiGCF5EM44y9o6oIl1UB6bLeuJV1DQWXm0wdnrvx8A9snu CJg6hplRTKZfg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra Subject: [PATCH 4/5] objtool: Add per-function rate limiting for unreachable warnings Date: Mon, 27 Mar 2023 09:00:47 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 Unreachable instruction warnings are rate limited to once per object file. That no longer makes sense for vmlinux validation, which might have other unreachable instructions lurking in other places. Change it to once per function. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 4 ++++ tools/objtool/include/objtool/elf.h | 1 + 2 files changed, 5 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 73dd091c0075..67a684225702 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4557,6 +4557,10 @@ static int validate_reachable_instructions(struct objtool_file *file) if (insn->visited || ignore_unreachable_insn(file, insn)) continue; + if (insn->sym->warned) + continue; + insn->sym->warned = 1; + WARN_FUNC("unreachable instruction", insn->sec, insn->offset); return 1; } diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h index ad0024da262b..a668173a5869 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -61,6 +61,7 @@ struct symbol { u8 return_thunk : 1; u8 fentry : 1; u8 profiling_func : 1; + u8 warned : 1; struct list_head pv_target; struct list_head reloc_list; }; -- 2.39.2