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: <20230410172554.GA178820@dev-arch.thelio-3990X>
Date:   Mon, 10 Apr 2023 10:25:54 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        Tom Rini <trini@...sulko.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nicolas Schier <nicolas@...sle.eu>, Tom Rix <trix@...hat.com>,
        llvm@...ts.linux.dev
Subject: Re: [PATCH] kbuild: add $(CLANG_CFLAGS) to KBUILD_CPPFLAGS

Hi Masahiro,

Nit: s/CLANG_CFLAGS/CLANG_FLAGS/ in the title and a small typo below.

On Sun, Apr 09, 2023 at 11:53:57PM +0900, Masahiro Yamada wrote:
> When preprocessing arch/*/kernel/vmlinux.lds.S, the target triple is
> not passed to $(CPP) because we add it only to KBUILD_{C,A}FLAGS.
> 
> As a result, the linker script is preprocessed with predefined macros
> for the build host instead of the target.
> 
> Assuming you use an x86 build machine, compare the following:
> 
>  $ clang -dM -E -x c /dev/null
>  $ clang -dM -E -x c /dev/null -target aarch64-linux-gnu
> 
> There is no actual problem presumably because our linker scripts do not
> rely on such predefined macros, but it is better to define correct ones.
> 
> Move $(CFLAGS_CFLAGS) to KBUILD_CPPFLAGS, so that all *.c, *.S, *.lds.S
         ^ CLANG_FLAGS
> will be processed with the proper target triple.
> 
> Reported-by: Tom Rini <trini@...sulko.com>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>

We will need to sort out the report from the kbuild test robot before we
can do this. Otherwise, I think this should be fine, although I am
curious if -Wunused-command-line-argument might fire more because there
may be flags are unused while preprocessing. I will run this through my
test matrix once the other report has been addressed to make sure there
is nothing else obviously wrong with this change.

Cheers,
Nathan

> ---
> 
>  scripts/Makefile.clang | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
> index 70b354fa1cb4..93ca059cc3b8 100644
> --- a/scripts/Makefile.clang
> +++ b/scripts/Makefile.clang
> @@ -38,6 +38,5 @@ CLANG_FLAGS	+= -Werror=unknown-warning-option
>  CLANG_FLAGS	+= -Werror=ignored-optimization-argument
>  CLANG_FLAGS	+= -Werror=option-ignored
>  CLANG_FLAGS	+= -Werror=unused-command-line-argument
> -KBUILD_CFLAGS	+= $(CLANG_FLAGS)
> -KBUILD_AFLAGS	+= $(CLANG_FLAGS)
> +KBUILD_CPPFLAGS	+= $(CLANG_FLAGS)
>  export CLANG_FLAGS
> -- 
> 2.37.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ