2018-10-12 07:47:51

by Abdul Haleem

[permalink] [raw]
Subject: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80

Greeting's

Today's linux-next fails to boot on powerpc bare-metal with this error

POWER8 performance monitor hardware support registered
rcu: Hierarchical SRCU implementation.
smp: Bringing up secondary CPUs ...
Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1
Call Trace:
[c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
[c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
[c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
[c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
[c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
[c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
[c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
[c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
[c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
Rebooting in 10 seconds..

Machine: Power 8 bare-metal
kernel version: 4.19.0-rc7-next-20181010
gcc version: 4.8.5 20150623
config attach

--
Regard's

Abdul Haleem
IBM Linux Technology Centre





2018-10-12 07:49:22

by Abdul Haleem

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80

On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
> Greeting's
>
> Today's linux-next fails to boot on powerpc bare-metal with this error
>
> POWER8 performance monitor hardware support registered
> rcu: Hierarchical SRCU implementation.
> smp: Bringing up secondary CPUs ...
> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80
> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1
> Call Trace:
> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
> Rebooting in 10 seconds..
>
> Machine: Power 8 bare-metal
> kernel version: 4.19.0-rc7-next-20181010
> gcc version: 4.8.5 20150623
> config attach

Attaching the kernel config file

--
Regard's

Abdul Haleem
IBM Linux Technology Centre



Attachments:
Hab-NV-config_with_NVMe (89.66 kB)

2018-10-12 08:09:16

by Christophe Leroy

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80



Le 12/10/2018 à 09:48, Abdul Haleem a écrit :
> On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
>> Greeting's
>>
>> Today's linux-next fails to boot on powerpc bare-metal with this error
>>
>> POWER8 performance monitor hardware support registered
>> rcu: Hierarchical SRCU implementation.
>> smp: Bringing up secondary CPUs ...
>> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80
>> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1
>> Call Trace:
>> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
>> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
>> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
>> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
>> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
>> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
>> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
>> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
>> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
>> Rebooting in 10 seconds..
>>
>> Machine: Power 8 bare-metal
>> kernel version: 4.19.0-rc7-next-20181010
>> gcc version: 4.8.5 20150623
>> config attach
>
> Attaching the kernel config file
>

# Linux/powerpc 4.11.0-rc4 Kernel Configuration

This is not the correct config file. Can you send the .config ?

Christophe

2018-10-12 09:03:54

by Aneesh Kumar K.V

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80

On 10/12/18 1:38 PM, Christophe LEROY wrote:
>
>
> Le 12/10/2018 à 09:48, Abdul Haleem a écrit :
>> On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
>>> Greeting's
>>>
>>> Today's linux-next fails to boot on powerpc bare-metal with this error
>>>
>>> POWER8 performance monitor hardware support registered
>>> rcu: Hierarchical SRCU implementation.
>>> smp: Bringing up secondary CPUs ...
>>> Kernel panic - not syncing: stack-protector: Kernel stack is
>>> corrupted in: __schedule+0x978/0xa80
>>> CPU: 1 PID: 0 Comm: swapper/1 Not tainted
>>> 4.19.0-rc7-next-20181010-autotest-autotest #1
>>> Call Trace:
>>> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
>>> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
>>> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
>>> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
>>> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
>>> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
>>> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
>>> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
>>> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
>>> Rebooting in 10 seconds..
>>>
>>> Machine: Power 8 bare-metal
>>> kernel version: 4.19.0-rc7-next-20181010
>>> gcc version: 4.8.5 20150623
>>> config attach
>>
>> Attaching the kernel config file
>>
>
> # Linux/powerpc 4.11.0-rc4 Kernel Configuration
>
> This is not the correct config file. Can you send the .config ?
>
> Christophe

modified kernel/sched/idle.c
@@ -352,7 +352,6 @@ void cpu_startup_entry(enum cpuhp_state state)
* make this generic (ARM and SH have never invoked the canary
* init for the non boot CPUs!). Will be fixed in 3.11
*/
-#ifdef CONFIG_X86
/*
* If we're the non-boot CPU, nothing set the stack canary up
* for us. The boot CPU already has it initialized but no harm
@@ -361,7 +360,6 @@ void cpu_startup_entry(enum cpuhp_state state)
* canaries already on the stack wont ever trigger).
*/
boot_init_stack_canary();
-#endif
arch_cpu_idle_prepare();
cpuhp_online_idle(state);
while (1)


This fixes it for me. But we may have to look at the other arch details
mentioned there.

-aneesh

2018-10-12 09:21:35

by Christophe Leroy

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80



Le 12/10/2018 à 11:02, Aneesh Kumar K.V a écrit :
> On 10/12/18 1:38 PM, Christophe LEROY wrote:
>>
>>
>> Le 12/10/2018 à 09:48, Abdul Haleem a écrit :
>>> On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
>>>> Greeting's
>>>>
>>>> Today's linux-next fails to boot on powerpc bare-metal with this error
>>>>
>>>> POWER8 performance monitor hardware support registered
>>>> rcu: Hierarchical SRCU implementation.
>>>> smp: Bringing up secondary CPUs ...
>>>> Kernel panic - not syncing: stack-protector: Kernel stack is
>>>> corrupted in: __schedule+0x978/0xa80
>>>> CPU: 1 PID: 0 Comm: swapper/1 Not tainted
>>>> 4.19.0-rc7-next-20181010-autotest-autotest #1
>>>> Call Trace:
>>>> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
>>>> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
>>>> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
>>>> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
>>>> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
>>>> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
>>>> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
>>>> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
>>>> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
>>>> Rebooting in 10 seconds..
>>>>
>>>> Machine: Power 8 bare-metal
>>>> kernel version: 4.19.0-rc7-next-20181010
>>>> gcc version: 4.8.5 20150623
>>>> config attach
>>>
>>> Attaching the kernel config file
>>>
>>
>> # Linux/powerpc 4.11.0-rc4 Kernel Configuration
>>
>> This is not the correct config file. Can you send the .config ?
>>
>> Christophe
>
> modified   kernel/sched/idle.c
> @@ -352,7 +352,6 @@ void cpu_startup_entry(enum cpuhp_state state)
>       * make this generic (ARM and SH have never invoked the canary
>       * init for the non boot CPUs!). Will be fixed in 3.11
>       */
> -#ifdef CONFIG_X86
>      /*
>       * If we're the non-boot CPU, nothing set the stack canary up
>       * for us. The boot CPU already has it initialized but no harm
> @@ -361,7 +360,6 @@ void cpu_startup_entry(enum cpuhp_state state)
>       * canaries already on the stack wont ever trigger).
>       */
>      boot_init_stack_canary();
> -#endif
>      arch_cpu_idle_prepare();
>      cpuhp_online_idle(state);
>      while (1)
>
>
> This fixes it for me. But we may have to look at the other arch details
> mentioned there.

Otherwise, we can call boot_init_stack_canary() from start_secondary()
before calling cpu_startup_entry() can't we ?

Christophe

2018-10-12 10:32:47

by Abdul Haleem

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80

On Fri, 2018-10-12 at 10:08 +0200, Christophe LEROY wrote:
>
> Le 12/10/2018 à 09:48, Abdul Haleem a écrit :
> > On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
> >> Greeting's
> >>
> >> Today's linux-next fails to boot on powerpc bare-metal with this error
> >>
> >> POWER8 performance monitor hardware support registered
> >> rcu: Hierarchical SRCU implementation.
> >> smp: Bringing up secondary CPUs ...
> >> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80
> >> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1
> >> Call Trace:
> >> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
> >> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
> >> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
> >> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
> >> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
> >> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
> >> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
> >> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
> >> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
> >> Rebooting in 10 seconds..
> >>
> >> Machine: Power 8 bare-metal
> >> kernel version: 4.19.0-rc7-next-20181010
> >> gcc version: 4.8.5 20150623
> >> config attach
> >
> > Attaching the kernel config file
> >
>
> # Linux/powerpc 4.11.0-rc4 Kernel Configuration
>
> This is not the correct config file. Can you send the .config ?

CONFIG_HAVE_STACKPROTECTOR=y
CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
CONFIG_STACKPROTECTOR=y
CONFIG_STACKPROTECTOR_STRONG=y

ah yes, I have attached the correct config now.



--
Regard's

Abdul Haleem
IBM Linux Technology Centre



Attachments:
dotconfig (92.16 kB)

2018-10-12 10:38:53

by Christophe Leroy

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80



Le 12/10/2018 à 12:31, Abdul Haleem a écrit :
> On Fri, 2018-10-12 at 10:08 +0200, Christophe LEROY wrote:
>>
>> Le 12/10/2018 à 09:48, Abdul Haleem a écrit :
>>> On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
>>>> Greeting's
>>>>
>>>> Today's linux-next fails to boot on powerpc bare-metal with this error
>>>>
>>>> POWER8 performance monitor hardware support registered
>>>> rcu: Hierarchical SRCU implementation.
>>>> smp: Bringing up secondary CPUs ...
>>>> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80
>>>> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1
>>>> Call Trace:
>>>> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
>>>> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
>>>> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
>>>> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
>>>> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
>>>> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
>>>> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
>>>> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
>>>> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
>>>> Rebooting in 10 seconds..
>>>>
>>>> Machine: Power 8 bare-metal
>>>> kernel version: 4.19.0-rc7-next-20181010
>>>> gcc version: 4.8.5 20150623
>>>> config attach
>>>
>>> Attaching the kernel config file
>>>
>>
>> # Linux/powerpc 4.11.0-rc4 Kernel Configuration
>>
>> This is not the correct config file. Can you send the .config ?
>
> CONFIG_HAVE_STACKPROTECTOR=y
> CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
> CONFIG_STACKPROTECTOR=y
> CONFIG_STACKPROTECTOR_STRONG=y
>
> ah yes, I have attached the correct config now.

Ok,

Could you please try and add a call to function boot_init_stack_canary()
in function start_secondary() in arch/powerpc/kernel/smp.c just before
the call to cpu_startup_entry() ?

Thanks
Christophe

2018-10-12 12:08:42

by Christophe Leroy

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80



Le 12/10/2018 à 11:02, Aneesh Kumar K.V a écrit :
> On 10/12/18 1:38 PM, Christophe LEROY wrote:
>>
>>
>> Le 12/10/2018 à 09:48, Abdul Haleem a écrit :
>>> On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
>>>> Greeting's
>>>>
>>>> Today's linux-next fails to boot on powerpc bare-metal with this error
>>>>
>>>> POWER8 performance monitor hardware support registered
>>>> rcu: Hierarchical SRCU implementation.
>>>> smp: Bringing up secondary CPUs ...
>>>> Kernel panic - not syncing: stack-protector: Kernel stack is
>>>> corrupted in: __schedule+0x978/0xa80
>>>> CPU: 1 PID: 0 Comm: swapper/1 Not tainted
>>>> 4.19.0-rc7-next-20181010-autotest-autotest #1
>>>> Call Trace:
>>>> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
>>>> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
>>>> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
>>>> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
>>>> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
>>>> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
>>>> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
>>>> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
>>>> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
>>>> Rebooting in 10 seconds..
>>>>
>>>> Machine: Power 8 bare-metal
>>>> kernel version: 4.19.0-rc7-next-20181010
>>>> gcc version: 4.8.5 20150623
>>>> config attach
>>>
>>> Attaching the kernel config file
>>>
>>
>> # Linux/powerpc 4.11.0-rc4 Kernel Configuration
>>
>> This is not the correct config file. Can you send the .config ?
>>
>> Christophe
>
> modified   kernel/sched/idle.c
> @@ -352,7 +352,6 @@ void cpu_startup_entry(enum cpuhp_state state)
>       * make this generic (ARM and SH have never invoked the canary
>       * init for the non boot CPUs!). Will be fixed in 3.11
>       */
> -#ifdef CONFIG_X86
>      /*
>       * If we're the non-boot CPU, nothing set the stack canary up
>       * for us. The boot CPU already has it initialized but no harm
> @@ -361,7 +360,6 @@ void cpu_startup_entry(enum cpuhp_state state)
>       * canaries already on the stack wont ever trigger).
>       */
>      boot_init_stack_canary();
> -#endif
>      arch_cpu_idle_prepare();
>      cpuhp_online_idle(state);
>      while (1)
>
>
> This fixes it for me. But we may have to look at the other arch details
> mentioned there.

I think calling again boot_init_stack_canary() will be an issue for all
arches using global canary.

As far as I can see, PPC and X86 are the only arches using non global.

Christophe

2018-10-12 13:24:44

by Abdul Haleem

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80

On Fri, 2018-10-12 at 12:36 +0200, Christophe LEROY wrote:
>
> Le 12/10/2018 à 12:31, Abdul Haleem a écrit :
> > On Fri, 2018-10-12 at 10:08 +0200, Christophe LEROY wrote:
> >>
> >> Le 12/10/2018 à 09:48, Abdul Haleem a écrit :
> >>> On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
> >>>> Greeting's
> >>>>
> >>>> Today's linux-next fails to boot on powerpc bare-metal with this error
> >>>>
> >>>> POWER8 performance monitor hardware support registered
> >>>> rcu: Hierarchical SRCU implementation.
> >>>> smp: Bringing up secondary CPUs ...
> >>>> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80
> >>>> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1
> >>>> Call Trace:
> >>>> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
> >>>> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
> >>>> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
> >>>> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
> >>>> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
> >>>> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
> >>>> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
> >>>> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
> >>>> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
> >>>> Rebooting in 10 seconds..
> >>>>
> >>>> Machine: Power 8 bare-metal
> >>>> kernel version: 4.19.0-rc7-next-20181010
> >>>> gcc version: 4.8.5 20150623
> >>>> config attach
> >>>
> >>> Attaching the kernel config file
> >>>
> >>
> >> # Linux/powerpc 4.11.0-rc4 Kernel Configuration
> >>
> >> This is not the correct config file. Can you send the .config ?
> >
> > CONFIG_HAVE_STACKPROTECTOR=y
> > CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
> > CONFIG_STACKPROTECTOR=y
> > CONFIG_STACKPROTECTOR_STRONG=y
> >
> > ah yes, I have attached the correct config now.
>
> Ok,
>
> Could you please try and add a call to function boot_init_stack_canary()
> in function start_secondary() in arch/powerpc/kernel/smp.c just before
> the call to cpu_startup_entry() ?

Yes, it works. kernel boots fine with above changes to arch/powerpc/kernel/smp.c

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 61c1fad..6c356e7 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -35,6 +35,7 @@
#include <linux/profile.h>
#include <linux/processor.h>

+#include <linux/stackprotector.h>
#include <asm/ptrace.h>
#include <linux/atomic.h>
#include <asm/irq.h>
@@ -1088,6 +1089,8 @@ void start_secondary(void *unused)
/* We can enable ftrace for secondary cpus now */
this_cpu_enable_ftrace();

+ boot_init_stack_canary();
+
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);

BUG();


Attaching the boot logs 4.19.0-rc7-next-20181011 kernel

--
Regard's

Abdul Haleem
IBM Linux Technology Centre



Attachments:
bootlogs.txt (58.73 kB)

2018-10-13 09:48:17

by Christophe Leroy

[permalink] [raw]
Subject: Re: [BUG][linux-next][ppc] kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80



Le 12/10/2018 à 15:23, Abdul Haleem a écrit :
> On Fri, 2018-10-12 at 12:36 +0200, Christophe LEROY wrote:
>>
>> Le 12/10/2018 à 12:31, Abdul Haleem a écrit :
>>> On Fri, 2018-10-12 at 10:08 +0200, Christophe LEROY wrote:
>>>>
>>>> Le 12/10/2018 à 09:48, Abdul Haleem a écrit :
>>>>> On Fri, 2018-10-12 at 13:15 +0530, Abdul Haleem wrote:
>>>>>> Greeting's
>>>>>>
>>>>>> Today's linux-next fails to boot on powerpc bare-metal with this error
>>>>>>
>>>>>> POWER8 performance monitor hardware support registered
>>>>>> rcu: Hierarchical SRCU implementation.
>>>>>> smp: Bringing up secondary CPUs ...
>>>>>> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80
>>>>>> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1
>>>>>> Call Trace:
>>>>>> [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable)
>>>>>> [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308
>>>>>> [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30
>>>>>> [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80
>>>>>> [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60
>>>>>> [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0
>>>>>> [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50
>>>>>> [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520
>>>>>> [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14
>>>>>> Rebooting in 10 seconds..
>>>>>>
>>>>>> Machine: Power 8 bare-metal
>>>>>> kernel version: 4.19.0-rc7-next-20181010
>>>>>> gcc version: 4.8.5 20150623
>>>>>> config attach
>>>>>
>>>>> Attaching the kernel config file
>>>>>
>>>>
>>>> # Linux/powerpc 4.11.0-rc4 Kernel Configuration
>>>>
>>>> This is not the correct config file. Can you send the .config ?
>>>
>>> CONFIG_HAVE_STACKPROTECTOR=y
>>> CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
>>> CONFIG_STACKPROTECTOR=y
>>> CONFIG_STACKPROTECTOR_STRONG=y
>>>
>>> ah yes, I have attached the correct config now.
>>
>> Ok,
>>
>> Could you please try and add a call to function boot_init_stack_canary()
>> in function start_secondary() in arch/powerpc/kernel/smp.c just before
>> the call to cpu_startup_entry() ?
>
> Yes, it works. kernel boots fine with above changes to arch/powerpc/kernel/smp.c
>

Thanks,

Could you please test the patch I just sent ?
I that patch, I initialises the stack canary when preparing the idle
tasks rather than doing it at its startup.

Christophe