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: <20200419153703.GA41789@ubuntu-s3-xlarge-x86>
Date:   Sun, 19 Apr 2020 08:37:03 -0700
From:   Nathan Chancellor <natechancellor@...il.com>
To:     Sedat Dilek <sedat.dilek@...il.com>
Cc:     Masahiro Yamada <masahiroy@...nel.org>,
        "Steven Rostedt (VMware)" <rostedt@...dmis.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Tejun Heo <tj@...nel.org>, Jessica Yu <jeyu@...nel.org>,
        Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
        "Joel Fernandes (Google)" <joel@...lfernandes.org>,
        Patrick Bellasi <patrick.bellasi@....com>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Dan Williams <dan.j.williams@...el.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH] kbuild: Set CLANG_VERSION only when Clang is used

On Sun, Apr 19, 2020 at 02:36:12PM +0200, Sedat Dilek wrote:
> Do like GCC_VERSION is set when GCC (see CC_IS_GCC) is used.
> 
> Signed-off-by: Sedat Dilek <sedat.dilek@...il.com>
> ---
>  init/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/init/Kconfig b/init/Kconfig
> index 9e22ee8fbd75..c23f9d3d6d6c 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -25,7 +25,7 @@ config CC_IS_CLANG
>  
>  config CLANG_VERSION
>  	int
> -	default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
> +	default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) if CC_IS_CLANG
>  
>  config CC_CAN_LINK
>  	def_bool $(success,$(srctree)/scripts/cc-can-link.sh $(CC))
> -- 
> 2.26.1
> 

I don't understand the motivation behind this. The commit message needs
to be expanded upon or further clarification is needed.

CONFIG_GCC_VERSION is always set, either to 0 if using clang or the
actual version spit out by GCC so the commit message is not entirely
accurate.

It is done in the

    default $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) if CC_IS_GCC
    default 0

way because it relies on the __GNUC__, __GNUC_MINOR__, and
__GNUC_PATCHLEVEL__ preprocessor macros to figure out the verison, which
clang also defines (to 4, 2, and 1 respectively) so it has to be done
this way to avoid confusing clang for GCC.

We can handle this in clang-version.sh so that CONFIG_CLANG_VERSION is
set to zero if CONFIG_CC_IS_GCC is set, just like CONFIG_GCC_VERSION:

if ! ( $compiler --version | grep -q clang) ; then
    echo 0
    exit 1
fi

CONFIG_CLANG_VERSION needs to be defined, otherwise we are breaking the
assumption that I made in commit df3da04880b4 ("mips: Fix unroll macro
when building with Clang").

With your patch and GCC 9.3.0 building malta_defconfig:

arch/mips/include/asm/r4kcache.h: In function 'blast_scache64_node':
arch/mips/include/asm/unroll.h:29:9: error: 'CONFIG_CLANG_VERSION' undeclared (first use in this function); did you mean 'CONFIG_LD_VERSION'?
   29 |         CONFIG_CLANG_VERSION >= 80000) &&  \
      |         ^~~~~~~~~~~~~~~~~~~~
/home/nathan/src/linux/include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
  330 |   if (!(condition))     \
      |         ^~~~~~~~~
/home/nathan/src/linux/include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
  350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |  ^~~~~~~~~~~~~~~~~~~
/home/nathan/src/linux/include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
/home/nathan/src/linux/include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
   50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
      |  ^~~~~~~~~~~~~~~~
/home/nathan/src/linux/arch/mips/include/asm/unroll.h:28:2: note: in expansion of macro 'BUILD_BUG_ON'
   28 |  BUILD_BUG_ON((CONFIG_GCC_VERSION >= 40700 ||  \
      |  ^~~~~~~~~~~~
/home/nathan/src/linux/arch/mips/include/asm/r4kcache.h:203:2: note: in expansion of macro 'unroll'
  203 |  unroll(times, _cache_op, insn, op, (addr) + (i++ * (lsize))); \
      |  ^~~~~~
/home/nathan/src/linux/arch/mips/include/asm/r4kcache.h:370:4: note: in expansion of macro 'cache_unroll'
  370 |    cache_unroll(32, kernel_cache, indexop,  \
      |    ^~~~~~~~~~~~
/home/nathan/src/linux/arch/mips/include/asm/r4kcache.h:376:1: note: in expansion of macro '__BUILD_BLAST_CACHE_NODE'
  376 | __BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
      | ^~~~~~~~~~~~~~~~~~~~~~~~

Cheers,
Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ