mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
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.
This commit is contained in:
parent
1eb338ab71
commit
e1aef94a40
Notes:
sideshowbarker
2024-07-19 05:21:11 +09:00
Author: https://github.com/petelliott
Commit: e1aef94a40
Pull-request: https://github.com/SerenityOS/serenity/pull/2646
Issue: https://github.com/SerenityOS/serenity/issues/2634
Reviewed-by: https://github.com/awesomekling
4 changed files with 71 additions and 12 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue