Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1512654
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] fork: make whole stack_canary random |
| Date | 2016-10-31 17:10 +0100 |
| Message-ID | <synjQ-4H2-31@gated-at.bofh.it> (permalink) |
| References | <sylrH-3r1-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Oct 31, 2016 at 7:04 AM, Jann Horn <jann@thejh.net> wrote: > 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> (A separate change might be to make sure that the leading byte is zeroed. Entropy of the value, I think, is less important than blocking canary exposures from unbounded str* functions. Brute forcing kernel stack canaries isn't like it bruting them in userspace...) -Kees > --- > kernel/fork.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/fork.c b/kernel/fork.c > index 623259fc794d..d577e2c5d14f 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -518,7 +518,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 > > /* > -- > 2.1.4 > -- Kees Cook Nexus Security
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] fork: make whole stack_canary random Jann Horn <jann@thejh.net> - 2016-10-31 15:10 +0100
Re: [PATCH] fork: make whole stack_canary random Kees Cook <keescook@chromium.org> - 2016-10-31 17:10 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Jann Horn <jann@thejh.net> - 2016-10-31 17:30 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Florian Weimer <fw@deneb.enyo.de> - 2016-10-31 21:50 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Jann Horn <jann@thejh.net> - 2016-10-31 22:00 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Daniel Micay <danielmicay@gmail.com> - 2016-10-31 22:00 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Daniel Micay <danielmicay@gmail.com> - 2016-10-31 22:10 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Florian Weimer <fw@deneb.enyo.de> - 2016-10-31 22:20 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Jann Horn <jann@thejh.net> - 2016-10-31 22:30 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Florian Weimer <fw@deneb.enyo.de> - 2016-10-31 22:30 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Daniel Micay <danielmicay@gmail.com> - 2016-10-31 22:30 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Daniel Micay <danielmicay@gmail.com> - 2016-10-31 22:30 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Florian Weimer <fw@deneb.enyo.de> - 2016-10-31 22:40 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Daniel Micay <danielmicay@gmail.com> - 2016-10-31 23:10 +0100
Re: [kernel-hardening] Re: [PATCH] fork: make whole stack_canary random Florian Weimer <fw@deneb.enyo.de> - 2016-10-31 23:20 +0100
csiph-web