lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bfd7035b-ca08-66d2-bdc5-d28743144128@loongson.cn>
Date: Wed, 17 Sep 2025 17:47:14 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>
Cc: Josh Poimboeuf <jpoimboe@...nel.org>,
 Peter Zijlstra <peterz@...radead.org>, loongarch@...ts.linux.dev,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/4] objtool/LoongArch: Fix unreachable instruction
 warnings about entry points

On 2025/9/17 下午3:07, Huacai Chen wrote:
> Hi, Tiezhu,
> 
> On Wed, Sep 17, 2025 at 9:10 AM Tiezhu Yang <yangtiezhu@...ngson.cn> wrote:
>>
>> When compiling with LLVM and CONFIG_LTO_CLANG is set, there exist the
>> following objtool warnings:
>>
>>    vmlinux.o: warning: objtool: kernel_entry+0x0: unreachable instruction
>>    vmlinux.o: warning: objtool: smpboot_entry+0x0: unreachable instruction
>>
>> kernel_entry() and smpboot_entry() are in arch/loongarch/kernel/head.S,
>> there is "OBJECT_FILES_NON_STANDARD_head.o := y" to skip objtool checking
>> for head.o, but the STACK_FRAME_NON_STANDARD macro does not work for link
>> time validation of vmlinux.o according to objtool documentation, just give
>> a proper unwind hint to fix the warnings.
>>
>> By the way, ASM_BUG() can be removed due to unnecessary, otherwise there
>> are following warnings:
>>
>>    kernel_entry+0xf4: start_kernel() missing __noreturn
>>    in .c/.h or NORETURN() in noreturns.h
>>
>>    smpboot_entry+0x68: start_secondary() missing __noreturn
>>    in .c/.h or NORETURN() in noreturns.h
>>
>> This is because the previous instructions of kernel_entry+0xf4 and
>> smpboot_entry+0x68 are the 'bl' instructions, start_kernel() and
>> start_secondary() are the respective call destination symbols which
>> are noreturn functions, then the 'bl' instructions are already marked
>> as dead end in annotate_call_site().
>>
>> For now, it is time to remove "OBJECT_FILES_NON_STANDARD_head.o := y"
>> in arch/loongarch/kernel/Makefile.

...

>> -OBJECT_FILES_NON_STANDARD_head.o := y
> This line should be kept, othewise we get:
> 
> arch/loongarch/kernel/head.o: warning: objtool: kernel_entry+0xf4:
> start_kernel() missing __noreturn in .c/.h or NORETURN() in
> noreturns.h
> 
> even without LTO. This is a regression, we can only remove it after
> the above warning be fixed.

As said in the commit message, ASM_BUG() needs to be removed
to fix the above warning.

I tested again with GCC and LLVM (with and without LTO),
there is no the warning what you said, please double check.

(1) GCC
make ARCH=loongarch defconfig
make ARCH=loongarch -j8

(2) LLVM without LTO
make ARCH=loongarch LLVM=1 clean defconfig
make ARCH=loongarch LLVM=1 olddefconfig all -j8

(3) LLVM with LTO
make ARCH=loongarch LLVM=1 clean defconfig
scripts/config -d LTO_NONE -e LTO_CLANG_THIN
make ARCH=loongarch LLVM=1 olddefconfig all -j8

Thanks,
Tiezhu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ