Re: objtool failure caused some kernel functionality not working

From: Yonghong Song
Date: Thu Jan 30 2025 - 11:31:47 EST





On 1/30/25 12:25 AM, Josh Poimboeuf wrote:
On Wed, Jan 29, 2025 at 11:10:14PM -0800, Yonghong Song wrote:
The llvm18 does not have issues. I tried to bisect what changed in llvm19 and
found the following llvm patch is responsible:

https://github.com/llvm/llvm-project/pull/96089

Basically, the compiler might be able to create a jump target which actually
not possible at runtime. For example, in one of examples in the above llvm patch, something
like
if i >= 3 goto out; /* i unsigned */
switch i, label default_unreachable:
case 0: goto label1;
case 1: goto label2;
case 2: goto label3;
label1: ...; return;
label2: ...; return;
label3: ...; return;
default_unreachable:

I think that this should be a valid code from compiler perspective.

Can we fix objtool to handle jump target which is immediately after the func body?Thanks, Yonghong
I actually have a fix for that, can you try this?

https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/commit/?h=objtool/core&id=fbb454b7bb39955c324693e73a5cf7e448632553

I applied the above fix and now the kernel works fine and /sys/kernel/debug/tracing/available_filter_functions
can display tracable functions properly.

The fix is in your personal branch. Any plan to send it to upstream repo?

The fix also makes sense to me. So

Tested-by: Yonghong Song <yonghong.song@xxxxxxxxx>
Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>