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: <CAK7LNATM=7b_KReRZ8MqhiLPfP_itaxOW-17zHZpzSn_AOgThw@mail.gmail.com>
Date:   Sun, 15 Apr 2018 18:40:20 +0900
From:   Masahiro Yamada <yamada.masahiro@...ionext.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     linux-kbuild <linux-kbuild@...r.kernel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Sam Ravnborg <sam@...nborg.org>,
        Ulf Magnusson <ulfalizer@...il.com>,
        Nicholas Piggin <npiggin@...il.com>,
        Emese Revfy <re.emese@...il.com>, X86 ML <x86@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 21/30] stack-protector: test compiler capability in
 Kconfig and drop AUTO mode

2018-04-14 1:41 GMT+09:00 Kees Cook <keescook@...omium.org>:
> On Thu, Apr 12, 2018 at 10:06 PM, Masahiro Yamada
> <yamada.masahiro@...ionext.com> wrote:
>> +stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector
>> +stackp-flags-$(CONFIG_CC_STACKPROTECTOR)          := -fstack-protector
>> +stackp-flags-$(CONFIG_CC_STACKPROTECTOR_STRONG)   := -fstack-protector-strong
>> +
>> +KBUILD_CFLAGS += $(stackp-flags-y)
>
> So, technically, this works just fine. I wonder if it has an overly
> confusing result, in that the compiler under normal situations will
> see:
>
> gcc ... -fno-stack-protector -fstack-protector -fstack-protector-strong ...


Kees, you are wrong.

Look at my code closely.

I used := operator instead of +=.

$(stackp-flags-y) contains only one flag at most.



> How about something like this instead:
>
> ifdef CONFIG_CC_STACKPROTECTOR_STRONG
> KBUILD_CFLAGS += -fstack-protector-strong
> else
> ifdef CONFIG_CC_STACKPROTECTOR
> KBUILD_CFLAGS += -fstack-protector
> else
> KBUILD_CFLAGS += -fno-stack-protector
> endif
> endif
>

My code is much cleaner, and working fine.



-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists