Bugfix: page faults during root cnode refill

This commit is contained in:
Sparchatus 2022-04-13 10:58:26 +00:00
parent 54ff71f710
commit 8aec2a8ce3

View File

@ -182,11 +182,18 @@ errval_t single_slot_alloc_resize(struct single_slot_allocator *this,
// Refill slab allocator
size_t bufgrow = SINGLE_SLOT_ALLOC_BUFLEN(grow);
void *buf = malloc(bufgrow);
if (!buf) {
return LIB_ERR_MALLOC_FAIL;
// NOTE team08: changed to not cause a pagefault because it can be called during page fault handling
struct capref slot;
err = get_default_slot_allocator()->alloc(get_default_slot_allocator(), &slot);
if (err_is_fail(err)) {
return err;
}
slab_grow(&this->slab, buf, bufgrow);
slab_refill_no_pagefault(&this->slab, slot, bufgrow);
// void *buf = malloc(bufgrow);
// if (!buf) {
// return LIB_ERR_MALLOC_FAIL;
// }
// slab_grow(&this->slab, buf, bufgrow);
// Update free slot metadata
err = free_slots(this, this->a.nslots, grow, &this->a.mutex);