Skip to contentSkip to conversation

use get_random_long for the per-task stack canary

PATCH In review Daniel Micay 5 participants 5 messages May 4, 2017 – May 5, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use get_random_long for the per-task stack canary

The stack canary is an unsigned long and should be fully initialized to random data rather than only 32 bits of random data.

---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/fork.c +1 -1
index 56d85fd81411..ff84ff82f56a 100644
@@ -537,7 +537,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
 	set_task_stack_end_magic(tsk);
 
 #ifdef CONFIG_CC_STACKPROTECTOR
-	tsk->stack_canary = get_random_int();
+	tsk->stack_canary = get_random_long();
 #endif
 
 	/*
Signature · 1 line
2.12.2
#1 lore raw
Quoted 2 lines · Daniel Micay

The stack canary is an unsigned long and should be fully initialized to random data rather than only 32 bits of random data.

that makes sense to me... ack

#4 lore raw

[tip:core/urgent] stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms

In reply to Daniel Micay
stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms
Commit-ID:  5ea30e4e58040cfd6434c2f33dc3ea76e2c15b05
Gitweb:     http://git.kernel.org/tip/5ea30e4e58040cfd6434c2f33dc3ea76e2c15b05
Author:     Daniel Micay <[email protected]>
AuthorDate: Thu, 4 May 2017 09:32:09 -0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 5 May 2017 08:05:13 +0200

stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms

The stack canary is an 'unsigned long' and should be fully initialized to random data rather than only 32 bits of random data.

---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/fork.c +1 -1
index 3a4343c..d681f8f 100644
@@ -536,7 +536,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
 	set_task_stack_end_magic(tsk);
 
 #ifdef CONFIG_CC_STACKPROTECTOR
-	tsk->stack_canary = get_random_int();
+	tsk->stack_canary = get_random_long();
 #endif
 
 	/*