diff options
author | Peter Elliott <pelliott@ualberta.ca> | 2020-06-27 11:10:01 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-27 19:40:33 +0200 |
commit | e1aef94a409d61d97d4da5d171f33d08e75c8bce (patch) | |
tree | 8b8b11499463eb53e1cb3a8c796d235b03d1a89f /Kernel/VM/PageDirectory.cpp | |
parent | 1eb338ab71b9806f1380c7d789c799a10a036214 (diff) | |
download | serenity-e1aef94a409d61d97d4da5d171f33d08e75c8bce.zip |
Kernel: Make Random work on CPUs without rdrand
- If rdseed is not available, fallback to rdrand.
- If rdrand is not available, block for entropy, or use insecure prng
depending on if user wants fast or good random.
Diffstat (limited to 'Kernel/VM/PageDirectory.cpp')
-rw-r--r-- | Kernel/VM/PageDirectory.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp index 75f934f2c9..e04778dae9 100644 --- a/Kernel/VM/PageDirectory.cpp +++ b/Kernel/VM/PageDirectory.cpp @@ -79,7 +79,7 @@ PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_rang if (parent_range_allocator) { m_range_allocator.initialize_from_parent(*parent_range_allocator); } else { - size_t random_offset = (get_good_random<u32>() % 32 * MB) & PAGE_MASK; + size_t random_offset = (get_fast_random<u32>() % 32 * MB) & PAGE_MASK; u32 base = userspace_range_base + random_offset; m_range_allocator.initialize_with_range(VirtualAddress(base), userspace_range_ceiling - base); } |