diff options
| author | Jann Horn <jann@thejh.net> | 2016-10-31 15:04:01 +0100 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-10-14 16:01:53 +0200 |
| commit | 25e99df04b1d41338a2a2ada3941d3ee1dbb4673 (patch) | |
| tree | 3b2fcc3081f380bc815ea04a275049eef82613e7 /kernel/fork.c | |
| parent | bed4c9124a4a0d9a1ec167d2f959289f74e1987d (diff) | |
fork: make whole stack_canary random
On machines with sizeof(unsigned long)==8, this ensures that the more
significant 32 bits of stack_canary are random, too.
stack_canary is defined as unsigned long, all the architectures with stack
protector support already pick the stack_canary of init as a random
unsigned long, and get_random_long() should be as fast as get_random_int(),
so there seems to be no good reason against this.
This should help if someone tries to guess a stack canary with brute force.
(This change has been made in PaX already, with a different RNG.)
Signed-off-by: Jann Horn <jann@thejh.net>
Acked-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'kernel/fork.c')
| -rw-r--r-- | kernel/fork.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 9db86f811..23751af3f 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -354,7 +354,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) *stackend = STACK_END_MAGIC; /* for overflow detection */ #ifdef CONFIG_CC_STACKPROTECTOR - tsk->stack_canary = get_random_int(); + tsk->stack_canary = get_random_long(); #endif /* |
