Commit Graph

31 Commits

Author SHA1 Message Date
Alexander Boettcher 773b0ecc3d noux: add verbose config parameter
Explicitly enable verbose output if required.
2013-08-22 15:13:12 +02:00
Norman Feske 956cab5fdb noux: Keep track of how dataspaces are used
This patch eliminates the "no attachment at..." warnings, which
were caused by a use-after-free problem of dataspaces. When a
dataspace was destroyed, the users of the dataspace were not
informed and therefore could not revert possible attachments to
RM sessions. The fix introduces a callback mechanism that allows
dataspace users (i.e., RM regions) to register for the event that
a dataspace vanishes.

The following types of dataspaces are handled:
* RAM dataspaces
* ROM dataspaces
* The process binary
* The binary of the dynamic linker
* Args dataspace
* Sysio dataspace
* Env dataspace
* managed RM dataspaces

The handling of ROM dataspaces is still not complete. When forking,
the ROM dataspace of the parent process gets just reused without
creating proper meta data ('Dataspace_info') for the forked process.
Similar issues might arise from other special dataspaces (e.g.,
args, env, sysio).

This patch removes all "no attachment at..." warnings except for
one (an attachment at 0).

Issue #485
2013-08-06 17:40:10 +02:00
Josef Söntgen 29b8370f73 noux: add local cpu and ram service
Use a local CPU service to prevent a redirection to noux' parent (in
this case init which does not know noux' local capabilities).

Fixes #791.
2013-07-05 12:37:42 +02:00
Norman Feske 73ab30c22c Update copyright headers to 2013 2013-01-10 21:44:47 +01:00
Christian Prochaska 6fa57141ae Noux: delayed 'Child' object destruction
With this patch the destruction of Noux 'Child' objects gets delayed
further until the exit signal has been dispatched. This prevents the
self-destruction of the signal dispatcher, which is a member of the
'Child' object.

Fixes #603.
2013-01-10 21:16:37 +01:00
Norman Feske 13d4108fea Unify 'Signal_dispatcher' interfaces
Several users of the signal API used custom convenience classes to
invoke signal-handling functions on the reception of incoming signals.
The 'Signal_dispatcher' pattern turned out to be particularly useful. To
avoid the duplication of this code across the code base, this patch
adds the interface to 'base/signal.h'.

Furthermore, the patch changes the 'Signal::num()' return type from int
to unsigned because negative numbers are meaningless here.

Fixes #511
2013-01-10 21:09:14 +01:00
Josef Söntgen c74bdbf8d8 Noux: add Io_receptor_registry 2012-11-07 11:32:11 +01:00
Josef Söntgen 082d8d6623 Noux/net: refactoring of Socket_io_channel
The Socket_io_channel class now uses the Io_channel_backend to provide
the network related methods. In addition the Socket_io_channel_registry
was replaced with a simpler implementation which uses Io_receptors to
unblock I/O channels from the callback-function of lwip.
2012-11-07 11:32:06 +01:00
Christian Prochaska e9ac4b653b Add support for symbolic links
This patch adds support for symbolic links in libc, libc plugins, file
system servers and Noux.

Fixes #322.
2012-10-08 15:05:02 +02:00
Christian Prochaska 55a8bae2f8 Noux: close all file descriptors on child exit
With this patch, when a child exits, all of its open file descriptors get
closed immediately. This is necessary to unblock the parent if it is
trying to read from a pipe (connected to the child) before calling
'wait4()'.

Fixes #357.
2012-09-24 09:18:00 +02:00
Christian Prochaska 78b0bd57f7 Noux: store environment variables zero-separated
With this patch environment variables always get stored as zero-separated
strings in buffers of type 'Sysio::Env'. This fixes the problem that
environment variables with non-alphanumeric characters did not get set
correctly in child processes.

Fixes #340.
2012-08-30 10:44:53 +02:00
Josef Söntgen 8dfb3d5d81 Noux: add cleanup_socket_descriptors() function
When a child exists it makes sure that all remaining socket descriptors
are closed.
2012-08-22 09:51:30 +02:00
Josef Söntgen a77c3dffd0 Noux: add user information support (struct passwd)
There are certain programs which need the information that is stored in
'struct passwd'. This commit introduces configurable user information
support to NOUX.

One can set the user information via <user> in NOUX config:

! <config>
!   <user name="baron" uid="1" gid="1">
!     <shell name="/bin/bash" />
!     <home name="/home" />
!   </user>
! [...]
! </config>

When <user> is not specified default values are used. Currently these
are 'root', 0, 0, '/bin/bash', '/'.

Note: this is just a single user implementation because each Noux instance
has only one user or rather one identity and there will be no complete
multi-user support in Noux. If you need different users, just start new
Noux instances for each of them.
2012-08-22 09:51:28 +02:00
Josef Söntgen ae524e4beb Noux: add timeout handling to select()
Previously there was not actual timeout handling. If a select() call
set an timeout it would be set to zero instead and was always handled
as blocking i/o. While this works fine for file descriptors which
will be triggerd externally (for example vim through terminal i/o) it
does not work at all for socket descriptors and network operations in
general.

So this commit introduces proper timeout handling and changes the
behaviour of SYSCALL_SELECT so that it now returns more than just
one descriptor at a time.

noux/minimal and noux/net now depend on thread and alarm libraries.
2012-08-22 09:51:27 +02:00
Josef Söntgen 6d8a7c0cc4 Initial version of networking support for Noux
Noux/net adds network functionality to noux. Currently most basic
network related system calls including 'accept', 'bind', 'connect',
'listen', 'recv', 'send', 'shutdown', and 'socket' are implemented by
wrapping lwip's network functions.

At the moment noux/net is rarely usable, though it is possible to
use netcat to send a message to a netcat server which listen on a
given port in noux/net.
2012-05-29 13:54:59 +02:00
Norman Feske 0f6b59097e Detect execve failure 2012-05-18 17:10:54 +02:00
Norman Feske 66290ea46d Stacked file systems for Noux
This patch introduces support for stacked file systems alongside new
glue for accessing file-system implementations provided via Genode's
new file-system-session interface.

Using stacked file systems, an arbitrary number of file systems (such
as tar archives or file systems implemented as separate Genode
components) can be composed to form one merged virtual file system.

An example is given via the 'ports/run/noux_bash.run' script. This run
script creates a virtual file system out of multiple tar archives each
containing the content of a particular GNU package. In addition, one
'ram_fs' is mounted, which enables Noux to perform write operations.
This way, the shell output can be redirected to a file, or files can
be saved in VIM.

Fixes #103.
2012-05-17 20:34:00 +02:00
Norman Feske 5bedeef814 Simplify use of namespace Genode within Noux 2012-04-23 20:43:43 +02:00
Norman Feske d6e30c19de Replace 'Native_capability::copy_to' by accessor
The 'copy_to' function turned out to be not flexible enough to
accommodate the Noux fork mechanism. This patch removes the function,
adds an accessor for the capability destination and a compound type
'Native_capability::Raw' to be used wherever plain capability
information must be communicated.
2012-03-28 09:58:51 +02:00
Norman Feske afeb54ebed Add pipe and dup2 syscalls to Noux
Fixes #133.
2012-03-21 21:37:17 +01:00
Norman Feske 207abe647b Handle current working directory in Noux 2012-03-16 18:23:00 +01:00
Norman Feske a9152ff412 Handle lifetime of dynamic allocations in Noux 2012-02-26 13:34:48 +01:00
Norman Feske 780507f42b Implementation of wait4 syscall
The 'noux_bash.run' script has become able to present the user with an
interactive bash shell for executing various coreutils programs. It is
still pretty limited, i.e., the environment is not correctly passed to
child processes and pipes are not supported. But bash and coreutils are
operational.
2012-02-24 23:43:35 +01:00
Norman Feske 7c98268901 Noux cleanup and source documentation
This patch decomposes the former 'child.h' into several header files,
unifies the naming of classes, and adds source-code documentation.
2012-02-23 10:42:12 +01:00
Norman Feske cbd4830977 Propagate new parent cap to forked process
This patch removes the hardcoded parent cap for the new child by
introducing a facility called 'poke' similar to copy-to-user. This
change makes the fork mechanism kernel-agnostic. The 'noux_fork'
test works on L4/Fiasco, OKL4, NOVA, Fiasco.OC, and L4ka::Pistachio.
Linux is not supported yet.
2012-02-23 10:42:11 +01:00
Norman Feske fe2addf5b0 Noux: first functional version of fork
The resource virtualization layer has been extended to support sub RM
sessions because this feature is used by the dynamic linker. Currently,
the address space of the forking process is copied eagerly. However,
different dataspace types are treated differently. For example, only RAM
dataspaces are copied but no ROM dataspaces.

At the libc side, a setjmp/longjmp-based trampoline mechanism is used to
implement the continuation of the main thread inside the new process.
This procedure is also responsible for re-establishing the relationship
to the new process' parent as well as its Noux session.

This version is still in flux and has many rough edges. It is tied to
OKL4 for now.
2012-02-23 10:42:11 +01:00
Norman Feske 869c6e1df2 Noux: dim naming noise using the Genode namespace
Because 'Noux::Child' implements several abstract Genode interfaces, the
'Genode::' prefix became almost ubiquitous, making the code harder to
read. By importing the 'Genode' namespace into the 'Noux' namespace,
this patch remedies this inconvenience.
2012-02-22 15:56:45 +01:00
Norman Feske 5aaf04915c Intercept CPU session of Noux::Child
To implement fork semantics, we need to customize the bootstrapping of
the newly created process, in particular the startup of the main thread.
The CPU session interface provides a suitable hook. By virtualizing the
CPU connection of the process to core, we can defer (and parametrize)
the startup of the main thread. Furthermore, this enables us to detect
illegal attempts by the Noux process to create threads in addition to
the main thread.
2012-02-22 15:56:45 +01:00
Norman Feske 652a4afd51 Intercept RAM and RM of Noux processes
By letting Noux processes talk to service implementations local to the
Noux server, we can track RAM allocations and RM operations. This is
needed as a prerequisite to implement fork.
2012-02-22 15:56:45 +01:00
Norman Feske 08ce32215d Bump year in copyright headers to 2012 2012-01-03 15:35:05 +01:00
Genode Labs da4e1feaa5 Imported Genode release 11.11 2011-12-22 16:19:25 +01:00