use region quarantine even if MAP_FIXED call fails
This is a more sensible way of handling an out-of-memory failure in this edge case. It doesn't matter much in practice.
This commit is contained in:
parent
2335f56713
commit
5c974bdf82
@ -1008,7 +1008,7 @@ System calls used by all build configurations:
|
|||||||
* `mremap(old, old_size, new_size, MREMAP_MAYMOVE|MREMAP_FIXED, new)`
|
* `mremap(old, old_size, new_size, MREMAP_MAYMOVE|MREMAP_FIXED, new)`
|
||||||
* `munmap`
|
* `munmap`
|
||||||
* `write(STDERR_FILENO, buf, len)` (before aborting due to memory corruption)
|
* `write(STDERR_FILENO, buf, len)` (before aborting due to memory corruption)
|
||||||
* `madvise(ptr, size, MADV_DONTNEED)` for `malloc_trim` with slab quarantines
|
* `madvise(ptr, size, MADV_DONTNEED)`
|
||||||
|
|
||||||
The main distinction from a typical malloc implementation is the use of
|
The main distinction from a typical malloc implementation is the use of
|
||||||
getrandom. A common compatibility issue is that existing system call whitelists
|
getrandom. A common compatibility issue is that existing system call whitelists
|
||||||
|
@ -839,10 +839,10 @@ static void regions_quarantine_deallocate_pages(void *p, size_t size, size_t gua
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(memory_map_fixed(p, size))) {
|
if (unlikely(memory_map_fixed(p, size))) {
|
||||||
deallocate_pages(p, size, guard_size);
|
memory_purge(p, size);
|
||||||
return;
|
} else {
|
||||||
|
memory_set_name(p, size, "malloc large quarantine");
|
||||||
}
|
}
|
||||||
memory_set_name(p, size, "malloc large quarantine");
|
|
||||||
|
|
||||||
struct quarantine_info target =
|
struct quarantine_info target =
|
||||||
(struct quarantine_info){(char *)p - guard_size, size + guard_size * 2};
|
(struct quarantine_info){(char *)p - guard_size, size + guard_size * 2};
|
||||||
|
Loading…
Reference in New Issue
Block a user