mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
Fiasco.OC: check for leaks while thread creation
When unmarshalling capabilities it is checked, whether a capability with the id was leaking, but this isn't done when creating a thread. Here the capability is transfered indirectly via the thread state object. This patch checks for old leakage capabilities while thread creation.
This commit is contained in:
parent
ac1ff2f5f8
commit
c3fcd834b0
@ -61,6 +61,15 @@ void Thread_base::start()
|
||||
l4_utcb_tcr_u(state.utcb)->user[UTCB_TCR_BADGE] = state.id;
|
||||
l4_utcb_tcr_u(state.utcb)->user[UTCB_TCR_THREAD_OBJ] = (addr_t)this;
|
||||
|
||||
/* there might be leaks in the application */
|
||||
Cap_index *idx = cap_map()->find(state.id);
|
||||
if (idx) {
|
||||
idx->inc();
|
||||
PWRN("leaking capability idx=%p id=%x ref_cnt=%d",
|
||||
idx, idx->id(), idx->dec());
|
||||
cap_map()->remove(idx);
|
||||
}
|
||||
|
||||
/* we need to manually increase the reference counter here */
|
||||
cap_map()->insert(state.id, state.kcap)->inc();
|
||||
} catch(Cap_index_allocator::Region_conflict) {
|
||||
|
Loading…
Reference in New Issue
Block a user