mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-07 11:58:41 +03:00
stronger encoding of free lists using two keys per page
This commit is contained in:
parent
ce02986d56
commit
e3391d9a53
8 changed files with 83 additions and 50 deletions
|
@ -231,9 +231,9 @@ void _mi_random_init(mi_random_ctx_t* ctx) {
|
|||
if (!os_random_buf(key, sizeof(key))) {
|
||||
// if we fail to get random data from the OS, we fall back to a
|
||||
// weak random source based on the current time
|
||||
_mi_warning_message("unable to use secure randomness\n");
|
||||
uintptr_t x = os_random_weak(0);
|
||||
for (size_t i = 0; i < 8; i++) { // key is eight 32-bit words.
|
||||
_mi_warning_message("unable to use secure randomness\n");
|
||||
x = _mi_random_shuffle(x);
|
||||
((uint32_t*)key)[i] = (uint32_t)x;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue