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: <74ffc2c05475c6af391b87a06df477ae390cc45c.camel@xry111.site>
Date:   Mon, 06 Feb 2023 21:30:55 +0800
From:   Xi Ruoyao <xry111@...111.site>
To:     Jianmin Lv <lvjianmin@...ngson.cn>,
        WANG Xuerui <kernel@...0n.name>,
        Huacai Chen <chenhuacai@...ngson.cn>,
        Arnd Bergmann <arnd@...db.de>,
        Huacai Chen <chenhuacai@...nel.org>
Cc:     loongarch@...ts.linux.dev, linux-arch@...r.kernel.org,
        Xuefeng Li <lixuefeng@...ngson.cn>,
        Guo Ren <guoren@...nel.org>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LoongArch: Make -mstrict-align be configurable

On Mon, 2023-02-06 at 21:13 +0800, Jianmin Lv wrote:
> > (1) Is the difference contributed by a bad code generation of GCC?  If
> > true, it's better to improve GCC before someone starts to build a distro
> > for LA264 as it would benefit the user space as well.
> > 
> AFAIK, GCC builds to produce unaligned-access-enabled target binary by
> default (without -mstrict-align) for improving user space performance 
> (small size and runtime high performance), which is also based the fact 
> that the vast majority of LoongArch CPUs support unaligned-access.

I mean: if someone starts to build a distro for a less-capable LoongArch
processor, (s)he will need an entire user space compiled with -mstrict-
align.  So it would be better to start preparation now.

And it's likely (s)he will either submit a GCC patch to make GCC
enable/disable -mstrict-align based on the -march= (--with-arch at
configure time) value, or hack GCC to enable -mstrict-align by default
for the distro.  So I think we'll also need:

> +ifdef CONFIG_ARCH_STRICT_ALIGN may enable strict align by default.
>  # Don't emit unaligned accesses.
>  # Not all LoongArch cores support unaligned access, and as kernel we can't
>  # rely on others to provide emulation for these accesses.
>  KBUILD_CFLAGS += $(call cc-option,-mstrict-align)
  +else
  +# Distros designed for running on both kind of processors may disable
  +# strict align by default, but the user may want a no-strict-align 
  +# kernel for his/her specific hardware.
   KBUILD_CFLAGS += $(call cc-option,-mno-strict-align)
> +endif

-- 
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ