Extent.c: Avoid an rtree NULL-check.

The edge case in which pages_map returns (void *)PAGE can trigger an incorrect
assertion failure.  Avoid it.
This commit is contained in:
David Goldblatt 2020-12-17 17:14:30 -08:00 committed by David Goldblatt
parent b35ac00d58
commit 526180b76d

View File

@ -893,8 +893,22 @@ extent_try_coalesce_impl(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
}
/* Try to coalesce backward. */
edata_t *prev = emap_lock_edata_from_addr(tsdn, pac->emap,
edata_t *prev = NULL;
if (edata_before_get(edata) != NULL) {
/*
* This is subtle; the rtree code asserts that its input
* pointer is non-NULL, and this is a useful thing to
* check. But it's possible that edata corresponds to
* an address of (void *)PAGE (in practice, this has
* only been observed on FreeBSD when address-space
* randomization is on, but it could in principle happen
* anywhere). In this case, edata_before_get(edata) is
* NULL, triggering the assert.
*/
prev = emap_lock_edata_from_addr(tsdn, pac->emap,
edata_before_get(edata), inactive_only);
}
if (prev != NULL) {
bool can_coalesce = extent_can_coalesce(ecache, edata,
prev);