[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1293111851-7175-2-git-send-email-filippo.arcidiacono@st.com>
Date: Thu, 23 Dec 2010 14:44:11 +0100
From: Filippo ARCIDIACONO <filippo.arcidiacono@...com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: "linux-sh@...r.kernel.org" <linux-sh@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"nicolas.pitre@...aro.org" <nicolas.pitre@...aro.org>,
"vapier@...too.org" <vapier@...too.org>,
Carmelo AMOROSO <carmelo.amoroso@...com>,
Filippo ARCIDIACONO <filippo.arcidiacono@...com>
Subject: [PATCH 2/2] sh: stackprotector: change the canary value per task
The variable __stack_chk_guard can be updated with the canary
value stored in the task struct whenever a task switch occurs.
Because the __stack_chk_guard is global, this cannot work on SMP,
where the initial canary is always used.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@...com>
Reviewed-by: Carmelo Amoroso <carmelo.amoroso@...com>
---
arch/sh/kernel/process_32.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 762a139..e98a981 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -21,6 +21,7 @@
#include <linux/fs.h>
#include <linux/ftrace.h>
#include <linux/hw_breakpoint.h>
+#include <linux/stackprotector.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/system.h>
@@ -221,6 +222,10 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
{
struct thread_struct *next_t = &next->thread;
+#if defined CONFIG_CC_STACKPROTECTOR && !defined CONFIG_SMP
+ __stack_chk_guard = next->stack_canary;
+#endif
+
unlazy_fpu(prev, task_pt_regs(prev));
/* we're going to use this soon, after a few expensive things */
--
1.5.5.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists