Bugfix slot allocation during urpc causes cap reuse

This commit is contained in:
Sparchatus 2022-05-02 09:11:03 +00:00
parent 5c6d186a3c
commit 323a9cc088

View File

@ -29,6 +29,12 @@ errval_t do_aos_urpc(
) {
errval_t err;
// allocate the return capability before performing the rpc call
if(ret_cap != NULL) {
err = slot_alloc(ret_cap);
if (err_is_fail(err)) return err_push(err, LIB_ERR_SLOT_ALLOC);
}
assert(rpc->meta->call_in_progress == 0);
assert(capref_is_null(arg_cap));
@ -62,9 +68,8 @@ errval_t do_aos_urpc(
if (ret0 != NULL) *ret0 = rpc->meta->a2;
if (ret1 != NULL) *ret1 = rpc->meta->a3;
if(ret_cap != NULL && rpc->meta->cap.type == ObjType_RAM) {
err = slot_alloc(ret_cap);
if (err_is_fail(err)) return err_push(err, LIB_ERR_SLOT_ALLOC);
if(ret_cap != NULL) {
assert(rpc->meta->cap.type == ObjType_RAM);
err = ram_forge(*ret_cap, rpc->meta->cap.u.ram.base, rpc->meta->cap.u.ram.bytes, my_core_id);
if (err_is_fail(err)) return err;
}