[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jKfeQm6ygxN7yvXs3nhLbi0EK+LbQhuEc0mKgSN-BZHZw@mail.gmail.com>
Date: Thu, 19 Oct 2017 10:18:01 -0700
From: Kees Cook <keescook@...omium.org>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: "Tobin C. Harding" <me@...in.cc>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
"kernel-hardening@...ts.openwall.com"
<kernel-hardening@...ts.openwall.com>,
"Theodore Ts'o" <tytso@....edu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Tycho Andersen <tycho@...ker.com>,
"Roberts, William C" <william.c.roberts@...el.com>,
Tejun Heo <tj@...nel.org>,
Jordan Glover <Golden_Miller83@...tonmail.ch>,
Greg KH <gregkh@...uxfoundation.org>,
Petr Mladek <pmladek@...e.com>, Joe Perches <joe@...ches.com>,
Ian Campbell <ijc@...lion.org.uk>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <wilal.deacon@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Chris Fries <cfries@...gle.com>,
Dave Weinstein <olorin@...gle.com>,
Daniel Micay <danielmicay@...il.com>,
Djalal Harouni <tixxdz@...il.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5] printk: hash addresses printed with %p
On Wed, Oct 18, 2017 at 10:49 PM, Jason A. Donenfeld <Jason@...c4.com> wrote:
> static void fill_random_ptr_key(struct random_ready_callback *rdy)
> {
> get_random_bytes(&ptr_secret, sizeof(ptr_secret));
> static_branch_disable(&no_ptr_secret);
> }
>
> static struct random_ready_callback random_ready = {
> .func = fill_random_ptr_key
> };
>
> static int __init initialize_ptr_random(void)
> {
> int ret = add_random_ready_callback(&random_ready);
>
> if (!ret)
> return 0;
> else if (ret == -EALREADY) {
> fill_random_ptr_key(&random_ready);
> return 0;
> }
>
> return ret;
> }
> early_initcall(initialize_ptr_random);
Tangent: why is the random_ready API designed with -EALREADY? Couldn't
add_random_ready_callback() just perform the call itself and avoid
needing all the callers to check for -EALREADY?
-Kees
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists