powerpc: Avoid broken GCC __attribute__((optimize))
[ Upstream commit a7223f5bfcaeade4a86d35263493bcda6c940891 ] Commit7053f80d96
("powerpc/64: Prevent stack protection in early boot") introduced a couple of uses of __attribute__((optimize)) with function scope, to disable the stack protector in some early boot code. Unfortunately, and this is documented in the GCC man pages [0], overriding function attributes for optimization is broken, and is only supported for debug scenarios, not for production: the problem appears to be that setting GCC -f flags using this method will cause it to forget about some or all other optimization settings that have been applied. So the only safe way to disable the stack protector is to disable it for the entire source file. [0] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html Fixes:7053f80d96
("powerpc/64: Prevent stack protection in early boot") Signed-off-by: Ard Biesheuvel <ardb@kernel.org> [mpe: Drop one remaining use of __nostackprotector, reported by snowpatch] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201028080433.26799-1-ardb@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
6014c6ed74
commit
b1a0097b82
@@ -283,7 +283,7 @@ void __init record_spr_defaults(void)
|
||||
* device-tree is not accessible via normal means at this point.
|
||||
*/
|
||||
|
||||
void __init __nostackprotector early_setup(unsigned long dt_ptr)
|
||||
void __init early_setup(unsigned long dt_ptr)
|
||||
{
|
||||
static __initdata struct paca_struct boot_paca;
|
||||
|
||||
|
Reference in New Issue
Block a user