aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-02-14 02:48:23 -0500
committerThomas Gleixner <tglx@linutronix.de>2008-05-26 10:15:31 -0400
commite00320875d0cc5f8099a7227b2f25fbb3231268d (patch)
tree2a2a35649bcb07a071efa90f967eeb3702b8187a /include/linux/sched.h
parent4c7f8900f1d8a0e464e7092f132a7e93f7c20f2f (diff)
x86: fix stackprotector canary updates during context switches
fix a bug noticed and fixed by pageexec@freemail.hu. if built with -fstack-protector-all then we'll have canary checks built into the __switch_to() function. That does not work well with the canary-switching code there: while we already use the %rsp of the new task, we still call __switch_to() whith the previous task's canary value in the PDA, hence the __switch_to() ssp prologue instructions will store the previous canary. Then we update the PDA and upon return from __switch_to() the canary check triggers and we panic. so update the canary after we have called __switch_to(), where we are at the same stackframe level as the last stackframe of the next (and now freshly current) task. Note: this means that we call __switch_to() [and its sub-functions] still with the old canary, but that is not a problem, both the previous and the next task has a high-quality canary. The only (mostly academic) disadvantage is that the canary of one task may leak onto the stack of another task, increasing the risk of information leaks, were an attacker able to read the stack of specific tasks (but not that of others). To solve this we'll have to reorganize the way we switch tasks, and move the PDA setting into the switch_to() assembly code. That will happen in another patch. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5395a6176f4b..d6a515158783 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1096,10 +1096,9 @@ struct task_struct {
1096 pid_t pid; 1096 pid_t pid;
1097 pid_t tgid; 1097 pid_t tgid;
1098 1098
1099#ifdef CONFIG_CC_STACKPROTECTOR
1100 /* Canary value for the -fstack-protector gcc feature */ 1099 /* Canary value for the -fstack-protector gcc feature */
1101 unsigned long stack_canary; 1100 unsigned long stack_canary;
1102#endif 1101
1103 /* 1102 /*
1104 * pointers to (original) parent process, youngest child, younger sibling, 1103 * pointers to (original) parent process, youngest child, younger sibling,
1105 * older sibling, respectively. (p->father can be replaced with 1104 * older sibling, respectively. (p->father can be replaced with