From: Kees Cook <keescook@chromium.org>
To: david.keisarschm@mail.huji.ac.il
Cc: linux-kernel@vger.kernel.org,
Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Jason@zx2c4.com, aksecurity@gmail.com, ilay.bahat1@gmail.com
Subject: Re: [PATCH v3 3/3] Replace invocation of weak PRNG in arch/x86/mm/kaslr.c
Date: Fri, 6 Jan 2023 11:23:18 -0800 [thread overview]
Message-ID: <202301061118.836BF431F@keescook> (raw)
In-Reply-To: <a6b5907e2a1249f109c9112652cbbec244e00fba.1671277662.git.david.keisarschm@mail.huji.ac.il>
On Sun, Dec 18, 2022 at 08:19:00PM +0200, david.keisarschm@mail.huji.ac.il wrote:
> From: David Keisar Schmidt <david.keisarschm@mail.huji.ac.il>
>
> This third series add some changes to the commit messages,
> and also replaces get_random_u32 with get_random_u32_below,
> in a case a modulo operation is done on the result.
>
> The memory randomization of the virtual address space of kernel memory regions
> (physical memory mapping, vmalloc & vmemmap) inside arch/x86/mm/kaslr.c
> is based on the function prandom_bytes_state which uses the prandom_u32 PRNG.
>
> However, this PRNG turned out to be weak, as noted in commit c51f8f88d705
> To fix it, we have changed the invocation of prandom_bytes_state to get_random_bytes.
>
> Unlike get_random_bytes which maintains its own state, prandom_bytes state needs to be seeded,
> thus, we have omitted the call to the seeding function, since it is not needed anymore.
I'd really rather not do this. prandom is being seeded from "true" RNG,
and it allows for the KASLR to be hand-seeded for a repeatable layout
for doing debugging and performance analysis (for the coming FG-KASLR).
AIUI, prandom is weak due to its shared state (which KASLR's use doesn't
have) and its predictability over time (but KASLR uses it only at
boot-time). And being able to recover the outputs would mean KASLR was
already broken, so there isn't anything that becomes MORE exposed.
If there is some other weakness, then sure, we can re-evaluate it, but
for now I'd rather leave this as-is.
-Kees
--
Kees Cook
prev parent reply other threads:[~2023-01-06 19:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-18 18:18 [PATCH v3 0/3] Replace invocations of prandom_u32() with get_random_u32() david.keisarschm
2022-12-18 18:18 ` [PATCH v3 1/3] Replace invocation of weak PRNG in mm/slab.c david.keisarschm
2022-12-18 18:18 ` [PATCH v3 2/3] Replace invocation of weak PRNG inside mm/slab_common.c david.keisarschm
2022-12-18 18:19 ` [PATCH v3 3/3] Replace invocation of weak PRNG in arch/x86/mm/kaslr.c david.keisarschm
2023-01-06 19:23 ` Kees Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202301061118.836BF431F@keescook \
--to=keescook@chromium.org \
--cc=Jason@zx2c4.com \
--cc=aksecurity@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david.keisarschm@mail.huji.ac.il \
--cc=hpa@zytor.com \
--cc=ilay.bahat1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox