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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H4e0xeHoEJ4Vzs8pQT+sbjaAL8N=Vc=TrU8fd3iU=97nQ@mail.gmail.com>
Date: Tue, 23 Sep 2025 22:32:14 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: WANG Rui <wangrui@...ngson.cn>, loongarch@...ts.linux.dev, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] LoongArch: Add -fno-isolate-erroneous-paths-dereference
 in Makefile

Hi, Tiezhu,

On Tue, Sep 23, 2025 at 2:17 PM Tiezhu Yang <yangtiezhu@...ngson.cn> wrote:
>
> Currently, when compiling with GCC, there is no "break 0x7" instruction
> for zero division due to using the option -mno-check-zero-division, but
> the compiler still generates "break 0x0" instruction for zero division.
>
> Here is a simple example:
>
>   $ cat test.c
>   int div(int a)
>   {
>           return a / 0;
>   }
>   $ gcc -O2 -S test.c -o test.s
>
> GCC generates "break 0" On LoongArch and "ud2" on x86, objtool decodes
> "ud2" as INSN_BUG for x86, so decode "break 0" as INSN_BUG can fix the
> objtool warnings for LoongArch, but this is not the intention.
>
> When decoding "break 0" as INSN_TRAP in the previous commit, the aim is
> to handle "break 0" as a trap. The generated "break 0" for zero division
> by GCC is not proper, it should generate a break instruction with proper
> bug type, so add the GCC option -fno-isolate-erroneous-paths-dereference
> to avoid generating the unexpected "break 0" instruction for now.
You said that this patch make performance increase a little. But this
is strange, because -isolate-erroneous-paths-dereference rather than
-no-isolate-erroneous-paths-dereference is considered as an
optimization.

Huacai

>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/r/202509200413.7uihAxJ5-lkp@intel.com/
> Fixes: baad7830ee9a ("objtool/LoongArch: Mark types based on break immediate code")
> Suggested-by: WANG Rui <wangrui@...ngson.cn>
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
> ---
>  arch/loongarch/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> index ae419e32f22e..f2a585b4a937 100644
> --- a/arch/loongarch/Makefile
> +++ b/arch/loongarch/Makefile
> @@ -129,7 +129,7 @@ KBUILD_RUSTFLAGS_KERNEL             += -Crelocation-model=pie
>  LDFLAGS_vmlinux                        += -static -pie --no-dynamic-linker -z notext $(call ld-option, --apply-dynamic-relocs)
>  endif
>
> -cflags-y += $(call cc-option, -mno-check-zero-division)
> +cflags-y += $(call cc-option, -mno-check-zero-division -fno-isolate-erroneous-paths-dereference)
>
>  ifndef CONFIG_KASAN
>  cflags-y += -fno-builtin-memcpy -fno-builtin-memmove -fno-builtin-memset
> --
> 2.42.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ