From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03E1116C684 for ; Tue, 1 Apr 2025 04:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481652; cv=none; b=ZicrvUnd49eDBri+od6moX2lZzTW+fTbyBqDkJRepWc6IXFCwBGk9EpLtxMytNO6WoaoGUI3k3/NM/N0tbPQ4HuRZ+geuoSpurd5rj+4LEp2wq1ink2MNct1MC1Z4Q8Bvj+AwnY5HX16opz5JvCom6ntYGXWwL3SB92Aci2YjBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481652; c=relaxed/simple; bh=dLWk2coWakqqwKMQk2PsX5SMEBKGRg80zqaKkYV6ewE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZS84eYMkhFav3z4lIDdAOq/2oMDQtEFx5TEdTAhdbxRtjTjte754nhECCmaZuuz2XavzBZ6D+49VQCEC9K7A5jiwvR1BtaeCiJ/i48bvLSZs1DxC8Igtw2G8QeC4tyTZPR1JlPbmZd3pZVq9k3GT4Inkm3dEU7/rDaOu7UhTNPw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=riyLeQe4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="riyLeQe4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53B88C4CEE9; Tue, 1 Apr 2025 04:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481651; bh=dLWk2coWakqqwKMQk2PsX5SMEBKGRg80zqaKkYV6ewE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=riyLeQe4wCwDyxP3ZycMNRHKqxeSe0N05qBnrMKeHLKRo4JUY6VVSSW2NJCNXPjMz WSo+7vc4pYY3EAIiY6ZFh/pAH7AUfr5jNeYD9cL1WG30IY1LaLa1aApIsc+3FoRkJO +gyNMNgpERuExvm9bIuCnnhp4qaQoEBlL2fdkn0QKHCXYY4C/uCBZeMF2Kmwqu2YQD +N6Cdm0mO3cfi9mh0/CsLFU2FXz33weo68WkbUaBB4HCnB9spoNhx+y09D9uL76FFL 6nczSrgRlnoxmIH72JtSNRExK9fxxLxMGwmV4pYNsIXp19gppQufQOI/OudpRE/FKj v91DvAVuZgSMQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , kernel test robot Subject: [PATCH 01/11] objtool: Silence more KCOV warnings, part 2 Date: Mon, 31 Mar 2025 21:26:36 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Similar to GCOV, KCOV can leave behind dead code and undefined behavior. Warnings related to those should be ignored. The previous commit: 6b023c784204 ("objtool: Silence more KCOV warnings") ... only did so for CONFIG_CGOV_KERNEL. Also do it for CONFIG_KCOV, but for real this time. Fixes the following warning: vmlinux.o: warning: objtool: synaptics_report_mt_data: unexpected end of = section .text.synaptics_report_mt_data Fixes: 6b023c784204 ("objtool: Silence more KCOV warnings") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202503282236.UhfRsF3B-lkp@int= el.com/ Signed-off-by: Josh Poimboeuf --- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index b93597420daf..4d543054f723 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -275,7 +275,7 @@ objtool-args-$(CONFIG_MITIGATION_SLS) +=3D --sls objtool-args-$(CONFIG_STACK_VALIDATION) +=3D --stackval objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) +=3D --static-call objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) +=3D --uaccess -objtool-args-$(CONFIG_GCOV_KERNEL) +=3D --no-unreachable +objtool-args-$(or $(CONFIG_GCOV_KERNEL),$(CONFIG_KCOV)) +=3D --no-unreacha= ble objtool-args-$(CONFIG_PREFIX_SYMBOLS) +=3D --prefix=3D$(CONFIG_FUNCTION_= PADDING_BYTES) objtool-args-$(CONFIG_OBJTOOL_WERROR) +=3D --Werror =20 --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FAB91AF0BB for ; Tue, 1 Apr 2025 04:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481652; cv=none; b=GitwE7qydxXyW67oOTAYA+tdnCcPdKCzu+ceLSDtCcJdyto0sgCTGI9UQWPHJPuPbvStfhhdZ5hgq6H6YBOQCP8Itz+zhvRFsLaY1I/lZkvhFSpNVegFRFCAdJo7UPJwOVctQRCv74fqWd9Saelyh5H+3bBCMQYIFvuOyEoFuJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481652; c=relaxed/simple; bh=7RjqPboHQASJpceG4THLuaASsoA3mFeOFyDYIbAxa4M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bypj+p5QddAvAHEHXPpex5L4hnnl2r9ntN5uZ2zwNnAT2BLKcSav4a6G8xp6m7T0PPQiYJZVMk2AXnzfqiSBQScIceKujDhrgwWwlnGx/8d51ex+fAPt3OqDV4kV73xKuQm/qBoic15NUTKyZBLSw3Rajp1VTOO+AEEiU1BK1dk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kX0hD9pt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kX0hD9pt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADD69C4CEEF; Tue, 1 Apr 2025 04:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481651; bh=7RjqPboHQASJpceG4THLuaASsoA3mFeOFyDYIbAxa4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kX0hD9pt8+VLhl38eaZvLBMtdoIE6apl8snjs3NckBu946tlaOL6b5AfYTph3a1b+ dfyi70NQq2j3UO3vHD5W9baLyDuvXmYnM6J2SxLAr3nMJlK5luN2oz2G44E+F5edd4 lISwVgJ5E58QlRJlBdiWiIQfIEkALEwafX/x0vvl5O5Ha6dA14D9OYaJ4ywh9lkFq3 Oa+j4dRF37y/KEjZdd+5FpzGtvV8KtFZvnwQAd3z8hO7TbMWLC5kRNZAb9CJi/q/mm eb8T5Ze9F9Gr4J2fbJzm6TlqXbF3C3nhFDNM+hew3VvUWECu5UQPYUApVGkGbPH6g+ tysRXLDHwdX3w== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Randy Dunlap Subject: [PATCH 02/11] objtool: Ignore end-of-section jumps for KCOV/GCOV Date: Mon, 31 Mar 2025 21:26:37 -0700 Message-ID: <08fbe7d7e1e20612206f1df253077b94f178d93e.1743481539.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When KCOV or GCOV is enabled, dead code can be left behind, in which case objtool silences unreachable and undefined behavior (fallthrough) warnings. Fallthrough warnings, and their variant "end of section" warnings, were silenced with the following commit: 6b023c784204 ("objtool: Silence more KCOV warnings") Another variant of a fallthrough warning is a jump to the end of a function. If that function happens to be at the end of a section, the jump destination doesn't actually exist. Normally that would be a fatal objtool error, but for KCOV/GCOV it's just another undefined behavior fallthrough. Silence it like the others. Fixes the following warning: drivers/iommu/dma-iommu.o: warning: objtool: iommu_dma_sw_msi+0x92: can't= find jump dest instruction at .text+0x54d5 Fixes: 6b023c784204 ("objtool: Silence more KCOV warnings") Reported-by: Randy Dunlap Closes: https://lore.kernel.org/314f8809-cd59-479b-97d7-49356bf1c8d1@infrad= ead.org/ Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index fff9d7a2947a..e6c4eefe295b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1488,6 +1488,8 @@ static int add_jump_destinations(struct objtool_file = *file) int ret; =20 for_each_insn(file, insn) { + struct symbol *func =3D insn_func(insn); + if (insn->jump_dest) { /* * handle_group_alt() may have previously set @@ -1513,7 +1515,7 @@ static int add_jump_destinations(struct objtool_file = *file) } else if (reloc->sym->return_thunk) { add_return_call(file, insn, true); continue; - } else if (insn_func(insn)) { + } else if (func) { /* * External sibling call or internal sibling call with * STT_FUNC reloc. @@ -1548,6 +1550,15 @@ static int add_jump_destinations(struct objtool_file= *file) continue; } =20 + /* + * GCOV/KCOV dead code can jump to the end of the + * function/section. + */ + if (file->ignore_unreachables && func && + dest_sec =3D=3D insn->sec && + dest_off =3D=3D func->offset + func->len) + continue; + WARN_INSN(insn, "can't find jump dest instruction at %s+0x%lx", dest_sec->name, dest_off); return -1; @@ -1574,8 +1585,7 @@ static int add_jump_destinations(struct objtool_file = *file) /* * Cross-function jump. */ - if (insn_func(insn) && insn_func(jump_dest) && - insn_func(insn) !=3D insn_func(jump_dest)) { + if (func && insn_func(jump_dest) && func !=3D insn_func(jump_dest)) { =20 /* * For GCC 8+, create parent/child links for any cold @@ -1592,10 +1602,10 @@ static int add_jump_destinations(struct objtool_fil= e *file) * case where the parent function's only reference to a * subfunction is through a jump table. */ - if (!strstr(insn_func(insn)->name, ".cold") && + if (!strstr(func->name, ".cold") && strstr(insn_func(jump_dest)->name, ".cold")) { - insn_func(insn)->cfunc =3D insn_func(jump_dest); - insn_func(jump_dest)->pfunc =3D insn_func(insn); + func->cfunc =3D insn_func(jump_dest); + insn_func(jump_dest)->pfunc =3D func; } } =20 --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8DCA1C863F for ; Tue, 1 Apr 2025 04:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481652; cv=none; b=js9RVs+eIpKc4QwWhlPUrdNSPODfDPR4iQLOgE/fvjF0IQCBeYkc4eMbB9e9zCNYnUFd3p6WXtxa9dLQ9wI6bpolQwBY54oQApzatN1HiSDauBdQmUbF5JIs/bNABhF9si2MLfskjdcvFPQySBuWsqW/TwQaxn+jUEEC2esa4V0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481652; c=relaxed/simple; bh=IjOKdxlBYugNhuleDznGFP9F/v+6SATan/Ji53JS+9M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A2R/foFCPsntT/PRF2gWKh4tL6R+MxsNSdHw7kh5XgWRbZ753DYWvHM4UhigZOMuf2QUmC5Z3ym+fj050JbxhF7vHRkkZhG8UN6/DKb55jZJOu4T+v0VpBHB8h9Gm6nMFq6IyP0mC5HDazc2QmTXOL6HOqKTs0/ph0HxU8qu0Tw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UZ2qtfEO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UZ2qtfEO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12AB8C4CEE8; Tue, 1 Apr 2025 04:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481652; bh=IjOKdxlBYugNhuleDznGFP9F/v+6SATan/Ji53JS+9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UZ2qtfEOT2yevbrixKL9g3TQwQt9eZMwv2yWjYYVaghMkDKZ4PhmDGZOOKchn+8G5 3WtiyPUO0+stiHUNJcVb4goC6YGvjHa1EXVPDtpNSmoeGahp+ioU7AFdiwvpXYpxSU tlQxJclkpJUkGdI0inyBJxXkYuS8uriOhXvs2CI0f3kFCQoJKVjv3s+KhQr0S8wk8u MPVJlJnGtIOHJ9+vPGsd+1H0zf4zT02fWwrUbkCWnlbTbZ9ptTbUpIOWZTwcehvgIX gZ0W8FkhBz9CyUXXVxmJ+UNLlMeugkW40tIfDc8EsZGcURceUeO7agCGYQ0vFbSOOq gXOvgw7hhfdiQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra Subject: [PATCH 03/11] objtool: Append "()" to function name in "unexpected end of section" warning Date: Mon, 31 Mar 2025 21:26:38 -0700 Message-ID: <692e1e0d0b15a71bd35c6b4b87f3c75cd5a57358.1743481539.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Append with "()" to clarify it's a function. Before: vmlinux.o: warning: objtool: cdns_mrvl_xspi_setup_clock: unexpected end o= f section .text.cdns_mrvl_xspi_setup_clock After: vmlinux.o: warning: objtool: cdns_mrvl_xspi_setup_clock(): unexpected end= of section .text.cdns_mrvl_xspi_setup_clock Fixes: c5995abe1547 ("objtool: Improve error handling") Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index e6c4eefe295b..bd0c78bfe90c 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3761,7 +3761,7 @@ static int validate_branch(struct objtool_file *file,= struct symbol *func, return 0; =20 WARN("%s%sunexpected end of section %s", - func ? func->name : "", func ? ": " : "", + func ? func->name : "", func ? "(): " : "", sec->name); return 1; } --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B28DC1C84D2 for ; Tue, 1 Apr 2025 04:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481652; cv=none; b=dNDYkDs3TSJLskgDYM1q8K/UmCnyowwewuavLXXBn0AX+PlOrg59+n3evyGMdDWlnHalVsqaOTwwXAAI94XPBVw59bFfMRxNSEM1HL1h7SCQf/gZR2x8f5fLkDqd7EvcrMXURkPL/3slfFKwOOWLYwQ6OI/5jXCOUmdfro2GLMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481652; c=relaxed/simple; bh=bCx7geUMIOM3KKzXlGKmU1tmG38ls8IrUrBTI29be+c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RWxPGFi45kr4YPUJhAXEJuo8F1U8VsyDL1EoYxUOoHjfibysg+qXwVwKeQbMXa2FIGlMO2u3gqHHQonKPkII9cwICwoajmR7DI06guUNRu7+OyR0nS2Au/1/bzur4DRT0mBTKdnUfROROqk9MVHzdIwuN0H3mri53FXcBXjpd+c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A9KjLaaa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A9KjLaaa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66103C4CEEB; Tue, 1 Apr 2025 04:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481652; bh=bCx7geUMIOM3KKzXlGKmU1tmG38ls8IrUrBTI29be+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A9KjLaaa9zmYt5ogUVCXxfbXwJjrrkCo62IEGRGpD2CaRKlm4OjAep8aZKUVntO3T hZAlWtxJFcUbiVAkLDzDbnH/67g4oDvMSZyB7H2ApC01xaiKMplLItagVRhjTGMAwL M+5Z+kqz3ArF32FcLzIP2146Jt2ryPtlvPOtj1FNZJgKvhYGerKtmXgWQLbQpP+5rb K9lRZXbdFXJpl0dDHcVCH4GN6ZN7XBwtAcu08SlMjZYiVg5th5u2JHDQsQd47yjxzA DoAyEBUm+sFm2wx8PJEVKAfI4JRyCqbcpqUzWzP0Wz5Xevz/uFEA6Dhj6Rp/q8Eo4c XqHYb3kSXkulA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra Subject: [PATCH 04/11] Revert "objtool: Increase per-function WARN_FUNC() rate limit" Date: Mon, 31 Mar 2025 21:26:39 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 0a7fb6f07e3ad497d31ae9a2082d2cacab43d54a. The "skipping duplicate warnings" warning is technically not an actual warning, which can cause confusion. This feature isn't all that useful anyway. It's exceedingly rare for a function to have more than one unrelated warning. Suggested-by: Ingo Molnar Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 4 ++-- tools/objtool/include/objtool/elf.h | 2 +- tools/objtool/include/objtool/warn.h | 14 +++----------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index bd0c78bfe90c..c8b3c8e7090c 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3545,7 +3545,7 @@ static int validate_branch(struct objtool_file *file,= struct symbol *func, =20 WARN("%s() falls through to next function %s()", func->name, insn_func(insn)->name); - func->warnings++; + func->warned =3D 1; =20 return 1; } @@ -4576,7 +4576,7 @@ static void disas_warned_funcs(struct objtool_file *f= ile) char *funcs =3D NULL, *tmp; =20 for_each_sym(file, sym) { - if (sym->warnings) { + if (sym->warned) { if (!funcs) { funcs =3D malloc(strlen(sym->name) + 1); if (!funcs) { diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/ob= jtool/elf.h index eba04392c6fd..c7c4e87ebe88 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -65,11 +65,11 @@ struct symbol { u8 return_thunk : 1; u8 fentry : 1; u8 profiling_func : 1; + u8 warned : 1; u8 embedded_insn : 1; u8 local_label : 1; u8 frame_pointer : 1; u8 ignore : 1; - u8 warnings : 2; struct list_head pv_target; struct reloc *relocs; }; diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/o= bjtool/warn.h index b29ac144e4f5..e3ad9b2caf87 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -57,22 +57,14 @@ static inline char *offstr(struct section *sec, unsigne= d long offset) free(_str); \ }) =20 -#define WARN_LIMIT 2 - #define WARN_INSN(insn, format, ...) \ ({ \ struct instruction *_insn =3D (insn); \ - BUILD_BUG_ON(WARN_LIMIT > 2); \ - if (!_insn->sym || _insn->sym->warnings < WARN_LIMIT) { \ + if (!_insn->sym || !_insn->sym->warned) \ WARN_FUNC(format, _insn->sec, _insn->offset, \ ##__VA_ARGS__); \ - if (_insn->sym) \ - _insn->sym->warnings++; \ - } else if (_insn->sym && _insn->sym->warnings =3D=3D WARN_LIMIT) { \ - WARN_FUNC("skipping duplicate warning(s)", \ - _insn->sec, _insn->offset); \ - _insn->sym->warnings++; \ - } \ + if (_insn->sym) \ + _insn->sym->warned =3D 1; \ }) =20 #define BT_INSN(insn, format, ...) \ --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8651A1DAC95 for ; Tue, 1 Apr 2025 04:27:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481653; cv=none; b=qRf1LioaTuomFTxflTI2zmm+wB32Hchbn85S5bqo8u3pbJsIQkpR5VcgWiTbIDJs1v//HwI3xr8U5cbaLbHCtr4gbMvrurtALeLo2jPB3SZsl2nXd8uOh2afHNli3dxk7NNsHAIiD0dw6ZRH5LcWmG27iTcyxdLSqWyVNFc9jQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481653; c=relaxed/simple; bh=qHhMjL8bK/YyS2w020DU3CdOOQucIwg1Js4WmbnvFGA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cgfOfLXHnqhO9WCGIoEEcqIjpzXULv7XrT0r69atJB0EP+L2hnqyZ+OBGvKgf4aP1d4OH6hGvmYJKO1iN3TmB/bcNX3EokL0qV75ijSklHwfLgg3kl8H5auWmP+h3iSZuzKDKb1RkdhqrtWo3S5ztHgoUOhSRUxnLBvmy7HWSr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kMrwXGpm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kMrwXGpm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7F62C4CEF1; Tue, 1 Apr 2025 04:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481653; bh=qHhMjL8bK/YyS2w020DU3CdOOQucIwg1Js4WmbnvFGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kMrwXGpm/fvQRFP+/LiRNnBdaQBHA5pXbZfRrxB+TuoSdfgaEM75lde3UGDg5RI88 qytkpgUuIfuOU0qbfr7Ush4QJQrrMqkfImZNdwm15foaNcMwUbx6qNvl0H+sKOb2Ag SvvnwShicxqYbJRr7IgDpFbzv0DNrF++NcBX7BOaVqTg7Wsg7NvlwJu5W3q6oMq6aL YrMWzUKh1qqHrbQO1FKP7weP6OqQTV3rOoWAeDBUfyas9vIaZMrHpbMBEqKygWB+dk cJVTOaMktRikU0n64xQOpbTy0ibgUmagFWYjHqBOUI+LyCdoayCteysoPhxF9Xe/Mp kP/cpY2/n2gBA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Chaitanya Kumar Borah Subject: [PATCH 05/11] objtool: Always fail on fatal errors Date: Mon, 31 Mar 2025 21:26:40 -0700 Message-ID: <7d35684ca61eac56eb2424f300ca43c5d257b170.1743481539.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Objtool writes several object annotations which are used to enable critical kernel runtime functionalities like static calls and retpoline/rethunk patching. In the rare case where it fails to read or write an object, the annotations don't get written, causing runtime code patching to fail and code to become corrupted. Due to the catastrophic nature of such warnings, convert them to errors which fail the build regardless of CONFIG_OBJTOOL_WERROR. Reported-by: Chaitanya Kumar Borah Closes: https://lore.kernel.org/SJ1PR11MB61295789E25C2F5197EFF2F6B9A72@SJ1P= R11MB6129.namprd11.prod.outlook.com Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index c8b3c8e7090c..cde669923b72 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4753,6 +4753,9 @@ int check(struct objtool_file *file) if (!ret && !warnings) return 0; =20 + if (opts.werror && warnings) + ret =3D 1; + if (opts.verbose) { if (opts.werror && warnings) WARN("%d warning(s) upgraded to errors", warnings); @@ -4760,15 +4763,5 @@ int check(struct objtool_file *file) disas_warned_funcs(file); } =20 - /* - * CONFIG_OBJTOOL_WERROR upgrades all warnings (and errors) to actual - * errors. - * - * Note that even fatal errors don't yet actually return an error - * without CONFIG_OBJTOOL_WERROR. That will be fixed soon-ish. - */ - if (opts.werror) - return 1; - - return 0; + return ret; } --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5C101DDC28 for ; Tue, 1 Apr 2025 04:27:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481654; cv=none; b=MQA6ObD+niOd3kWZGUO72UuuhRrawSMidwPgryZ0+fHW8t0kYcCzKNC30oUnWeeZxsH5F88SefkaA9g385vEOBpUioOagwDXln607RvsQbGJIt93RCDZVtfm9pY2kU3AS6Td5Sgl4+b8SCrRcBrRl3OZPE5XA/CGC5118dgsqvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481654; c=relaxed/simple; bh=ktCWHaaqmwAj1PgGXNcP+1mdfA4781mLYxDxgky652U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o9E4tNmyNGE2dV0l06Jh4lcWKGDyUc0NXu8oCfljLBh5D0Z0Ut4GoSHYMsmMk8lB7zQwX1fBp4bMjD4ba8V7D/yqPKC73dWWfOd36Q9fWh0MWbEHfh5ALq/+uWBU4zhqd4TXrn3m5xkyb4vQXbBWdxlmrcI/IajBg8hMTKO5hGI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XKhHOZrN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XKhHOZrN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E866C4CEEB; Tue, 1 Apr 2025 04:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481653; bh=ktCWHaaqmwAj1PgGXNcP+1mdfA4781mLYxDxgky652U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XKhHOZrNmw3B9oZOlt7yvnUGkL7VTLqsuVqbUCtpluh0zr7c/fR5PJBcd/lMGpEFP 6a5Ud6N8aFUUXwL09Ktzc1kawZdo0Do/Bq2q36xZPSTLRMS2+cB6Olg61v0u43Xems 9XiQNLfFz0mQyNxFnKJdSIhwKm7yWZuoNNRaHX0w894eHmsd2AnkjCM9AZLcbPOqZN My+LGjE4kwlTtdaKaZ4MwAqcJjhNHQT/8BOMkJ/ROqP0JSfsGPTIeCRdNH/3zMF/XW U+hjGgGTf2fT0dU4t8MVlmimGjhBimYznodWNUrAONthB+J2r6YgHG9rSm1Ko5XM9s K9rJ7WUY/1x3g== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra Subject: [PATCH 06/11] objtool: Change "warning:" to "error:" for fatal errors Date: Mon, 31 Mar 2025 21:26:41 -0700 Message-ID: <0ea76f4b0e7a370711ed9f75fd0792bb5979c2bf.1743481539.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is similar to GCC's behavior and makes it more obvious why the build failed. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/loongarch/decode.c | 14 ++- tools/objtool/arch/loongarch/orc.c | 8 +- tools/objtool/arch/x86/decode.c | 15 ++- tools/objtool/arch/x86/orc.c | 6 +- tools/objtool/builtin-check.c | 30 +++--- tools/objtool/check.c | 127 +++++++++++----------- tools/objtool/elf.c | 150 ++++++++++++-------------- tools/objtool/include/objtool/warn.h | 51 ++++++--- tools/objtool/objtool.c | 4 +- tools/objtool/orc_dump.c | 30 +++--- tools/objtool/special.c | 13 +-- 11 files changed, 226 insertions(+), 222 deletions(-) diff --git a/tools/objtool/arch/loongarch/decode.c b/tools/objtool/arch/loo= ngarch/decode.c index 02e490555966..b6fdc68053cc 100644 --- a/tools/objtool/arch/loongarch/decode.c +++ b/tools/objtool/arch/loongarch/decode.c @@ -63,7 +63,7 @@ static bool is_loongarch(const struct elf *elf) if (elf->ehdr.e_machine =3D=3D EM_LOONGARCH) return true; =20 - WARN("unexpected ELF machine type %d", elf->ehdr.e_machine); + ERROR("unexpected ELF machine type %d", elf->ehdr.e_machine); return false; } =20 @@ -327,8 +327,10 @@ const char *arch_nop_insn(int len) { static u32 nop; =20 - if (len !=3D LOONGARCH_INSN_SIZE) - WARN("invalid NOP size: %d\n", len); + if (len !=3D LOONGARCH_INSN_SIZE) { + ERROR("invalid NOP size: %d\n", len); + return NULL; + } =20 nop =3D LOONGARCH_INSN_NOP; =20 @@ -339,8 +341,10 @@ const char *arch_ret_insn(int len) { static u32 ret; =20 - if (len !=3D LOONGARCH_INSN_SIZE) - WARN("invalid RET size: %d\n", len); + if (len !=3D LOONGARCH_INSN_SIZE) { + ERROR("invalid RET size: %d\n", len); + return NULL; + } =20 emit_jirl((union loongarch_instruction *)&ret, LOONGARCH_GPR_RA, LOONGARC= H_GPR_ZERO, 0); =20 diff --git a/tools/objtool/arch/loongarch/orc.c b/tools/objtool/arch/loonga= rch/orc.c index 873536d009d9..b58c5ff443c9 100644 --- a/tools/objtool/arch/loongarch/orc.c +++ b/tools/objtool/arch/loongarch/orc.c @@ -41,7 +41,7 @@ int init_orc_entry(struct orc_entry *orc, struct cfi_stat= e *cfi, struct instruct orc->type =3D ORC_TYPE_REGS_PARTIAL; break; default: - WARN_INSN(insn, "unknown unwind hint type %d", cfi->type); + ERROR_INSN(insn, "unknown unwind hint type %d", cfi->type); return -1; } =20 @@ -55,7 +55,7 @@ int init_orc_entry(struct orc_entry *orc, struct cfi_stat= e *cfi, struct instruct orc->sp_reg =3D ORC_REG_FP; break; default: - WARN_INSN(insn, "unknown CFA base reg %d", cfi->cfa.base); + ERROR_INSN(insn, "unknown CFA base reg %d", cfi->cfa.base); return -1; } =20 @@ -72,7 +72,7 @@ int init_orc_entry(struct orc_entry *orc, struct cfi_stat= e *cfi, struct instruct orc->fp_reg =3D ORC_REG_FP; break; default: - WARN_INSN(insn, "unknown FP base reg %d", fp->base); + ERROR_INSN(insn, "unknown FP base reg %d", fp->base); return -1; } =20 @@ -89,7 +89,7 @@ int init_orc_entry(struct orc_entry *orc, struct cfi_stat= e *cfi, struct instruct orc->ra_reg =3D ORC_REG_FP; break; default: - WARN_INSN(insn, "unknown RA base reg %d", ra->base); + ERROR_INSN(insn, "unknown RA base reg %d", ra->base); return -1; } =20 diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decod= e.c index 7567c893f45e..33d861c04ebd 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -36,7 +36,7 @@ static int is_x86_64(const struct elf *elf) case EM_386: return 0; default: - WARN("unexpected ELF machine type %d", elf->ehdr.e_machine); + ERROR("unexpected ELF machine type %d", elf->ehdr.e_machine); return -1; } } @@ -173,7 +173,7 @@ int arch_decode_instruction(struct objtool_file *file, = const struct section *sec ret =3D insn_decode(&ins, sec->data->d_buf + offset, maxlen, x86_64 ? INSN_MODE_64 : INSN_MODE_32); if (ret < 0) { - WARN("can't decode instruction at %s:0x%lx", sec->name, offset); + ERROR("can't decode instruction at %s:0x%lx", sec->name, offset); return -1; } =20 @@ -321,7 +321,7 @@ int arch_decode_instruction(struct objtool_file *file, = const struct section *sec break; =20 default: - /* WARN ? */ + /* ERROR ? */ break; } =20 @@ -561,8 +561,7 @@ int arch_decode_instruction(struct objtool_file *file, = const struct section *sec if (ins.prefixes.nbytes =3D=3D 1 && ins.prefixes.bytes[0] =3D=3D 0xf2) { /* ENQCMD cannot be used in the kernel. */ - WARN("ENQCMD instruction at %s:%lx", sec->name, - offset); + WARN("ENQCMD instruction at %s:%lx", sec->name, offset); } =20 } else if (op2 =3D=3D 0xa0 || op2 =3D=3D 0xa8) { @@ -646,7 +645,7 @@ int arch_decode_instruction(struct objtool_file *file, = const struct section *sec if (disp->sym->type =3D=3D STT_SECTION) func =3D find_symbol_by_offset(disp->sym->sec, reloc_addend(disp)); if (!func) { - WARN("no func for pv_ops[]"); + ERROR("no func for pv_ops[]"); return -1; } =20 @@ -776,7 +775,7 @@ const char *arch_nop_insn(int len) }; =20 if (len < 1 || len > 5) { - WARN("invalid NOP size: %d\n", len); + ERROR("invalid NOP size: %d\n", len); return NULL; } =20 @@ -796,7 +795,7 @@ const char *arch_ret_insn(int len) }; =20 if (len < 1 || len > 5) { - WARN("invalid RET size: %d\n", len); + ERROR("invalid RET size: %d\n", len); return NULL; } =20 diff --git a/tools/objtool/arch/x86/orc.c b/tools/objtool/arch/x86/orc.c index b6cd943e87f9..7176b9ec5b05 100644 --- a/tools/objtool/arch/x86/orc.c +++ b/tools/objtool/arch/x86/orc.c @@ -40,7 +40,7 @@ int init_orc_entry(struct orc_entry *orc, struct cfi_stat= e *cfi, struct instruct orc->type =3D ORC_TYPE_REGS_PARTIAL; break; default: - WARN_INSN(insn, "unknown unwind hint type %d", cfi->type); + ERROR_INSN(insn, "unknown unwind hint type %d", cfi->type); return -1; } =20 @@ -72,7 +72,7 @@ int init_orc_entry(struct orc_entry *orc, struct cfi_stat= e *cfi, struct instruct orc->sp_reg =3D ORC_REG_DX; break; default: - WARN_INSN(insn, "unknown CFA base reg %d", cfi->cfa.base); + ERROR_INSN(insn, "unknown CFA base reg %d", cfi->cfa.base); return -1; } =20 @@ -87,7 +87,7 @@ int init_orc_entry(struct orc_entry *orc, struct cfi_stat= e *cfi, struct instruct orc->bp_reg =3D ORC_REG_BP; break; default: - WARN_INSN(insn, "unknown BP base reg %d", bp->base); + ERROR_INSN(insn, "unknown BP base reg %d", bp->base); return -1; } =20 diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index e364ab6345d3..80239843e9f0 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -139,22 +139,22 @@ int cmd_parse_options(int argc, const char **argv, co= nst char * const usage[]) static bool opts_valid(void) { if (opts.mnop && !opts.mcount) { - WARN("--mnop requires --mcount"); + ERROR("--mnop requires --mcount"); return false; } =20 if (opts.noinstr && !opts.link) { - WARN("--noinstr requires --link"); + ERROR("--noinstr requires --link"); return false; } =20 if (opts.ibt && !opts.link) { - WARN("--ibt requires --link"); + ERROR("--ibt requires --link"); return false; } =20 if (opts.unret && !opts.link) { - WARN("--unret requires --link"); + ERROR("--unret requires --link"); return false; } =20 @@ -171,7 +171,7 @@ static bool opts_valid(void) opts.static_call || opts.uaccess) { if (opts.dump_orc) { - WARN("--dump can't be combined with other actions"); + ERROR("--dump can't be combined with other actions"); return false; } =20 @@ -181,7 +181,7 @@ static bool opts_valid(void) if (opts.dump_orc) return true; =20 - WARN("At least one action required"); + ERROR("At least one action required"); return false; } =20 @@ -194,30 +194,30 @@ static int copy_file(const char *src, const char *dst) =20 src_fd =3D open(src, O_RDONLY); if (src_fd =3D=3D -1) { - WARN("can't open %s for reading: %s", src, strerror(errno)); + ERROR("can't open %s for reading: %s", src, strerror(errno)); return 1; } =20 dst_fd =3D open(dst, O_WRONLY | O_CREAT | O_TRUNC, 0400); if (dst_fd =3D=3D -1) { - WARN("can't open %s for writing: %s", dst, strerror(errno)); + ERROR("can't open %s for writing: %s", dst, strerror(errno)); return 1; } =20 if (fstat(src_fd, &stat) =3D=3D -1) { - WARN_GLIBC("fstat"); + ERROR_GLIBC("fstat"); return 1; } =20 if (fchmod(dst_fd, stat.st_mode) =3D=3D -1) { - WARN_GLIBC("fchmod"); + ERROR_GLIBC("fchmod"); return 1; } =20 for (to_copy =3D stat.st_size; to_copy > 0; to_copy -=3D copied) { copied =3D sendfile(dst_fd, src_fd, &offset, to_copy); if (copied =3D=3D -1) { - WARN_GLIBC("sendfile"); + ERROR_GLIBC("sendfile"); return 1; } } @@ -231,14 +231,14 @@ static void save_argv(int argc, const char **argv) { orig_argv =3D calloc(argc, sizeof(char *)); if (!orig_argv) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); exit(1); } =20 for (int i =3D 0; i < argc; i++) { orig_argv[i] =3D strdup(argv[i]); if (!orig_argv[i]) { - WARN_GLIBC("strdup(%s)", argv[i]); + ERROR_GLIBC("strdup(%s)", argv[i]); exit(1); } }; @@ -257,7 +257,7 @@ void print_args(void) */ backup =3D malloc(strlen(objname) + strlen(ORIG_SUFFIX) + 1); if (!backup) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); goto print; } =20 @@ -319,7 +319,7 @@ int objtool_run(int argc, const char **argv) return 1; =20 if (!opts.link && has_multiple_files(file->elf)) { - WARN("Linked object requires --link"); + ERROR("Linked object requires --link"); return 1; } =20 diff --git a/tools/objtool/check.c b/tools/objtool/check.c index cde669923b72..ff83be1aab1d 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -348,7 +348,7 @@ static struct cfi_state *cfi_alloc(void) { struct cfi_state *cfi =3D calloc(1, sizeof(struct cfi_state)); if (!cfi) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); exit(1); } nr_cfi++; @@ -404,7 +404,7 @@ static void *cfi_hash_alloc(unsigned long size) PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); if (cfi_hash =3D=3D (void *)-1L) { - WARN_GLIBC("mmap fail cfi_hash"); + ERROR_GLIBC("mmap fail cfi_hash"); cfi_hash =3D NULL; } else if (opts.stats) { printf("cfi_bits: %d\n", cfi_bits); @@ -460,7 +460,7 @@ static int decode_instructions(struct objtool_file *fil= e) if (!insns || idx =3D=3D INSN_CHUNK_MAX) { insns =3D calloc(sizeof(*insn), INSN_CHUNK_SIZE); if (!insns) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } idx =3D 0; @@ -495,8 +495,6 @@ static int decode_instructions(struct objtool_file *fil= e) nr_insns++; } =20 -// printf("%s: last chunk used: %d\n", sec->name, (int)idx); - sec_for_each_sym(sec, func) { if (func->type !=3D STT_NOTYPE && func->type !=3D STT_FUNC) continue; @@ -505,8 +503,7 @@ static int decode_instructions(struct objtool_file *fil= e) /* Heuristic: likely an "end" symbol */ if (func->type =3D=3D STT_NOTYPE) continue; - WARN("%s(): STT_FUNC at end of section", - func->name); + ERROR("%s(): STT_FUNC at end of section", func->name); return -1; } =20 @@ -514,8 +511,7 @@ static int decode_instructions(struct objtool_file *fil= e) continue; =20 if (!find_insn(file, sec, func->offset)) { - WARN("%s(): can't find starting instruction", - func->name); + ERROR("%s(): can't find starting instruction", func->name); return -1; } =20 @@ -569,9 +565,8 @@ static int add_pv_ops(struct objtool_file *file, const = char *symname) func =3D find_symbol_by_offset(reloc->sym->sec, reloc_addend(reloc)); if (!func) { - WARN_FUNC("can't find func at %s[%d]", - reloc->sym->sec, reloc_addend(reloc), - symname, idx); + ERROR_FUNC(reloc->sym->sec, reloc_addend(reloc), + "can't find func at %s[%d]", symname, idx); return -1; } =20 @@ -614,7 +609,7 @@ static int init_pv_ops(struct objtool_file *file) nr =3D sym->len / sizeof(unsigned long); file->pv_ops =3D calloc(sizeof(struct pv_state), nr); if (!file->pv_ops) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } =20 @@ -673,12 +668,12 @@ static int create_static_call_sections(struct objtool= _file *file) /* find key symbol */ key_name =3D strdup(insn_call_dest(insn)->name); if (!key_name) { - WARN_GLIBC("strdup"); + ERROR_GLIBC("strdup"); return -1; } if (strncmp(key_name, STATIC_CALL_TRAMP_PREFIX_STR, STATIC_CALL_TRAMP_PREFIX_LEN)) { - WARN("static_call: trampoline name malformed: %s", key_name); + ERROR("static_call: trampoline name malformed: %s", key_name); return -1; } tmp =3D key_name + STATIC_CALL_TRAMP_PREFIX_LEN - STATIC_CALL_KEY_PREFIX= _LEN; @@ -687,7 +682,7 @@ static int create_static_call_sections(struct objtool_f= ile *file) key_sym =3D find_symbol_by_name(file->elf, tmp); if (!key_sym) { if (!opts.module) { - WARN("static_call: can't find static_call_key symbol: %s", tmp); + ERROR("static_call: can't find static_call_key symbol: %s", tmp); return -1; } =20 @@ -833,8 +828,8 @@ static int create_ibt_endbr_seal_sections(struct objtoo= l_file *file) insn->offset =3D=3D sym->offset && (!strcmp(sym->name, "init_module") || !strcmp(sym->name, "cleanup_module"))) { - WARN("%s(): Magic init_module() function name is deprecated, use module= _init(fn) instead", - sym->name); + ERROR("%s(): Magic init_module() function name is deprecated, use modul= e_init(fn) instead", + sym->name); return -1; } =20 @@ -1008,8 +1003,8 @@ static int add_ignores(struct objtool_file *file) break; =20 default: - WARN("unexpected relocation symbol type in %s: %d", - rsec->name, reloc->sym->type); + ERROR("unexpected relocation symbol type in %s: %d", + rsec->name, reloc->sym->type); return -1; } =20 @@ -1559,8 +1554,8 @@ static int add_jump_destinations(struct objtool_file = *file) dest_off =3D=3D func->offset + func->len) continue; =20 - WARN_INSN(insn, "can't find jump dest instruction at %s+0x%lx", - dest_sec->name, dest_off); + ERROR_INSN(insn, "can't find jump dest instruction at %s+0x%lx", + dest_sec->name, dest_off); return -1; } =20 @@ -1666,12 +1661,12 @@ static int add_call_destinations(struct objtool_fil= e *file) continue; =20 if (!insn_call_dest(insn)) { - WARN_INSN(insn, "unannotated intra-function call"); + ERROR_INSN(insn, "unannotated intra-function call"); return -1; } =20 if (func && insn_call_dest(insn)->type !=3D STT_FUNC) { - WARN_INSN(insn, "unsupported call to non-function"); + ERROR_INSN(insn, "unsupported call to non-function"); return -1; } =20 @@ -1679,8 +1674,8 @@ static int add_call_destinations(struct objtool_file = *file) dest_off =3D arch_dest_reloc_offset(reloc_addend(reloc)); dest =3D find_call_destination(reloc->sym->sec, dest_off); if (!dest) { - WARN_INSN(insn, "can't find call dest symbol at %s+0x%lx", - reloc->sym->sec->name, dest_off); + ERROR_INSN(insn, "can't find call dest symbol at %s+0x%lx", + reloc->sym->sec->name, dest_off); return -1; } =20 @@ -1722,13 +1717,13 @@ static int handle_group_alt(struct objtool_file *fi= le, =20 orig_alt_group =3D calloc(1, sizeof(*orig_alt_group)); if (!orig_alt_group) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } orig_alt_group->cfi =3D calloc(special_alt->orig_len, sizeof(struct cfi_state *)); if (!orig_alt_group->cfi) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } =20 @@ -1748,18 +1743,18 @@ static int handle_group_alt(struct objtool_file *fi= le, } else { if (orig_alt_group->last_insn->offset + orig_alt_group->last_insn->len - orig_alt_group->first_insn->offset !=3D special_alt->orig_len) { - WARN_INSN(orig_insn, "weirdly overlapping alternative! %ld !=3D %d", - orig_alt_group->last_insn->offset + - orig_alt_group->last_insn->len - - orig_alt_group->first_insn->offset, - special_alt->orig_len); + ERROR_INSN(orig_insn, "weirdly overlapping alternative! %ld !=3D %d", + orig_alt_group->last_insn->offset + + orig_alt_group->last_insn->len - + orig_alt_group->first_insn->offset, + special_alt->orig_len); return -1; } } =20 new_alt_group =3D calloc(1, sizeof(*new_alt_group)); if (!new_alt_group) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } =20 @@ -1773,7 +1768,7 @@ static int handle_group_alt(struct objtool_file *file, */ nop =3D calloc(1, sizeof(*nop)); if (!nop) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } memset(nop, 0, sizeof(*nop)); @@ -1815,7 +1810,7 @@ static int handle_group_alt(struct objtool_file *file, if (alt_reloc && arch_pc_relative_reloc(alt_reloc) && !arch_support_alt_relocation(special_alt, insn, alt_reloc)) { =20 - WARN_INSN(insn, "unsupported relocation in alternatives section"); + ERROR_INSN(insn, "unsupported relocation in alternatives section"); return -1; } =20 @@ -1829,15 +1824,15 @@ static int handle_group_alt(struct objtool_file *fi= le, if (dest_off =3D=3D special_alt->new_off + special_alt->new_len) { insn->jump_dest =3D next_insn_same_sec(file, orig_alt_group->last_insn); if (!insn->jump_dest) { - WARN_INSN(insn, "can't find alternative jump destination"); + ERROR_INSN(insn, "can't find alternative jump destination"); return -1; } } } =20 if (!last_new_insn) { - WARN_FUNC("can't find last new alternative instruction", - special_alt->new_sec, special_alt->new_off); + ERROR_FUNC(special_alt->new_sec, special_alt->new_off, + "can't find last new alternative instruction"); return -1; } =20 @@ -1864,7 +1859,7 @@ static int handle_jump_alt(struct objtool_file *file, if (orig_insn->type !=3D INSN_JUMP_UNCONDITIONAL && orig_insn->type !=3D INSN_NOP) { =20 - WARN_INSN(orig_insn, "unsupported instruction at jump label"); + ERROR_INSN(orig_insn, "unsupported instruction at jump label"); return -1; } =20 @@ -1923,8 +1918,8 @@ static int add_special_section_alts(struct objtool_fi= le *file) orig_insn =3D find_insn(file, special_alt->orig_sec, special_alt->orig_off); if (!orig_insn) { - WARN_FUNC("special: can't find orig instruction", - special_alt->orig_sec, special_alt->orig_off); + ERROR_FUNC(special_alt->orig_sec, special_alt->orig_off, + "special: can't find orig instruction"); return -1; } =20 @@ -1933,16 +1928,15 @@ static int add_special_section_alts(struct objtool_= file *file) new_insn =3D find_insn(file, special_alt->new_sec, special_alt->new_off); if (!new_insn) { - WARN_FUNC("special: can't find new instruction", - special_alt->new_sec, - special_alt->new_off); + ERROR_FUNC(special_alt->new_sec, special_alt->new_off, + "special: can't find new instruction"); return -1; } } =20 if (special_alt->group) { if (!special_alt->orig_len) { - WARN_INSN(orig_insn, "empty alternative entry"); + ERROR_INSN(orig_insn, "empty alternative entry"); continue; } =20 @@ -1960,7 +1954,7 @@ static int add_special_section_alts(struct objtool_fi= le *file) =20 alt =3D calloc(1, sizeof(*alt)); if (!alt) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } =20 @@ -2037,7 +2031,7 @@ static int add_jump_table(struct objtool_file *file, = struct instruction *insn) =20 alt =3D calloc(1, sizeof(*alt)); if (!alt) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } =20 @@ -2049,7 +2043,7 @@ static int add_jump_table(struct objtool_file *file, = struct instruction *insn) } =20 if (!prev_offset) { - WARN_INSN(insn, "can't find switch jump table"); + ERROR_INSN(insn, "can't find switch jump table"); return -1; } =20 @@ -2207,12 +2201,12 @@ static int read_unwind_hints(struct objtool_file *f= ile) return 0; =20 if (!sec->rsec) { - WARN("missing .rela.discard.unwind_hints section"); + ERROR("missing .rela.discard.unwind_hints section"); return -1; } =20 if (sec->sh.sh_size % sizeof(struct unwind_hint)) { - WARN("struct unwind_hint size mismatch"); + ERROR("struct unwind_hint size mismatch"); return -1; } =20 @@ -2223,7 +2217,7 @@ static int read_unwind_hints(struct objtool_file *fil= e) =20 reloc =3D find_reloc_by_dest(file->elf, sec, i * sizeof(*hint)); if (!reloc) { - WARN("can't find reloc for unwind_hints[%d]", i); + ERROR("can't find reloc for unwind_hints[%d]", i); return -1; } =20 @@ -2232,13 +2226,13 @@ static int read_unwind_hints(struct objtool_file *f= ile) } else if (reloc->sym->local_label) { offset =3D reloc->sym->offset; } else { - WARN("unexpected relocation symbol type in %s", sec->rsec->name); + ERROR("unexpected relocation symbol type in %s", sec->rsec->name); return -1; } =20 insn =3D find_insn(file, reloc->sym->sec, offset); if (!insn) { - WARN("can't find insn for unwind_hints[%d]", i); + ERROR("can't find insn for unwind_hints[%d]", i); return -1; } =20 @@ -2265,7 +2259,7 @@ static int read_unwind_hints(struct objtool_file *fil= e) =20 if (sym && sym->bind =3D=3D STB_GLOBAL) { if (opts.ibt && insn->type !=3D INSN_ENDBR && !insn->noendbr) { - WARN_INSN(insn, "UNWIND_HINT_IRET_REGS without ENDBR"); + ERROR_INSN(insn, "UNWIND_HINT_IRET_REGS without ENDBR"); return -1; } } @@ -2280,7 +2274,7 @@ static int read_unwind_hints(struct objtool_file *fil= e) cfi =3D *(insn->cfi); =20 if (arch_decode_hint_reg(hint->sp_reg, &cfi.cfa.base)) { - WARN_INSN(insn, "unsupported unwind_hint sp base reg %d", hint->sp_reg); + ERROR_INSN(insn, "unsupported unwind_hint sp base reg %d", hint->sp_reg= ); return -1; } =20 @@ -2326,7 +2320,7 @@ static int read_annotate(struct objtool_file *file, insn =3D find_insn(file, reloc->sym->sec, offset); =20 if (!insn) { - WARN("bad .discard.annotate_insn entry: %d of type %d", reloc_idx(reloc= ), type); + ERROR("bad .discard.annotate_insn entry: %d of type %d", reloc_idx(relo= c), type); return -1; } =20 @@ -2369,7 +2363,7 @@ static int __annotate_ifc(struct objtool_file *file, = int type, struct instructio return 0; =20 if (insn->type !=3D INSN_CALL) { - WARN_INSN(insn, "intra_function_call not a direct call"); + ERROR_INSN(insn, "intra_function_call not a direct call"); return -1; } =20 @@ -2383,8 +2377,8 @@ static int __annotate_ifc(struct objtool_file *file, = int type, struct instructio dest_off =3D arch_jump_destination(insn); insn->jump_dest =3D find_insn(file, insn->sec, dest_off); if (!insn->jump_dest) { - WARN_INSN(insn, "can't find call dest at %s+0x%lx", - insn->sec->name, dest_off); + ERROR_INSN(insn, "can't find call dest at %s+0x%lx", + insn->sec->name, dest_off); return -1; } =20 @@ -2403,7 +2397,7 @@ static int __annotate_late(struct objtool_file *file,= int type, struct instructi insn->type !=3D INSN_CALL_DYNAMIC && insn->type !=3D INSN_RETURN && insn->type !=3D INSN_NOP) { - WARN_INSN(insn, "retpoline_safe hint not an indirect jump/call/ret/nop"= ); + ERROR_INSN(insn, "retpoline_safe hint not an indirect jump/call/ret/nop= "); return -1; } =20 @@ -2435,7 +2429,7 @@ static int __annotate_late(struct objtool_file *file,= int type, struct instructi break; =20 default: - WARN_INSN(insn, "Unknown annotation type: %d", type); + ERROR_INSN(insn, "Unknown annotation type: %d", type); return -1; } =20 @@ -4393,9 +4387,8 @@ static int validate_ibt_data_reloc(struct objtool_fil= e *file, if (dest->noendbr) return 0; =20 - WARN_FUNC("data relocation to !ENDBR: %s", - reloc->sec->base, reloc_offset(reloc), - offstr(dest->sec, dest->offset)); + WARN_FUNC(reloc->sec->base, reloc_offset(reloc), + "data relocation to !ENDBR: %s", offstr(dest->sec, dest->offset)); =20 return 1; } @@ -4580,14 +4573,14 @@ static void disas_warned_funcs(struct objtool_file = *file) if (!funcs) { funcs =3D malloc(strlen(sym->name) + 1); if (!funcs) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); return; } strcpy(funcs, sym->name); } else { tmp =3D malloc(strlen(funcs) + strlen(sym->name) + 2); if (!tmp) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); return; } sprintf(tmp, "%s %s", funcs, sym->name); diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index b352a78b596c..727a3a4fd9d7 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -72,17 +72,17 @@ static inline void __elf_hash_del(struct elf_hash_node = *node, obj; \ obj =3D elf_list_entry(obj->member.next, typeof(*(obj)), member)) =20 -#define elf_alloc_hash(name, size) \ -({ \ - __elf_bits(name) =3D max(10, ilog2(size)); \ +#define elf_alloc_hash(name, size) \ +({ \ + __elf_bits(name) =3D max(10, ilog2(size)); \ __elf_table(name) =3D mmap(NULL, sizeof(struct elf_hash_node *) << __elf_= bits(name), \ - PROT_READ|PROT_WRITE, \ - MAP_PRIVATE|MAP_ANON, -1, 0); \ - if (__elf_table(name) =3D=3D (void *)-1L) { \ - WARN("mmap fail " #name); \ - __elf_table(name) =3D NULL; \ - } \ - __elf_table(name); \ + PROT_READ|PROT_WRITE, \ + MAP_PRIVATE|MAP_ANON, -1, 0); \ + if (__elf_table(name) =3D=3D (void *)-1L) { \ + ERROR_GLIBC("mmap fail " #name); \ + __elf_table(name) =3D NULL; \ + } \ + __elf_table(name); \ }) =20 static inline unsigned long __sym_start(struct symbol *s) @@ -316,12 +316,12 @@ static int read_sections(struct elf *elf) int i; =20 if (elf_getshdrnum(elf->elf, §ions_nr)) { - WARN_ELF("elf_getshdrnum"); + ERROR_ELF("elf_getshdrnum"); return -1; } =20 if (elf_getshdrstrndx(elf->elf, &shstrndx)) { - WARN_ELF("elf_getshdrstrndx"); + ERROR_ELF("elf_getshdrstrndx"); return -1; } =20 @@ -331,7 +331,7 @@ static int read_sections(struct elf *elf) =20 elf->section_data =3D calloc(sections_nr, sizeof(*sec)); if (!elf->section_data) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } for (i =3D 0; i < sections_nr; i++) { @@ -341,33 +341,32 @@ static int read_sections(struct elf *elf) =20 s =3D elf_getscn(elf->elf, i); if (!s) { - WARN_ELF("elf_getscn"); + ERROR_ELF("elf_getscn"); return -1; } =20 sec->idx =3D elf_ndxscn(s); =20 if (!gelf_getshdr(s, &sec->sh)) { - WARN_ELF("gelf_getshdr"); + ERROR_ELF("gelf_getshdr"); return -1; } =20 sec->name =3D elf_strptr(elf->elf, shstrndx, sec->sh.sh_name); if (!sec->name) { - WARN_ELF("elf_strptr"); + ERROR_ELF("elf_strptr"); return -1; } =20 if (sec->sh.sh_size !=3D 0 && !is_dwarf_section(sec)) { sec->data =3D elf_getdata(s, NULL); if (!sec->data) { - WARN_ELF("elf_getdata"); + ERROR_ELF("elf_getdata"); return -1; } if (sec->data->d_off !=3D 0 || sec->data->d_size !=3D sec->sh.sh_size) { - WARN("unexpected data attributes for %s", - sec->name); + ERROR("unexpected data attributes for %s", sec->name); return -1; } } @@ -387,7 +386,7 @@ static int read_sections(struct elf *elf) =20 /* sanity check, one more call to elf_nextscn() should return NULL */ if (elf_nextscn(elf->elf, s)) { - WARN("section entry mismatch"); + ERROR("section entry mismatch"); return -1; } =20 @@ -467,7 +466,7 @@ static int read_symbols(struct elf *elf) =20 elf->symbol_data =3D calloc(symbols_nr, sizeof(*sym)); if (!elf->symbol_data) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } for (i =3D 0; i < symbols_nr; i++) { @@ -477,14 +476,14 @@ static int read_symbols(struct elf *elf) =20 if (!gelf_getsymshndx(symtab->data, shndx_data, i, &sym->sym, &shndx)) { - WARN_ELF("gelf_getsymshndx"); + ERROR_ELF("gelf_getsymshndx"); goto err; } =20 sym->name =3D elf_strptr(elf->elf, symtab->sh.sh_link, sym->sym.st_name); if (!sym->name) { - WARN_ELF("elf_strptr"); + ERROR_ELF("elf_strptr"); goto err; } =20 @@ -496,8 +495,7 @@ static int read_symbols(struct elf *elf) =20 sym->sec =3D find_section_by_index(elf, shndx); if (!sym->sec) { - WARN("couldn't find section for symbol %s", - sym->name); + ERROR("couldn't find section for symbol %s", sym->name); goto err; } if (GELF_ST_TYPE(sym->sym.st_info) =3D=3D STT_SECTION) { @@ -536,8 +534,7 @@ static int read_symbols(struct elf *elf) pnamelen =3D coldstr - sym->name; pname =3D strndup(sym->name, pnamelen); if (!pname) { - WARN("%s(): failed to allocate memory", - sym->name); + ERROR("%s(): failed to allocate memory", sym->name); return -1; } =20 @@ -545,8 +542,7 @@ static int read_symbols(struct elf *elf) free(pname); =20 if (!pfunc) { - WARN("%s(): can't find parent function", - sym->name); + ERROR("%s(): can't find parent function", sym->name); return -1; } =20 @@ -613,14 +609,14 @@ static int elf_update_symbol(struct elf *elf, struct = section *symtab, =20 s =3D elf_getscn(elf->elf, symtab->idx); if (!s) { - WARN_ELF("elf_getscn"); + ERROR_ELF("elf_getscn"); return -1; } =20 if (symtab_shndx) { t =3D elf_getscn(elf->elf, symtab_shndx->idx); if (!t) { - WARN_ELF("elf_getscn"); + ERROR_ELF("elf_getscn"); return -1; } } @@ -643,7 +639,7 @@ static int elf_update_symbol(struct elf *elf, struct se= ction *symtab, =20 if (idx) { /* we don't do holes in symbol tables */ - WARN("index out of range"); + ERROR("index out of range"); return -1; } =20 @@ -654,7 +650,7 @@ static int elf_update_symbol(struct elf *elf, struct se= ction *symtab, =20 buf =3D calloc(num, entsize); if (!buf) { - WARN("malloc"); + ERROR_GLIBC("calloc"); return -1; } =20 @@ -669,7 +665,7 @@ static int elf_update_symbol(struct elf *elf, struct se= ction *symtab, if (t) { buf =3D calloc(num, sizeof(Elf32_Word)); if (!buf) { - WARN("malloc"); + ERROR_GLIBC("calloc"); return -1; } =20 @@ -687,7 +683,7 @@ static int elf_update_symbol(struct elf *elf, struct se= ction *symtab, =20 /* empty blocks should not happen */ if (!symtab_data->d_size) { - WARN("zero size data"); + ERROR("zero size data"); return -1; } =20 @@ -702,7 +698,7 @@ static int elf_update_symbol(struct elf *elf, struct se= ction *symtab, =20 /* something went side-ways */ if (idx < 0) { - WARN("negative index"); + ERROR("negative index"); return -1; } =20 @@ -714,13 +710,13 @@ static int elf_update_symbol(struct elf *elf, struct = section *symtab, } else { sym->sym.st_shndx =3D SHN_XINDEX; if (!shndx_data) { - WARN("no .symtab_shndx"); + ERROR("no .symtab_shndx"); return -1; } } =20 if (!gelf_update_symshndx(symtab_data, shndx_data, idx, &sym->sym, shndx)= ) { - WARN_ELF("gelf_update_symshndx"); + ERROR_ELF("gelf_update_symshndx"); return -1; } =20 @@ -738,7 +734,7 @@ __elf_create_symbol(struct elf *elf, struct symbol *sym) if (symtab) { symtab_shndx =3D find_section_by_name(elf, ".symtab_shndx"); } else { - WARN("no .symtab"); + ERROR("no .symtab"); return NULL; } =20 @@ -760,7 +756,7 @@ __elf_create_symbol(struct elf *elf, struct symbol *sym) old->idx =3D new_idx; =20 if (elf_update_symbol(elf, symtab, symtab_shndx, old)) { - WARN("elf_update_symbol move"); + ERROR("elf_update_symbol move"); return NULL; } =20 @@ -778,7 +774,7 @@ __elf_create_symbol(struct elf *elf, struct symbol *sym) non_local: sym->idx =3D new_idx; if (elf_update_symbol(elf, symtab, symtab_shndx, sym)) { - WARN("elf_update_symbol"); + ERROR("elf_update_symbol"); return NULL; } =20 @@ -799,7 +795,7 @@ elf_create_section_symbol(struct elf *elf, struct secti= on *sec) struct symbol *sym =3D calloc(1, sizeof(*sym)); =20 if (!sym) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); return NULL; } =20 @@ -829,7 +825,7 @@ elf_create_prefix_symbol(struct elf *elf, struct symbol= *orig, long size) char *name =3D malloc(namelen); =20 if (!sym || !name) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); return NULL; } =20 @@ -858,16 +854,16 @@ static struct reloc *elf_init_reloc(struct elf *elf, = struct section *rsec, struct reloc *reloc, empty =3D { 0 }; =20 if (reloc_idx >=3D sec_num_entries(rsec)) { - WARN("%s: bad reloc_idx %u for %s with %d relocs", - __func__, reloc_idx, rsec->name, sec_num_entries(rsec)); + ERROR("%s: bad reloc_idx %u for %s with %d relocs", + __func__, reloc_idx, rsec->name, sec_num_entries(rsec)); return NULL; } =20 reloc =3D &rsec->relocs[reloc_idx]; =20 if (memcmp(reloc, &empty, sizeof(empty))) { - WARN("%s: %s: reloc %d already initialized!", - __func__, rsec->name, reloc_idx); + ERROR("%s: %s: reloc %d already initialized!", + __func__, rsec->name, reloc_idx); return NULL; } =20 @@ -896,8 +892,7 @@ struct reloc *elf_init_reloc_text_sym(struct elf *elf, = struct section *sec, int addend =3D insn_off; =20 if (!(insn_sec->sh.sh_flags & SHF_EXECINSTR)) { - WARN("bad call to %s() for data symbol %s", - __func__, sym->name); + ERROR("bad call to %s() for data symbol %s", __func__, sym->name); return NULL; } =20 @@ -926,8 +921,7 @@ struct reloc *elf_init_reloc_data_sym(struct elf *elf, = struct section *sec, s64 addend) { if (sym->sec && (sec->sh.sh_flags & SHF_EXECINSTR)) { - WARN("bad call to %s() for text symbol %s", - __func__, sym->name); + ERROR("bad call to %s() for text symbol %s", __func__, sym->name); return NULL; } =20 @@ -953,8 +947,7 @@ static int read_relocs(struct elf *elf) =20 rsec->base =3D find_section_by_index(elf, rsec->sh.sh_info); if (!rsec->base) { - WARN("can't find base section for reloc section %s", - rsec->name); + ERROR("can't find base section for reloc section %s", rsec->name); return -1; } =20 @@ -963,7 +956,7 @@ static int read_relocs(struct elf *elf) nr_reloc =3D 0; rsec->relocs =3D calloc(sec_num_entries(rsec), sizeof(*reloc)); if (!rsec->relocs) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return -1; } for (i =3D 0; i < sec_num_entries(rsec); i++) { @@ -973,8 +966,7 @@ static int read_relocs(struct elf *elf) symndx =3D reloc_sym(reloc); reloc->sym =3D sym =3D find_symbol_by_index(elf, symndx); if (!reloc->sym) { - WARN("can't find reloc entry symbol %d for %s", - symndx, rsec->name); + ERROR("can't find reloc entry symbol %d for %s", symndx, rsec->name); return -1; } =20 @@ -1005,7 +997,7 @@ struct elf *elf_open_read(const char *name, int flags) =20 elf =3D malloc(sizeof(*elf)); if (!elf) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); return NULL; } memset(elf, 0, sizeof(*elf)); @@ -1028,12 +1020,12 @@ struct elf *elf_open_read(const char *name, int fla= gs) =20 elf->elf =3D elf_begin(elf->fd, cmd, NULL); if (!elf->elf) { - WARN_ELF("elf_begin"); + ERROR_ELF("elf_begin"); goto err; } =20 if (!gelf_getehdr(elf->elf, &elf->ehdr)) { - WARN_ELF("gelf_getehdr"); + ERROR_ELF("gelf_getehdr"); goto err; } =20 @@ -1062,19 +1054,19 @@ static int elf_add_string(struct elf *elf, struct s= ection *strtab, char *str) if (!strtab) strtab =3D find_section_by_name(elf, ".strtab"); if (!strtab) { - WARN("can't find .strtab section"); + ERROR("can't find .strtab section"); return -1; } =20 s =3D elf_getscn(elf->elf, strtab->idx); if (!s) { - WARN_ELF("elf_getscn"); + ERROR_ELF("elf_getscn"); return -1; } =20 data =3D elf_newdata(s); if (!data) { - WARN_ELF("elf_newdata"); + ERROR_ELF("elf_newdata"); return -1; } =20 @@ -1099,7 +1091,7 @@ struct section *elf_create_section(struct elf *elf, c= onst char *name, =20 sec =3D malloc(sizeof(*sec)); if (!sec) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); return NULL; } memset(sec, 0, sizeof(*sec)); @@ -1108,13 +1100,13 @@ struct section *elf_create_section(struct elf *elf,= const char *name, =20 s =3D elf_newscn(elf->elf); if (!s) { - WARN_ELF("elf_newscn"); + ERROR_ELF("elf_newscn"); return NULL; } =20 sec->name =3D strdup(name); if (!sec->name) { - WARN_GLIBC("strdup"); + ERROR_GLIBC("strdup"); return NULL; } =20 @@ -1122,7 +1114,7 @@ struct section *elf_create_section(struct elf *elf, c= onst char *name, =20 sec->data =3D elf_newdata(s); if (!sec->data) { - WARN_ELF("elf_newdata"); + ERROR_ELF("elf_newdata"); return NULL; } =20 @@ -1132,14 +1124,14 @@ struct section *elf_create_section(struct elf *elf,= const char *name, if (size) { sec->data->d_buf =3D malloc(size); if (!sec->data->d_buf) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); return NULL; } memset(sec->data->d_buf, 0, size); } =20 if (!gelf_getshdr(s, &sec->sh)) { - WARN_ELF("gelf_getshdr"); + ERROR_ELF("gelf_getshdr"); return NULL; } =20 @@ -1154,7 +1146,7 @@ struct section *elf_create_section(struct elf *elf, c= onst char *name, if (!shstrtab) shstrtab =3D find_section_by_name(elf, ".strtab"); if (!shstrtab) { - WARN("can't find .shstrtab or .strtab section"); + ERROR("can't find .shstrtab or .strtab section"); return NULL; } sec->sh.sh_name =3D elf_add_string(elf, shstrtab, sec->name); @@ -1179,7 +1171,7 @@ static struct section *elf_create_rela_section(struct= elf *elf, =20 rsec_name =3D malloc(strlen(sec->name) + strlen(".rela") + 1); if (!rsec_name) { - WARN_GLIBC("malloc"); + ERROR_GLIBC("malloc"); return NULL; } strcpy(rsec_name, ".rela"); @@ -1199,7 +1191,7 @@ static struct section *elf_create_rela_section(struct= elf *elf, =20 rsec->relocs =3D calloc(sec_num_entries(rsec), sizeof(struct reloc)); if (!rsec->relocs) { - WARN_GLIBC("calloc"); + ERROR_GLIBC("calloc"); return NULL; } =20 @@ -1232,7 +1224,7 @@ int elf_write_insn(struct elf *elf, struct section *s= ec, Elf_Data *data =3D sec->data; =20 if (data->d_type !=3D ELF_T_BYTE || data->d_off) { - WARN("write to unexpected data for section: %s", sec->name); + ERROR("write to unexpected data for section: %s", sec->name); return -1; } =20 @@ -1261,7 +1253,7 @@ static int elf_truncate_section(struct elf *elf, stru= ct section *sec) =20 s =3D elf_getscn(elf->elf, sec->idx); if (!s) { - WARN_ELF("elf_getscn"); + ERROR_ELF("elf_getscn"); return -1; } =20 @@ -1271,7 +1263,7 @@ static int elf_truncate_section(struct elf *elf, stru= ct section *sec) =20 if (!data) { if (size) { - WARN("end of section data but non-zero size left\n"); + ERROR("end of section data but non-zero size left\n"); return -1; } return 0; @@ -1279,12 +1271,12 @@ static int elf_truncate_section(struct elf *elf, st= ruct section *sec) =20 if (truncated) { /* when we remove symbols */ - WARN("truncated; but more data\n"); + ERROR("truncated; but more data\n"); return -1; } =20 if (!data->d_size) { - WARN("zero size data"); + ERROR("zero size data"); return -1; } =20 @@ -1310,13 +1302,13 @@ int elf_write(struct elf *elf) if (sec_changed(sec)) { s =3D elf_getscn(elf->elf, sec->idx); if (!s) { - WARN_ELF("elf_getscn"); + ERROR_ELF("elf_getscn"); return -1; } =20 /* Note this also flags the section dirty */ if (!gelf_update_shdr(s, &sec->sh)) { - WARN_ELF("gelf_update_shdr"); + ERROR_ELF("gelf_update_shdr"); return -1; } =20 @@ -1329,7 +1321,7 @@ int elf_write(struct elf *elf) =20 /* Write all changes to the file. */ if (elf_update(elf->elf, ELF_C_WRITE) < 0) { - WARN_ELF("elf_update"); + ERROR_ELF("elf_update"); return -1; } =20 diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/o= bjtool/warn.h index e3ad9b2caf87..cb8fe846d9dd 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -42,26 +42,43 @@ static inline char *offstr(struct section *sec, unsigne= d long offset) return str; } =20 -#define WARN(format, ...) \ - fprintf(stderr, \ - "%s%s%s: objtool: " format "\n", \ - objname ?: "", \ - objname ? ": " : "", \ - opts.werror ? "error" : "warning", \ +#define ___WARN(severity, extra, format, ...) \ + fprintf(stderr, \ + "%s%s%s: objtool" extra ": " format "\n", \ + objname ?: "", \ + objname ? ": " : "", \ + severity, \ ##__VA_ARGS__) =20 -#define WARN_FUNC(format, sec, offset, ...) \ -({ \ - char *_str =3D offstr(sec, offset); \ - WARN("%s: " format, _str, ##__VA_ARGS__); \ - free(_str); \ +#define __WARN(severity, format, ...) \ + ___WARN(severity, "", format, ##__VA_ARGS__) + +#define __WARN_LINE(severity, format, ...) \ + ___WARN(severity, " [%s:%d]", format, __FILE__, __LINE__, ##__VA_ARGS__) + +#define __WARN_ELF(severity, format, ...) \ + __WARN_LINE(severity, "%s: " format " failed: %s", __func__, ##__VA_ARGS_= _, elf_errmsg(-1)) + +#define __WARN_GLIBC(severity, format, ...) \ + __WARN_LINE(severity, "%s: " format " failed: %s", __func__, ##__VA_ARGS_= _, strerror(errno)) + +#define __WARN_FUNC(severity, sec, offset, format, ...) \ +({ \ + char *_str =3D offstr(sec, offset); \ + __WARN(severity, "%s: " format, _str, ##__VA_ARGS__); \ + free(_str); \ }) =20 +#define WARN_STR (opts.werror ? "error" : "warning") + +#define WARN(format, ...) __WARN(WARN_STR, format, ##__VA_ARGS__) +#define WARN_FUNC(sec, offset, format, ...) __WARN_FUNC(WARN_STR, sec, off= set, format, ##__VA_ARGS__) + #define WARN_INSN(insn, format, ...) \ ({ \ struct instruction *_insn =3D (insn); \ if (!_insn->sym || !_insn->sym->warned) \ - WARN_FUNC(format, _insn->sec, _insn->offset, \ + WARN_FUNC(_insn->sec, _insn->offset, format, \ ##__VA_ARGS__); \ if (_insn->sym) \ _insn->sym->warned =3D 1; \ @@ -77,10 +94,12 @@ static inline char *offstr(struct section *sec, unsigne= d long offset) } \ }) =20 -#define WARN_ELF(format, ...) \ - WARN("%s: " format " failed: %s", __func__, ##__VA_ARGS__, elf_errmsg(-1)) +#define ERROR_STR "error" =20 -#define WARN_GLIBC(format, ...) \ - WARN("%s: " format " failed: %s", __func__, ##__VA_ARGS__, strerror(errno= )) +#define ERROR(format, ...) __WARN(ERROR_STR, format, ##__VA_ARGS__) +#define ERROR_ELF(format, ...) __WARN_ELF(ERROR_STR, format, ##__VA_ARGS__) +#define ERROR_GLIBC(format, ...) __WARN_GLIBC(ERROR_STR, format, ##__VA_AR= GS__) +#define ERROR_FUNC(sec, offset, format, ...) __WARN_FUNC(ERROR_STR, sec, o= ffset, format, ##__VA_ARGS__) +#define ERROR_INSN(insn, format, ...) WARN_FUNC(insn->sec, insn->offset, f= ormat, ##__VA_ARGS__) =20 #endif /* _WARN_H */ diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c index e4b49c534e4d..5c8b974ad0f9 100644 --- a/tools/objtool/objtool.c +++ b/tools/objtool/objtool.c @@ -23,7 +23,7 @@ static struct objtool_file file; struct objtool_file *objtool_open_read(const char *filename) { if (file.elf) { - WARN("won't handle more than one file at a time"); + ERROR("won't handle more than one file at a time"); return NULL; } =20 @@ -50,7 +50,7 @@ int objtool_pv_add(struct objtool_file *f, int idx, struc= t symbol *func) return 0; =20 if (!f->pv_ops) { - WARN("paravirt confusion"); + ERROR("paravirt confusion"); return -1; } =20 diff --git a/tools/objtool/orc_dump.c b/tools/objtool/orc_dump.c index 05ef0e297837..1dd9fc18fe62 100644 --- a/tools/objtool/orc_dump.c +++ b/tools/objtool/orc_dump.c @@ -36,47 +36,47 @@ int orc_dump(const char *filename) =20 elf =3D elf_begin(fd, ELF_C_READ_MMAP, NULL); if (!elf) { - WARN_ELF("elf_begin"); + ERROR_ELF("elf_begin"); return -1; } =20 if (!elf64_getehdr(elf)) { - WARN_ELF("elf64_getehdr"); + ERROR_ELF("elf64_getehdr"); return -1; } memcpy(&dummy_elf.ehdr, elf64_getehdr(elf), sizeof(dummy_elf.ehdr)); =20 if (elf_getshdrnum(elf, &nr_sections)) { - WARN_ELF("elf_getshdrnum"); + ERROR_ELF("elf_getshdrnum"); return -1; } =20 if (elf_getshdrstrndx(elf, &shstrtab_idx)) { - WARN_ELF("elf_getshdrstrndx"); + ERROR_ELF("elf_getshdrstrndx"); return -1; } =20 for (i =3D 0; i < nr_sections; i++) { scn =3D elf_getscn(elf, i); if (!scn) { - WARN_ELF("elf_getscn"); + ERROR_ELF("elf_getscn"); return -1; } =20 if (!gelf_getshdr(scn, &sh)) { - WARN_ELF("gelf_getshdr"); + ERROR_ELF("gelf_getshdr"); return -1; } =20 name =3D elf_strptr(elf, shstrtab_idx, sh.sh_name); if (!name) { - WARN_ELF("elf_strptr"); + ERROR_ELF("elf_strptr"); return -1; } =20 data =3D elf_getdata(scn, NULL); if (!data) { - WARN_ELF("elf_getdata"); + ERROR_ELF("elf_getdata"); return -1; } =20 @@ -99,7 +99,7 @@ int orc_dump(const char *filename) return 0; =20 if (orc_size % sizeof(*orc) !=3D 0) { - WARN("bad .orc_unwind section size"); + ERROR("bad .orc_unwind section size"); return -1; } =20 @@ -107,36 +107,36 @@ int orc_dump(const char *filename) for (i =3D 0; i < nr_entries; i++) { if (rela_orc_ip) { if (!gelf_getrela(rela_orc_ip, i, &rela)) { - WARN_ELF("gelf_getrela"); + ERROR_ELF("gelf_getrela"); return -1; } =20 if (!gelf_getsym(symtab, GELF_R_SYM(rela.r_info), &sym)) { - WARN_ELF("gelf_getsym"); + ERROR_ELF("gelf_getsym"); return -1; } =20 if (GELF_ST_TYPE(sym.st_info) =3D=3D STT_SECTION) { scn =3D elf_getscn(elf, sym.st_shndx); if (!scn) { - WARN_ELF("elf_getscn"); + ERROR_ELF("elf_getscn"); return -1; } =20 if (!gelf_getshdr(scn, &sh)) { - WARN_ELF("gelf_getshdr"); + ERROR_ELF("gelf_getshdr"); return -1; } =20 name =3D elf_strptr(elf, shstrtab_idx, sh.sh_name); if (!name) { - WARN_ELF("elf_strptr"); + ERROR_ELF("elf_strptr"); return -1; } } else { name =3D elf_strptr(elf, strtab_idx, sym.st_name); if (!name) { - WARN_ELF("elf_strptr"); + ERROR_ELF("elf_strptr"); return -1; } } diff --git a/tools/objtool/special.c b/tools/objtool/special.c index 6cd7b1be5331..c80fed8a840e 100644 --- a/tools/objtool/special.c +++ b/tools/objtool/special.c @@ -86,7 +86,7 @@ static int get_alt_entry(struct elf *elf, const struct sp= ecial_entry *entry, =20 orig_reloc =3D find_reloc_by_dest(elf, sec, offset + entry->orig); if (!orig_reloc) { - WARN_FUNC("can't find orig reloc", sec, offset + entry->orig); + ERROR_FUNC(sec, offset + entry->orig, "can't find orig reloc"); return -1; } =20 @@ -97,8 +97,7 @@ static int get_alt_entry(struct elf *elf, const struct sp= ecial_entry *entry, if (!entry->group || alt->new_len) { new_reloc =3D find_reloc_by_dest(elf, sec, offset + entry->new); if (!new_reloc) { - WARN_FUNC("can't find new reloc", - sec, offset + entry->new); + ERROR_FUNC(sec, offset + entry->new, "can't find new reloc"); return -1; } =20 @@ -114,8 +113,7 @@ static int get_alt_entry(struct elf *elf, const struct = special_entry *entry, =20 key_reloc =3D find_reloc_by_dest(elf, sec, offset + entry->key); if (!key_reloc) { - WARN_FUNC("can't find key reloc", - sec, offset + entry->key); + ERROR_FUNC(sec, offset + entry->key, "can't find key reloc"); return -1; } alt->key_addend =3D reloc_addend(key_reloc); @@ -145,8 +143,7 @@ int special_get_alts(struct elf *elf, struct list_head = *alts) continue; =20 if (sec->sh.sh_size % entry->size !=3D 0) { - WARN("%s size not a multiple of %d", - sec->name, entry->size); + ERROR("%s size not a multiple of %d", sec->name, entry->size); return -1; } =20 @@ -155,7 +152,7 @@ int special_get_alts(struct elf *elf, struct list_head = *alts) for (idx =3D 0; idx < nr_entries; idx++) { alt =3D malloc(sizeof(*alt)); if (!alt) { - WARN("malloc failed"); + ERROR_GLIBC("malloc failed"); return -1; } memset(alt, 0, sizeof(*alt)); --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB8641DE2B4 for ; Tue, 1 Apr 2025 04:27:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481653; cv=none; b=ZvgcV5fFhtB0ajk4mvApYjfIOAyOLEJIllK9oKhtzOF7yIsZVbNc65Br2jKVg4d4rVFcOVG4wHFLcgtt22HPsdnhD8L3Gn6jRRwOPKeYAREjHmnFxW51VkTSR4Cizr1f0R5HWXcgaUvVX39I+cVknQgJAGksuImRvYuC8F0wcxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481653; c=relaxed/simple; bh=HeWAUSvi+fwdMfowwn5h8IBT9PJLR48hdAQU93J1RUA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NqHktrlsrgRQTmad9Y4wbmLKPIiq7mDDgMBeTT3HNrgB921k8q1FuL24lqkv0STnZTI1n6ci39B2siJUv6/0pwmHN4zdONkqB5oG7K5qZBboj2xHUo1LIqaBtgDPUPvchrhle3LULHCY8NCWmbyuTJ1cyuuhuzDNHYQJV7DjQNo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jJwz+Yjj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jJwz+Yjj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89B7EC4AF0B; Tue, 1 Apr 2025 04:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481653; bh=HeWAUSvi+fwdMfowwn5h8IBT9PJLR48hdAQU93J1RUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jJwz+YjjZ3n2NINPqZd7bqchTRWrBBlJ4/AbvrvCkycIud/afDX4LvIHwxxkf2Giv BLkRf7yqLz5YiAlcuBAoLra8SZYhhdg3znMea6X96y2HIoj8Gvgf3zasGBpEgQQtDX SCDSO4we5JOMaKhJy8JX74bYIxN73r3OCp2EUUieZ/aGhMBZU9hsRpMi6slR2pftXN nysd0nJa0OYikbylhoIBJ13S3Fo79ssOQoZogOz9UTOZZEHMBD/6aX3p7Hz5u5LKRw czbWq758uK+2HGvUvOQ6dmLLNxy1jO1qsbP8g1kFz8xg9sg4whmU82NK9Qe1uou21V talnLzJdzZzmA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , David Laight Subject: [PATCH 07/11] objtool: Fix verbose disassembly if CROSS_COMPILE isn't set Date: Mon, 31 Mar 2025 21:26:42 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: David Laight In verbose mode, when printing the disassembly of affected functions, if CROSS_COMPILE isn't set, the objdump command string gets prefixed with "(null)". Somehow this worked before. Maybe some versions of glibc return an empty string instead of NULL. Fix it regardless. [ jpoimboe: Rewrite commit log. ] Fixes: ca653464dd097 ("objtool: Add verbose option for disassembling affect= ed functions") Signed-off-by: David Laight Link: https://lore.kernel.org/r/20250215142321.14081-1-david.laight.linux@g= mail.com Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index ff83be1aab1d..4a1f6c3169b3 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4523,6 +4523,8 @@ static void disas_funcs(const char *funcs) char *cmd; =20 cross_compile =3D getenv("CROSS_COMPILE"); + if (!cross_compile) + cross_compile =3D ""; =20 objdump_str =3D "%sobjdump -wdr %s | gawk -M -v _funcs=3D'%s' '" "BEGIN { split(_funcs, funcs); }" --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D6681DFDAB for ; Tue, 1 Apr 2025 04:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481654; cv=none; b=BbPpEoA5GA7j9HLh9GoWtVdf1d6kFWlX8R142Wdx24ITIcryCWc4NhetSfpcOlte17/9vqdpIWA4SrPHJ6SB0jgMB64hOXjrumDP89YmHvZ3raIc4jxpQ7xbvJtdfRbe1YXJU7Z2Rz5VN41Yk/dFcbysWfQrCkHnkHBMcaT5i1c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481654; c=relaxed/simple; bh=iZmlswQ3UvXTNTH1uFvXsw0rEiRaXkBAaCexmzsnDMc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a+/OUIeyxq4LQoWwXuM5EFgIDUElG+A2V2oSU62ykwtA31iNMrSBWSfpLnmV2ivlzQFqp0xCbpogtNjwpk5m8/wBFhaj/7hDm55jL4NpSo6EDSpvJEw6Uj5coPsDwJgvOtwOSLK0KHYXH4PQT9zdVtW5ysb5K8DcZMyOxFaSxfE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KpFXWg1z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KpFXWg1z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C1BC4CEF2; Tue, 1 Apr 2025 04:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481654; bh=iZmlswQ3UvXTNTH1uFvXsw0rEiRaXkBAaCexmzsnDMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KpFXWg1zOoDO6YBmxuDfiCEDJlkaLSqPIQkTOJ0w2lTFSDAf5HRMN/ILv1/VWnaJJ pClY4UfBCuBGCYti3HKLFuNMoPxKPrnEsTF8KcZj+d0ZpVny+6gdlaZMFVhN6EIsVt 9PTHnrZWkRb8j5/mvUiDxDwhfgBqFgjj0nq7I45/6DZgrPxRyXGP25SIgHZx+0XjdK /nW+oBrr4ZW73fyRJ6FsjkRHR3bIX8zLtEDjWWNCmbWj7pgDRO6kRTEl+bpdh4zgX8 7efB5vnziusZh+435rHxhVujflRU/vIT7UpZBS2FNklH833k6kXR6lRmsn7yimw+t4 yOxDDdUcrHCQA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Tiezhu Yang , kernel test robot Subject: [PATCH 08/11] objtool/loongarch: Add unwind hints in prepare_frametrace() Date: Mon, 31 Mar 2025 21:26:43 -0700 Message-ID: <270cadd8040dda74db2307f23497bb68e65db98d.1743481539.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If 'regs' points to a local stack variable, prepare_frametrace() stores all registers to the stack. This confuses objtool as it expects them to be restored from the stack later. The stores don't affect stack tracing, so use unwind hints to hide them from objtool. Fixes the following warnings: arch/loongarch/kernel/traps.o: warning: objtool: show_stack+0xe0: stack s= tate mismatch: reg1[22]=3D-1+0 reg2[22]=3D-2-160 arch/loongarch/kernel/traps.o: warning: objtool: show_stack+0xe0: stack s= tate mismatch: reg1[23]=3D-1+0 reg2[23]=3D-2-152 Cc: Tiezhu Yang Fixes: cb8a2ef0848c ("LoongArch: Add ORC stack unwinder support") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202503280703.OARM8SrY-lkp@int= el.com/ Signed-off-by: Josh Poimboeuf Tested-by: Tiezhu Yang --- arch/loongarch/include/asm/stacktrace.h | 3 +++ arch/loongarch/include/asm/unwind_hints.h | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/loongarch/include/asm/stacktrace.h b/arch/loongarch/inclu= de/asm/stacktrace.h index f23adb15f418..fc8b64773794 100644 --- a/arch/loongarch/include/asm/stacktrace.h +++ b/arch/loongarch/include/asm/stacktrace.h @@ -8,6 +8,7 @@ #include #include #include +#include #include =20 enum stack_type { @@ -43,6 +44,7 @@ int get_stack_info(unsigned long stack, struct task_struc= t *task, struct stack_i static __always_inline void prepare_frametrace(struct pt_regs *regs) { __asm__ __volatile__( + UNWIND_HINT_SAVE /* Save $ra */ STORE_ONE_REG(1) /* Use $ra to save PC */ @@ -80,6 +82,7 @@ static __always_inline void prepare_frametrace(struct pt_= regs *regs) STORE_ONE_REG(29) STORE_ONE_REG(30) STORE_ONE_REG(31) + UNWIND_HINT_RESTORE : "=3Dm" (regs->csr_era) : "r" (regs->regs) : "memory"); diff --git a/arch/loongarch/include/asm/unwind_hints.h b/arch/loongarch/inc= lude/asm/unwind_hints.h index a01086ad9dde..2c68bc72736c 100644 --- a/arch/loongarch/include/asm/unwind_hints.h +++ b/arch/loongarch/include/asm/unwind_hints.h @@ -23,6 +23,14 @@ UNWIND_HINT sp_reg=3DORC_REG_SP type=3DUNWIND_HINT_TYPE_CALL .endm =20 -#endif /* __ASSEMBLY__ */ +#else /* !__ASSEMBLY__ */ + +#define UNWIND_HINT_SAVE \ + UNWIND_HINT(UNWIND_HINT_TYPE_SAVE, 0, 0, 0) + +#define UNWIND_HINT_RESTORE \ + UNWIND_HINT(UNWIND_HINT_TYPE_RESTORE, 0, 0, 0) + +#endif /* !__ASSEMBLY__ */ =20 #endif /* _ASM_LOONGARCH_UNWIND_HINTS_H */ --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D7D91E260C for ; Tue, 1 Apr 2025 04:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481655; cv=none; b=u4TyqxdRqC+aGm3YC7GlPxIif8Lz41M9NL9b7zGucsmAUCs9AelUj0gVtp0lHDy1tIbeDrbYDldLwATDaCdKkBnNwYVeUNDoniMLgri4VxFYsLGt772T5FQQtregxJN2X+B9iQGEyWF9VsqPEka4QobMlWRRnedpJyveLzqPgcE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481655; c=relaxed/simple; bh=o0Rq4fqnpT0WXFQ926+2MYLgQbCiJYmR5gSGR2GmX5c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XMdnpfOCvtrj6CQXK9AwuM3Md8y5/7CLRu5Ta++ROXmln0+FnXLh1VQVyRnMhWgBxDd+tzdbsPDsJt6GkVXv4WL2bYNaC/twQCRXA+YnzfDfFZ6Qsp3chgfhZOc7Wtb4kC4FBRDSacupujTm3qKgEmPX1m8KsCztXDsSbq83Xik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pBf7EGI8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pBf7EGI8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D633C4CEED; Tue, 1 Apr 2025 04:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481654; bh=o0Rq4fqnpT0WXFQ926+2MYLgQbCiJYmR5gSGR2GmX5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pBf7EGI8B0GQjXMUr6iuhmA6R/b6cAKZCVK64vnixsdmz0FROCHrAPZOOdPDQrOJx RLHl82xrisV0L7JSw4qt/ISlRbAQTyIUBHXwdjhkSaorqTFFSK/NPgl0kccnbPna17 XT0Qel+Okrzf+p0P900oLuMqmh6YOnU266+xO9poIvI7hQrH2Q+d+fEk43obKIcGOz WCi+YjQKYgpadu0/pdG1Y0FMxAjfccQLLuQRJpDnneJ61OA+PJ7z8Rv63XSKUfD7eP YCk/QckzobkTf3p61RfapzHXw2tMaeZa6CtdOUZb5hHOWIAlT0rj84FXQRZxzCKZQF ya4dyeZk1d5Mw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , kernel test robot Subject: [PATCH 09/11] sched/smt: Always inline sched_smt_active() Date: Mon, 31 Mar 2025 21:26:44 -0700 Message-ID: <1d03907b0a247cf7fb5c1d518de378864f603060.1743481539.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" sched_smt_active() can be called from noinstr code, so it should always be inlined. The CONFIG_SCHED_SMT version already has __always_inline. Do the same for its !CONFIG_SCHED_SMT counterpart. Fixes the following warning: vmlinux.o: error: objtool: intel_idle_ibrs+0x13: call to sched_smt_active= () leaves .noinstr.text section Fixes: 321a874a7ef8 ("sched/smt: Expose sched_smt_present static key") Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202503311434.lyw2Tveh-lkp@intel.com/ Signed-off-by: Josh Poimboeuf --- include/linux/sched/smt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/sched/smt.h b/include/linux/sched/smt.h index fb1e295e7e63..166b19af956f 100644 --- a/include/linux/sched/smt.h +++ b/include/linux/sched/smt.h @@ -12,7 +12,7 @@ static __always_inline bool sched_smt_active(void) return static_branch_likely(&sched_smt_present); } #else -static inline bool sched_smt_active(void) { return false; } +static __always_inline bool sched_smt_active(void) { return false; } #endif =20 void arch_smt_update(void); --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CE211E22FC for ; Tue, 1 Apr 2025 04:27:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481655; cv=none; b=YZ2uSseCVeshzaApWDY2lC5l0IaUysmb99C6Du7xWlTu53kNbpc18M6PrRYSwXHHRlRT1swYVrfxDLO52iSIg2VRr6ohn+hLh5UOI/UNd4m5QgTcbdoDxbLf9feKjzXCE2UrATyKsye3f49/MDJ2Lzk0SUHeylCPuU7ReWgrdCM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481655; c=relaxed/simple; bh=DpZApQ3fxMrUC3/ISfLUORB6Dhdjyueg6i2b7UimCCE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K+s5sImj5R6oGR3A9KTylA0Mh/3KltzYJHXqtTz1TZlzuYOhtywHcxxYfPCRV3fwXPTQIlRJm6MlcJvt6NE/wcmYJmEnKOA2DNrTXzx3+i4w7IQbzc0LChmNQCjTf4DF8fo54AT987AMFcquP1TJYoJeynt2Int4gBJJfPZjEWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c/9EpPfK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c/9EpPfK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF655C4CEEA; Tue, 1 Apr 2025 04:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481654; bh=DpZApQ3fxMrUC3/ISfLUORB6Dhdjyueg6i2b7UimCCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/9EpPfKmzwqtjO2QCtI+aSTz3WLv2lSsRKVKWo5gOpoaA/FadxaXmzYHy9XnVdCT 1ZpnH70cknGt7fh/7I9+T9/xvPJISZUdBJrXij9nO2JM0AQwmsfNZrkb2UnaZab6+2 s0NLoEI0u0mLUQp3ExguIUk6++42F41WsXfZYXKLoz3/h2KuZx63btM6eRr8FsaruK NPqSrVntLZN99h/4dGqUzsll8zRlvXGRbJUITmGEzqujxERPHoSE+oWMYEdku4KF02 qZRFcMJO+Aeskbp/ENlHhfl5HV29O9PtPslzBzBCHIWqdTzP0OJcCfPezlX+WjcHR5 P2gymXOLCp7fw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Randy Dunlap Subject: [PATCH 10/11] context_tracking: Always inline ct_{nmi,irq}_{enter,exit}() Date: Mon, 31 Mar 2025 21:26:45 -0700 Message-ID: <8509bce3f536bcd4ae7af3a2cf6930d48c5e631a.1743481539.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Thanks to CONFIG_DEBUG_SECTION_MISMATCH, empty functions can be generated out of line. These can be called from noinstr code, so make sure they're always inlined. Fixes the following warnings: vmlinux.o: warning: objtool: irqentry_nmi_enter+0xa2: call to ct_nmi_ente= r() leaves .noinstr.text section vmlinux.o: warning: objtool: irqentry_nmi_exit+0x16: call to ct_nmi_exit(= ) leaves .noinstr.text section vmlinux.o: warning: objtool: irqentry_exit+0x78: call to ct_irq_exit() le= aves .noinstr.text section Fixes: 6f0e6c1598b1 ("context_tracking: Take IRQ eqs entrypoints over RCU") Reported-by: Randy Dunlap Closes: https://lore.kernel.org/d1eca076-fdde-484a-b33e-70e0d167c36d@infrad= ead.org Signed-off-by: Josh Poimboeuf --- include/linux/context_tracking_irq.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/context_tracking_irq.h b/include/linux/context_t= racking_irq.h index c50b5670c4a5..197916ee91a4 100644 --- a/include/linux/context_tracking_irq.h +++ b/include/linux/context_tracking_irq.h @@ -10,12 +10,12 @@ void ct_irq_exit_irqson(void); void ct_nmi_enter(void); void ct_nmi_exit(void); #else -static inline void ct_irq_enter(void) { } -static inline void ct_irq_exit(void) { } +static __always_inline void ct_irq_enter(void) { } +static __always_inline void ct_irq_exit(void) { } static inline void ct_irq_enter_irqson(void) { } static inline void ct_irq_exit_irqson(void) { } -static inline void ct_nmi_enter(void) { } -static inline void ct_nmi_exit(void) { } +static __always_inline void ct_nmi_enter(void) { } +static __always_inline void ct_nmi_exit(void) { } #endif =20 #endif --=20 2.48.1 From nobody Fri Dec 19 21:27:06 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D092B1E5732 for ; Tue, 1 Apr 2025 04:27:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481655; cv=none; b=TwIxqb9ySNdkXp95qGQFLk2m5t2XE33bHdGCZuKBjdoF7cGrfxPqtR2aJ88tsOmmJmkHcOJqajvI8VwlqPXPzZ6/UZC+Mf7/m+hGT1GYvURQwrKu9ewdwb/AQQb90ycmVICOaKK5MBdPoohNryawKqrGZOApNZrdVJfEds2o0KE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743481655; c=relaxed/simple; bh=CvDKZ8XDMiR2a/y1KZg2z41sHTyV/p7YvJahkPRDXP8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ncvU9W/QbP9X25wK9UXFyIx9mv5P349th5N9BQiK8ZVYvruHUpopgDhnT1oYIGuNxN6LdPsA+QrnOMIe4EP4YiF5QMDrRIqTw3ZcZFd3jk5RtZnHdlDgp48yKysPKYYOVQkOOsdrhF3V0nYBx+k3TFYBKhiux++EIk7Ep9t0Zq0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fPOa2XCT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fPOa2XCT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16EE6C4CEE8; Tue, 1 Apr 2025 04:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743481655; bh=CvDKZ8XDMiR2a/y1KZg2z41sHTyV/p7YvJahkPRDXP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fPOa2XCT3Lid6qLd6UObxUDdHOIesbAChTFwZgUujnODn/bhNbNChzgj/DxHnr4ES OuVMye39/aGsOVFJ/CBmo0AjK9tDM5bK9Tn54p25fQzaRLHZubhPKStlNjCKCGmh41 QMuGGdP6vfCbl0kRFPVNrbn7YgNimzbqzRnmCgkZUK2z6VZ5NVOZdLFbm9mus+ER6L g9sZX0rBxsLlIt3koJpBg36IU7G2vQI5b4xc7eFET5beYKuHzHd6K3L7UP87cfp0pl EdgiO5WuXnBTtuoTqzRy4e3lRWtQpL5xB0hpyQtVSczsIIZjT3vtl/nneh0WiROy5K 8tWkBHhpmsIGg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Randy Dunlap Subject: [PATCH 11/11] rcu-tasks: Always inline rcu_irq_work_resched() Date: Mon, 31 Mar 2025 21:26:46 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Thanks to CONFIG_DEBUG_SECTION_MISMATCH, empty functions can be generated out of line. rcu_irq_work_resched() can be called from noinstr code, so make sure it's always inlined. Fixes: 564506495ca9 ("rcu/context-tracking: Move deferred nocb resched to c= ontext tracking") Reported-by: Randy Dunlap Closes: https://lore.kernel.org/d1eca076-fdde-484a-b33e-70e0d167c36d@infrad= ead.org Signed-off-by: Josh Poimboeuf --- include/linux/rcupdate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index f8159f8a7d73..120536f4c6eb 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -132,7 +132,7 @@ static inline void rcu_sysrq_end(void) { } #if defined(CONFIG_NO_HZ_FULL) && (!defined(CONFIG_GENERIC_ENTRY) || !defi= ned(CONFIG_KVM_XFER_TO_GUEST_WORK)) void rcu_irq_work_resched(void); #else -static inline void rcu_irq_work_resched(void) { } +static __always_inline void rcu_irq_work_resched(void) { } #endif =20 #ifdef CONFIG_RCU_NOCB_CPU --=20 2.48.1