Relax constraints on reentrancy for extent hooks.
If we guarantee no malloc activity in extent hooks, it's possible to make customized hooks working on arena 0. Remove the non-a0 assertion to enable such use cases.
This commit is contained in:
parent
e55c3ca267
commit
a315688be0
@ -151,6 +151,7 @@ pre_reentrancy(tsd_t *tsd, arena_t *arena) {
|
||||
assert(arena != arena_get(tsd_tsdn(tsd), 0, false));
|
||||
|
||||
bool fast = tsd_fast(tsd);
|
||||
assert(tsd_reentrancy_level_get(tsd) < INT8_MAX);
|
||||
++*tsd_reentrancy_levelp_get(tsd);
|
||||
if (fast) {
|
||||
/* Prepare slow path for reentrancy. */
|
||||
|
13
src/extent.c
13
src/extent.c
@ -1028,7 +1028,18 @@ extent_alloc_default(extent_hooks_t *extent_hooks, void *new_addr, size_t size,
|
||||
static void
|
||||
extent_hook_pre_reentrancy(tsdn_t *tsdn, arena_t *arena) {
|
||||
tsd_t *tsd = tsdn_null(tsdn) ? tsd_fetch() : tsdn_tsd(tsdn);
|
||||
pre_reentrancy(tsd, arena);
|
||||
if (arena == arena_get(tsd_tsdn(tsd), 0, false)) {
|
||||
/*
|
||||
* The only legitimate case of customized extent hooks for a0 is
|
||||
* hooks with no allocation activities. One such example is to
|
||||
* place metadata on pre-allocated resources such as huge pages.
|
||||
* In that case, rely on reentrancy_level checks to catch
|
||||
* infinite recursions.
|
||||
*/
|
||||
pre_reentrancy(tsd, NULL);
|
||||
} else {
|
||||
pre_reentrancy(tsd, arena);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user