Skip to contentSkip to conversation

x86: remove redundant stack canary initialization

PATCH New Jacob Pan 1 participant 1 message Feb 26, 2010 x86

lore
Share & tools
lore

Jacob Pan

author
#0 lore raw

PATCH 1/1 x86: remove redundant stack canary initialization

After we moved boot_init_stack_canary to the secondary CPU start code, there is no need to do this again in cpu_idle(). Stack canary are initialized earlier than cpu_idle() for both boot and secondary CPUs.

This is suggested by Thomas Gleixner in http://lkml.org/lkml/2010/2/20/14

---
 arch/x86/kernel/process_32.c |   10 ----------
 arch/x86/kernel/process_64.c |   10 ----------
 2 files changed, 0 insertions(+), 20 deletions(-)
arch/x86/kernel/process_32.c +0 -10
index 37ad1e0..6dae5bf 100644
@@ -9,7 +9,6 @@
  * This file handles the architecture-dependent parts of process handling..
  */
 
-#include <linux/stackprotector.h>
 #include <linux/cpu.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
@@ -85,15 +84,6 @@ void cpu_idle(void)
 {
 	int cpu = smp_processor_id();
 
-	/*
-	 * If we're the non-boot CPU, nothing set the stack canary up
-	 * for us.  CPU0 already has it initialized but no harm in
-	 * doing it again.  This is a good place for updating it, as
-	 * we wont ever return from this function (so the invalid
-	 * canaries already on the stack wont ever trigger).
-	 */
-	boot_init_stack_canary();
-
 	current_thread_info()->status |= TS_POLLING;
 
 	/* endless idle loop with no priority at all */
arch/x86/kernel/process_64.c +0 -10
index 41a26a8..68ecec1 100644
@@ -14,7 +14,6 @@
  * This file handles the architecture-dependent parts of process handling..
  */
 
-#include <linux/stackprotector.h>
 #include <linux/cpu.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
@@ -110,15 +109,6 @@ void cpu_idle(void)
 {
 	current_thread_info()->status |= TS_POLLING;
 
-	/*
-	 * If we're the non-boot CPU, nothing set the stack canary up
-	 * for us.  CPU0 already has it initialized but no harm in
-	 * doing it again.  This is a good place for updating it, as
-	 * we wont ever return from this function (so the invalid
-	 * canaries already on the stack wont ever trigger).
-	 */
-	boot_init_stack_canary();
-
 	/* endless idle loop with no priority at all */
 	while (1) {
 		tick_nohz_stop_sched_tick(1);
Signature · 1 line
1.5.6.5