[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb9b6013-8281-9864-d48f-e23ca651a20d@linux.alibaba.com>
Date: Mon, 27 Sep 2021 22:38:34 +0800
From: Lai Jiangshan <laijs@...ux.alibaba.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Lai Jiangshan <jiangshanlai@...il.com>,
linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Joerg Roedel <jroedel@...e.de>,
Javier Martinez Canillas <javierm@...hat.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Brijesh Singh <brijesh.singh@....com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Arvind Sankar <nivedita@...m.mit.edu>,
Juergen Gross <jgross@...e.com>, Chester Lin <clin@...e.com>
Subject: Re: [PATCH V2 02/41] x86/traps: Remove stack-protector from traps.c
On 2021/9/27 19:01, Borislav Petkov wrote:
> On Mon, Sep 27, 2021 at 06:49:16PM +0800, Lai Jiangshan wrote:
>> Using only "-fno-stack-protector" is enough to disable stack protector with
>> my .config, I'm not so sure about other configuration.
>
> What does the gcc manpage say about it?
>
In gcc's code, all the -f[no-]stack-protector* argument overwrites the
same flag_stack_protect variable, so the last one takes effect.
> fstack-protector
> Common Var(flag_stack_protect, 1) Init(-1) Optimization
> Use propolice as a stack protection method.
>
> fstack-protector-all
> Common RejectNegative Var(flag_stack_protect, 2) Init(-1) Optimization
> Use a stack protection method for every function.
>
> fstack-protector-strong
> Common RejectNegative Var(flag_stack_protect, 3) Init(-1) Optimization
> Use a smart stack protection method for certain functions.
>
> fstack-protector-explicit
> Common RejectNegative Var(flag_stack_protect, 4) Optimization
> Use stack protection method only for functions with the stack_protect attribute.
In linux kernel's scripts/Makefile.lib, CFLAGS_traps.o is the last flags for
gcc invocation, so only "CFLAGS_traps.o += -fno-stack-protector" must be enough.
> _c_flags = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), \
> $(filter-out $(ccflags-remove-y), \
> $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(ccflags-y)) \
> $(CFLAGS_$(target-stem).o))
Powered by blists - more mailing lists