Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 21 Feb 2018 21:57:03 +0900
From: Masahiro Yamada <>
To: Arnd Bergmann <>
Cc: Rich Felker <>,
        Kernel Hardening <>,
        X86 ML <>, Paul Mackerras <>,
        "H. Peter Anvin" <>,
        sparclinux <>,
        Sam Ravnborg <>,
        Yoshinori Sato <>,
        Jonathan Corbet <>, Richard Weinberger <>,
        Linux-sh list <>,
        Ingo Molnar <>, Emese Revfy <>,
        Kees Cook <>,
        uml-devel <>,
        Linux Kbuild mailing list <>,
        Peter Oberparleiter <>,
        Jeff Dike <>,
        linuxppc-dev <>,,
        Thomas Gleixner <>,
        Michal Marek <>,
        Ulf Magnusson <>,
        Greg Kroah-Hartman <>,
        Randy Dunlap <>,
        "open list:DOCUMENTATION" <>,
        Linux Kernel Mailing List <>,
        Linus Torvalds <>,
        "David S. Miller" <>
Subject: Re: [PATCH 00/23] kconfig: move compiler capability tests to Kconfig

2018-02-21 19:52 GMT+09:00 Arnd Bergmann <>:
> On Wed, Feb 21, 2018 at 11:20 AM, Masahiro Yamada
> <> wrote:
>> 2018-02-21 18:56 GMT+09:00 Arnd Bergmann <>:
>>> On Wed, Feb 21, 2018 at 8:38 AM, Masahiro Yamada
>>> <> wrote:
>>>> 2018-02-20 0:18 GMT+09:00 Ulf Magnusson <>:
>> Let me clarify my concern.
>> When we test the compiler flag, is there a case
>> where a particular flag depends on -m{32,64} ?
>> For example, is there a compiler that supports -fstack-protector
>> for 64bit mode, but unsupports it for 32bit mode?
>>   $(cc-option -m32)                     ->  y
>>   $(cc-option -m64)                     ->  y
>>   $(cc-option -fstack-protector)        ->  y
>>   $(cc-option -m32 -fstack-protector)   ->  n
>>   $(cc-option -m64 -fstack-protector)   ->  y
>> I guess this is unlikely to happen,
>> but I am not whether it is zero possibility.
>> If this could happen,
>> $(cc-option ) must be evaluated together with
>> correct bi-arch option (either -m32 or -m64).
>> Currently, -m32/-m64 is specified in Makefile,
>> but we are moving compiler tests to Kconfig
>> and, CONFIG_64BIT can be dynamically toggled in Kconfig.
> I don't think it can happen for this particular combination (stack protector
> and word size), but I'm sure we'll eventually run into options that
> need to be tested in combination. For the current CFLAGS_KERNEL
> setting, we definitely have the case of needing the variables to be
> evaluated in a specific order.

I was thinking of how we can handle complex cases
in the current approach.

(Case 1)

Compiler flag -foo and -bar interacts, so
we also need to check the combination of the two.

config CC_HAS_FOO
        def_bool $(cc-option -foo)

config CC_HAS_BAR
        def_bool $(cc-option -bar)

        def_bool $(cc-option -foo -bar)

(Case 2)
Compiler flag -foo is sensitive to word-size.
So, we need to test this option together with -m32/-m64.
User can toggle CONFIG_64BIT, like i386/x86_64.

config CC_NEEDS_M64
          def_bool $(cc-option -m64) && 64BIT

config CC_NEEDS_M32
          def_bool $(cc-option -m32) && !64BIT

config CC_HAS_FOO
         default $(cc-option -m64 -foo) if CC_NEEDS_M64
         default $(cc-option -m32 -foo) if CC_NEEDS_M32
         default $(cc-option -foo)

(Case 3)
Compiler flag -foo is sensitive to endian-ness.

          def_bool $(cc-option -mbig-endian) && CPU_BIG_ENDIAN

          def_bool $(cc-option -mlittle-endian) && CPU_LITTLE_ENDIAN

config CC_HAS_FOO
         default $(cc-option -mbig-endian -foo) if CC_NEEDS_BIG_ENDIAN
         default $(cc-option -mlittle-endian -foo) if CC_NEEDS_LITTLE_ENDIAN
         default $(cc-option -foo)

Hmm, I think I can implement those somehow.
But, I hope we do not have many instances like this...

If you know more naive cases, please share your knowledge.


Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.