Linux: Robustness of socket life-time management

This patch improves the life-time management of socket descriptors and
addresses several corner cases exposed by the 'bomb' test.

The lookup and association of file descriptors with global IDs have been
turned into an atomic operation. Otherwise, multiple threads interacting
with the singleton 'ep_sd_registry' may override each other's
associations.

Closing the socket pair used for the reply channel has been implemented
via the RAII pattern to capture all corner cases, in particular
exceptions.

If blocking operations are interrupted by signals, we throw a
'Blocking_canceled' exception.

We preserve core's socket descriptor at 'PARENT_SOCKET_HANDLE' to avoid
a corner case where the parent capability is going to dup2'ed to the
same handle.

Support for 'Thread_base::join' within core to enable leaving Genode via
Control-C.
This commit is contained in:
Norman Feske
2012-11-26 20:30:35 +01:00
parent 5c8373bec3
commit 91e6ab2baf
5 changed files with 140 additions and 73 deletions

View File

@ -38,6 +38,7 @@ void Thread_base::_thread_start()
lx_sigaction(LX_SIGCHLD, (void (*)(int))1);
Thread_base::myself()->entry();
Thread_base::myself()->_join_lock.unlock();
sleep_forever();
}