mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 07:08:18 +00:00
base: catch exceptions in rm_session
For base-nova thread creation related exception can be thrown, since the Pager_objects are threads. Catch the exception and re-throw the expected/documented exception in rm_session. This commit avoids that core dies with an unhandled exception if a thread couldn't be created (e.g. because the limit has been reached).
This commit is contained in:
committed by
Norman Feske
parent
df3c0d4786
commit
9cdf062ee6
@ -293,6 +293,7 @@ void Rm_faulter::fault(Rm_session_component *faulting_rm_session,
|
|||||||
|
|
||||||
void Rm_faulter::dissolve_from_faulting_rm_session()
|
void Rm_faulter::dissolve_from_faulting_rm_session()
|
||||||
{
|
{
|
||||||
|
/* serialize access */
|
||||||
Lock::Guard lock_guard(_lock);
|
Lock::Guard lock_guard(_lock);
|
||||||
|
|
||||||
if (_faulting_rm_session)
|
if (_faulting_rm_session)
|
||||||
@ -326,8 +327,7 @@ Rm_session_component::attach(Dataspace_capability ds_cap, size_t size,
|
|||||||
Lock::Guard lock_guard(_lock);
|
Lock::Guard lock_guard(_lock);
|
||||||
|
|
||||||
/* offset must be positive and page-aligned */
|
/* offset must be positive and page-aligned */
|
||||||
if (offset < 0
|
if (offset < 0 || align_addr(offset, get_page_size_log2()) != offset)
|
||||||
|| align_addr(offset, get_page_size_log2()) != offset)
|
|
||||||
throw Invalid_args();
|
throw Invalid_args();
|
||||||
|
|
||||||
/* check dataspace validity */
|
/* check dataspace validity */
|
||||||
@ -577,6 +577,8 @@ Pager_capability Rm_session_component::add_client(Thread_capability thread)
|
|||||||
Rm_client *cl;
|
Rm_client *cl;
|
||||||
try { cl = new(&_client_slab) Rm_client(this, badge); }
|
try { cl = new(&_client_slab) Rm_client(this, badge); }
|
||||||
catch (Allocator::Out_of_memory) { throw Out_of_metadata(); }
|
catch (Allocator::Out_of_memory) { throw Out_of_metadata(); }
|
||||||
|
catch (Cpu_session::Thread_creation_failed) { throw Out_of_metadata(); }
|
||||||
|
catch (Thread_base::Stack_alloc_failed) { throw Out_of_metadata(); }
|
||||||
|
|
||||||
_clients.insert(cl);
|
_clients.insert(cl);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user