Skip to content

Replace invocations of prandom_u32() with get_random_u32() and siphash

[email protected] linux-mm lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 3 repliesIn review
  2. v5 posting 2/20 of 3 patches 0 repliesSuperseded
  3. v5 posting 1/23 patches 4 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v43 patches2 repliesSuperseded
v33 patches1 replySuperseded
v23 patches1 replySuperseded

Changes in v6 from the cover letter

* Fixed coding style issues in mm/slab and mm/slab_common.
* Deleted irrelevant changes which were appended accidentally in arch/x86/mm/kaslr.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mm/slab: Replace invocation of weak PRNGmm/slab.c+9 -200 replies
2/3mm/slab_common: Replace invocation of weak PRNGmm/slab_common.c+3 -80 replies
3/3arch/x86/mm/kaslr: use siphash instead of prandom_bytes_statearch/x86/mm/kaslr.c+15 -62 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/3] Replace invocations of prandom_u32() with get_random_u32() and siphash

From: David Keisar Schmidt <[email protected]>

Hi,

The security improvements for prandom_u32 done in commits c51f8f88d705 from October 2020 and d4150779e60f from May 2022 didn't handle the cases when prandom_bytes_state() and prandom_u32_state() are used.

Specifically, this weak randomization takes place in three cases:

    1.	mm/slab.c
    2.	mm/slab_common.c
    3.	arch/x86/mm/kaslr.c

The first two invocations (mm/slab.c, mm/slab_common.c) are used to create randomization in the slab allocator freelists.
This is done to make sure attackers can’t obtain information on the heap state.

The last invocation, inside arch/x86/mm/kaslr.c,
randomizes the virtual address space of kernel memory regions. Hence, we have added the necessary changes to make those randomizations stronger, switching prandom_u32 instance to siphash.

Changes since v5:
* Fixed coding style issues in mm/slab and mm/slab_common.
* Deleted irrelevant changes which were appended accidentally in arch/x86/mm/kaslr.

Changes since v4:
* Changed only the arch/x86/mm/kaslr patch.
In particular, we replaced the use of prandom_bytes_state and prandom_seed_state with siphash inside arch/x86/mm/kaslr.c.

Changes since v3:
* edited commit messages

Changes since v2:
* edited commit message.
* replaced instances of get_random_u32 with get_random_u32_below in mm/slab.c, mm/slab_common.c

Regards,

David Keisar Schmidt (3):
mm/slab: Replace invocation of weak PRNG mm/slab_common: Replace invocation of weak PRNG arch/x86/mm/kaslr: use siphash instead of prandom_bytes_state

 arch/x86/mm/kaslr.c | 21 +++++++++++++++------
 mm/slab.c           | 29 +++++++++--------------------
 mm/slab_common.c    | 11 +++--------
 3 files changed, 27 insertions(+), 34 deletions(-)
Signature · 1 line
2.37.3