# HG changeset patch # User Paul Boddie # Date 1702405018 -3600 # Node ID 02161499be5d1ad9bd955ba293587d7470eefb17 # Parent e27f11f25e7e7e0245c30d589c3409f64e3dfb26 Support the unmapping of capabilities not managed by the allocator, like those acquired from the environment. diff -r e27f11f25e7e -r 02161499be5d libipc/lib/src/cap_alloc.c --- a/libipc/lib/src/cap_alloc.c Tue Dec 12 19:16:00 2023 +0100 +++ b/libipc/lib/src/cap_alloc.c Tue Dec 12 19:16:58 2023 +0100 @@ -1,7 +1,7 @@ /* * Capability allocation and management. * - * Copyright (C) 2019, 2021, 2022 Paul Boddie + * Copyright (C) 2019, 2021, 2022, 2023 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -20,7 +20,9 @@ */ #include +#include #include +#include #include "cap_alloc.h" #include "semaphore.h" @@ -115,7 +117,14 @@ if (err) return 0; - l4re_util_cap_free_um(cap); + l4re_util_cap_free(cap); + + /* Do the unmapping separately since the capability may not actually be + managed by the capability allocator if, for example, obtained from the + environment. */ + + l4_task_unmap(L4RE_THIS_TASK_CAP, l4_obj_fpage(cap, 0, L4_CAP_FPAGE_RWSD), + L4_FP_ALL_SPACES); ipc_semaphore_up(ipc_cap_alloc_semaphore);