diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2017-12-20 13:16:21 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-12-20 22:15:36 -0600 |
commit | c7f2fab5c7854b11da909e79dd6c835d6ab91754 (patch) | |
tree | 5c16bd1935d557c71a0c68dd0fb6c2ebccb8b845 /core/cpu.c | |
parent | f23d6c626bd657e967347bda872242427b0d9221 (diff) | |
download | skiboot-c7f2fab5c7854b11da909e79dd6c835d6ab91754.zip skiboot-c7f2fab5c7854b11da909e79dd6c835d6ab91754.tar.gz skiboot-c7f2fab5c7854b11da909e79dd6c835d6ab91754.tar.bz2 |
Add support for new gcc 7 parametrized stack protector
This gives us per-cpu guard values as well. For now I just
xor a magic constant with the CPU PIR value.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/cpu.c')
-rw-r--r-- | core/cpu.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -822,6 +822,7 @@ static void init_cpu_thread(struct cpu_thread *t, init_lock(&t->dctl_lock); init_lock(&t->job_lock); list_head_init(&t->job_queue); + t->stack_guard = STACK_CHECK_GUARD_BASE ^ pir; t->state = state; t->pir = pir; #ifdef STACK_CHECK_ENABLED @@ -865,7 +866,8 @@ void __nomcount pre_init_boot_cpu(void) { struct cpu_thread *cpu = this_cpu(); - memset(cpu, 0, sizeof(struct cpu_thread)); + /* We skip the stack guard ! */ + memset(((void *)cpu) + 8, 0, sizeof(struct cpu_thread) - 8); } void init_boot_cpu(void) @@ -943,8 +945,14 @@ void init_boot_cpu(void) top_of_ram += (cpu_max_pir + 1) * STACK_SIZE; /* Clear the CPU structs */ - for (i = 0; i <= cpu_max_pir; i++) + for (i = 0; i <= cpu_max_pir; i++) { + /* boot CPU already cleared and we don't want to clobber + * its stack guard value. + */ + if (i == pir) + continue; memset(&cpu_stacks[i].cpu, 0, sizeof(struct cpu_thread)); + } /* Setup boot CPU state */ boot_cpu = &cpu_stacks[pir].cpu; |