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] [day] [month] [year] [list]
Date:   Wed, 22 Dec 2021 15:17:12 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Nathan Chancellor <nathan@...nel.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
        "H. Peter Anvin" <hpa@...or.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] x86/boot/compressed: Move CLANG_FLAGS to beginning of
 KBUILD_CFLAGS

On Tue, Dec 21, 2021 at 05:52:45PM -0700, Nathan Chancellor wrote:
> When cross compiling i386_defconfig on an arm64 host with clang, there
> are a few instances of '-Waddress-of-packed-member' and
> '-Wgnu-variable-sized-type-not-at-end' in arch/x86/boot/compressed/,
> which should both be disabled with the cc-disable-warning calls in that
> directory's Makefile, which indicates that cc-disable-warning is failing
> at the point of testing these flags.
> 
> The cc-disable-warning calls fail because at the point that the flags
> are tested, KBUILD_CFLAGS has '-march=i386' without $(CLANG_FLAGS),
> which has the '--target=' flag to tell clang what architecture it is
> targeting. Without the '--target=' flag, the host architecture (arm64)
> is used and i386 is not a valid value for '-march=' in that case. This
> error can be seen by adding some logging to try-run:
> 
> clang-14: error: the clang compiler does not support '-march=i386'
> 
> Invoking the compiler has to succeed prior to calling cc-option or
> cc-disable-warning in order to accurately test whether or not the flag
> is supported; if it doesn't, the requested flag can never be added to
> the compiler flags. Move $(CLANG_FLAGS) to the beginning of KBUILD_FLAGS
> so that any new flags that might be added in the future can be
> accurately tested.
> 
> Fixes: d5cbd80e302d ("x86/boot: Add $(CLANG_FLAGS) to compressed KBUILD_CFLAGS")
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
>  arch/x86/boot/compressed/Makefile | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 431bf7f846c3..169186dba1d7 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -28,7 +28,7 @@ KCOV_INSTRUMENT		:= n
>  targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
>  	vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 vmlinux.bin.zst
>  
> -KBUILD_CFLAGS := -m$(BITS) -O2
> +KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)

I don't mind but this makes the placement of that variable magical so it
needs a comment above it that it cannot be moved around freely and why
that is the case.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ