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: <CAK7LNAR0e2sA4QMssbMf8B0459_LoB9ykfTmFmFVXOjqBea4-w@mail.gmail.com>
Date:   Sat, 10 Sep 2022 06:06:10 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     Michal Marek <michal.lkml@...kovi.net>,
        Nathan Chancellor <nathan@...nel.org>,
        Tom Rix <trix@...hat.com>,
        Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        clang-built-linux <llvm@...ts.linux.dev>,
        X86 ML <x86@...nel.org>,
        Dmitrii Bundin <dmitrii.bundin.a@...il.com>,
        Fangrui Song <maskray@...gle.com>,
        Alexey Alexandrov <aalexand@...gle.com>,
        Bill Wendling <morbo@...gle.com>,
        Greg Thelen <gthelen@...gle.com>
Subject: Re: [PATCH v3 2/5] Makefile.compiler: Use KBUILD_AFLAGS for as-option

On Wed, Sep 7, 2022 at 1:59 PM Nick Desaulniers <ndesaulniers@...gle.com> wrote:
>
> as-instr uses KBUILD_AFLAGS, but as-option uses KBUILD_CFLAGS.  This can
> cause as-option to fail unexpectedly when CONFIG_WERROR is set, because
> clang will emit -Werror,-Wunused-command-line-argument for various -m
> and -f flags for assembler sources.
>
> Callers of as-option (and as-instr) likely want to be adding flags to
> KBUILD_AFLAGS/aflags-y, not KBUILD_CFLAGS/cflags-y.
>
> Also, change as-option and as-instr to use -x assembler-with-cpp since
> kernel sources are .S files that use the compiler as the driver. And
> then add -Werror as well.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1699
> Suggested-by: Masahiro Yamada <masahiroy@...nel.org>
> Reviewed-by: Nathan Chancellor <nathan@...nel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
> ---



01 and 02, applied to linux-kbuild/fixes.
Thanks.




> Changes v2 -> v1:
> * Add -x assembler-with-cpp -Werror to both as-option and (new)
>   as-instr, as per Masahiro.
> * Add Masahiro's SB tag.
>
> Changes v1 -> v2:
> * Split off changes to arch/x86/boot/compressed/Makefile into parent
>   patch, as per Masahiro.
>
>  scripts/Makefile.compiler | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
> index 94d0d40cddb3..a66638b5f4a5 100644
> --- a/scripts/Makefile.compiler
> +++ b/scripts/Makefile.compiler
> @@ -29,16 +29,16 @@ try-run = $(shell set -e;           \
>         fi)
>
>  # as-option
> -# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
> +# Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
>
>  as-option = $(call try-run,\
> -       $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
> +       $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
>
>  # as-instr
> -# Usage: cflags-y += $(call as-instr,instr,option1,option2)
> +# Usage: aflags-y += $(call as-instr,instr,option1,option2)
>
>  as-instr = $(call try-run,\
> -       printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
> +       printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3))
>
>  # __cc-option
>  # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
> --
> 2.37.2.789.g6183377224-goog
>


-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ