[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNATULgbS6mxYJUumnkVZU_1LhQwS0jL=v_=HAjtRiF12yA@mail.gmail.com>
Date: Tue, 10 Apr 2018 12:15:30 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: Kees Cook <keescook@...omium.org>
Cc: linux-kbuild <linux-kbuild@...r.kernel.org>,
Sam Ravnborg <sam@...nborg.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>,
Ulf Magnusson <ulfalizer@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Randy Dunlap <rdunlap@...radead.org>,
"Luis R . Rodriguez" <mcgrof@...nel.org>,
Nicolas Pitre <nico@...aro.org>,
LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v2 11/21] stack-protector: test compiler capability in
Kconfig and drop AUTO mode
2018-04-10 0:04 GMT+09:00 Kees Cook <keescook@...omium.org>:
> On Mon, Apr 9, 2018 at 1:54 AM, Masahiro Yamada
> <yamada.masahiro@...ionext.com> wrote:
>> 2018-03-28 20:18 GMT+09:00 Kees Cook <keescook@...omium.org>:
>>> On Mon, Mar 26, 2018 at 10:29 PM, Masahiro Yamada
>>> <yamada.masahiro@...ionext.com> wrote:
>>>> diff --git a/arch/Kconfig b/arch/Kconfig
>>>> index 8e0d665..b42378d 100644
>>>> --- a/arch/Kconfig
>>>> +++ b/arch/Kconfig
>>>> @@ -535,13 +535,13 @@ config HAVE_CC_STACKPROTECTOR
>>>> bool
>>>> help
>>>> An arch should select this symbol if:
>>>> - - its compiler supports the -fstack-protector option
>>>
>>> Please leave this note: it's still valid. An arch must still have
>>> compiler support for this to be sensible.
>>>
>>
>> No.
>>
>> "its compiler supports the -fstack-protector option"
>> is tested by $(cc-option -fstack-protector)
>>
>> ARCH does not need to know the GCC support level.
>
> That's not correct: if you enable stack protector for a kernel
> architecture that doesn't having it enabled, it's unlikely for the
> resulting kernel to boot. An architecture must handle the changes that
> the compiler introduces when adding -fstack-protector (for example,
> having the stack protector canary value defined, having the failure
> function defined, handling context switches changing canaries, etc).
>
It is still hard to understand this.
When we "its compiler supports the -fstack-protector option",
we have two meanings
[1] the stack protector feature is implemented in GCC source code.
[2] -fstack-protector is recognized as a valid option in the GCC being used.
This can be tested by $(cc-option -fstack-protector)
I guess you were talking about [1], where as I [2].
Is this correct?
Does [2] happen only after [1] happens?
Or, are they independent?
If there is a case where GCC recognizes -fstack-protector,
but not implemented?
For x86, there are cases where the option is recognized but not working.
That's why we have
scripts/gcc-x86_{32,64}-has-stack-protector.sh
Generally, if GCC accepts -fstack-protector as a valid option,
we expect "it is working".
I wonder why we need additional information about the compiler
even after $(cc-option -fstack-protector) succeeds.
This is just a matter of comment.
Can you clarify your problem?
> resulting kernel to boot. An architecture must handle the changes that
> the compiler introduces when adding -fstack-protector (for example,
> having the stack protector canary value defined, having the failure
> function defined, handling context switches changing canaries, etc).
>
All of these are talking about the kernel side implementation.
So, it is included in the following comment I am still keeping.
- it has implemented a stack canary (e.g. __stack_chk_guard)
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists