Commit Graph

836 Commits

Author SHA1 Message Date
Torsten Hilbrich
59eb8bf3a8 base-linux: Add chdir after performing chroot
This ensures that the cwd of the process is within the chroot
environment, improving security for root processes.

The cwd after the chroot is the same as before, this is needed to
start binaries given as relative path name.
2012-11-21 20:03:52 +01:00
Norman Feske
bcabbe2c92 Add 'Thread_base::join()'
Using the new 'join()' function, the caller can explicitly block for the
completion of the thread's 'entry()' function. The test case for this
feature can be found at 'os/src/test/thread_join'. For hybrid
Linux/Genode programs, the 'Thread_base::join()' does not map directly
to 'pthread_join'. The latter function gets already called by the
destructor of 'Thread_base'. According to the documentation, subsequent
calls of 'pthread_join' for one thread may result in undefined behaviour.
So we use a 'Genode::Lock' on this platform, which is in line with the
other platforms.

Related to #194, #501
2012-11-19 12:43:34 +01:00
Christian Helmuth
2995011b34 base-linux: implement IPC server destruction
When an IPC server is finalized two important things should happen:
First, the association of the server socket with a capability must be
invalidated. And finally, the server socket pair (server side and client
side) must be closed.

Related to #38.
2012-11-16 13:55:08 +01:00
Christian Helmuth
d23ee02e9a Destruct IPC-server object on entrypoint destruction
The IPC-server object exists solely on the stack of the entrypoint
thread and, therefore, would never be destructed as the thread is just
killed. Now, the object is explicitly destructed in the entrypoint
destructor. An alternative solution could instruct the entrypoint thread
the terminate, which would automatically cleanup its stack.

The object pool is assumed to be empty on destruction of the entrypoint.
If not, we warn and at least dissolve all RPC objects.
2012-11-16 13:55:00 +01:00
Christian Helmuth
2cdac0eb32 bomb test: stack size on 64-bit / dense logging 2012-11-15 12:58:47 +01:00
Christian Helmuth
d7c511ad87 base: entrypoint stack size 2048 machine words
This makes the stack fit for 32-bit as well as 64-bit platforms.
2012-11-15 12:58:46 +01:00
Christian Helmuth
3d35c3e23b base-fiasco: support 64bit build hosts 2012-11-15 10:32:05 +01:00
Christian Helmuth
67e558d975 base-fiasco: document dependency to byacc
Fixes #486.
2012-11-15 10:31:48 +01:00
Josef Söntgen
b7d1c40460 Terminal: add bg color handling + PDBG
Set the right bg color instead of using a dimmed version of the fg
color. The colors are stored in the first 6 bits of the color index.
Thereby the first 3 bits contain the fg and the second 3 bits the
bg color.

The debug message in _handle_esc_seq5() now shows the sequence in
question.

Fixes #495.
2012-11-14 16:57:43 +01:00
Josef Söntgen
3c562d042d Noux: fix resetting wrong number of fds
Since the number of the fds in the select call is not necassarily equal
to the number of fds SYSCALL_SELECT returns we have to reset the number
of fds given as argument to select().

This keeps OpenSSH from reading from a non-ready socket.

Fixes #494.
2012-11-14 16:57:13 +01:00
Josef Söntgen
a3c45412aa Noux: fix num_* return value in SYSCALL_SELECT
select_out.num_* was unecessarily set multiple times and not at all
if unblock_* was 0.

Fixes #494.
2012-11-14 16:56:58 +01:00
Christian Prochaska
c39e5557c5 libports: stdcxx 4.7.2 update
Fixes #469.
2012-11-14 16:55:33 +01:00
Christian Prochaska
d31a14fb55 ports: GCC 4.7 build fixes
Fixes #476.
2012-11-14 16:55:13 +01:00
Martin Stein
4794e97d80 base-pistachio: Avoid warnings.
Avoid warnings in 'base-pistachio/src/core/platform_pd.cc'
and 'base-pistachio/src/core/platform_thread.cc'.

Fixes #479.
2012-11-14 16:54:44 +01:00
Christian Prochaska
fb216f370b Noux: speed up tar record lookup
Currently the lookup of a specific record in a tar archive may take a long
time, because the records get searched in sequence. With this patch a tree
structure representing the directory layout gets created when loading the
tar file for speeding up record lookups.

Fixes #491.
2012-11-14 16:53:36 +01:00
Josef Söntgen
bb33c9f3cf libports: add dup() to libc
Fixes #492.
2012-11-14 16:52:33 +01:00
Josef Söntgen
8f372b469a Noux: fix dup() in libc_noux
The previous implementation disregards the fact that we actually have
to use libc's plugin mechanism if we play with fds. So in the end the
libc did not know to which plugin the fd belonged.

Fixes #493.
2012-11-14 16:51:15 +01:00
Torsten Hilbrich
d5a758ea10 Root_component::session: Fix ram_quota handling
You cannot check an unsigned size_t variable for underflow, so I
changed the code to first check if an underflow would occur before
performing the subtraction.

Fixes #489.
2012-11-14 16:39:18 +01:00
Torsten Hilbrich
7d30ffc907 base: Fix a number of warnings about unused parameters
The warnings are shown if components using the genode base are
compiled with -Wextra -Wall enabled.

Fixes #489.
2012-11-14 16:38:38 +01:00
Christian Prochaska
e3cba5dc6f GDB monitor: preserve more RAM quota
Fixes #484.
2012-11-14 16:36:52 +01:00
Christian Prochaska
7517b23d5d ports: remove binutils patch
Fixes #475.
2012-11-14 16:36:51 +01:00
Martin Stein
8d03312528 base_hw: Use board-specific 'Core_tlb'.
'Core_tlb' ensures that core never throws pagefaults,
in contrast to its base 'Tlb' that is planned to use displacement
in the future.

'Core_tlb' enables the application of differenet memory attributes
in core, according to the board specific partitioning of the physical
address space. This way it enables caching in core.
2012-11-14 16:36:51 +01:00
Martin Stein
4d2a3de0ee base_hw: Rename 'Software_tlb' 'Tlb'. 2012-11-14 16:36:51 +01:00
Martin Stein
dfcf55ff6e base_hw: Implement TLB as member of a kernel PD. 2012-11-14 16:36:51 +01:00
Martin Stein
53156de9f4 base_hw & arm: Memory attributes and light caching.
Enable caches. Core is not cached by now. This is because kernel
creates core space and doesn't know any memory attributes by now.
Cacheable pages are cached write-through without write-allocate.

Caching and write-combining is not supported for IOMEM by now.
2012-11-14 16:36:51 +01:00
Martin Stein
91c27f3f72 base: Tell a mapping wether it maps IO memory. 2012-11-14 16:36:51 +01:00
Martin Stein
cfa0a40d5e base_hw & omap4: USB HID and framebuffer driver.
Implement 'Signal_receiver::pending()'.

Provide display-subsystem MMIO.

Avoid method ambiguousness in 'Irq_context' in
'dde_linux/src/drivers/usb/signal/irq.cc'
(it derives from two list element classes when using 'base_hw').

Enables demo scenario with 'hw_panda_a2'.
2012-11-14 16:36:50 +01:00
Martin Stein
612735732a base_hw & omap4: Timer driver.
Fix bug regarding idle thread in thread scheduling in
'base-hw/src/core/kernel.cc'.

Fix regarding signal submit in signal framework in
'base-hw/src/core/kernel.cc'.
2012-11-14 16:36:50 +01:00
Martin Stein
31d57a6257 Nested init on i.MX31 via base_hw. Rework base_hw.
Implies support for the ARMv6 architecture through 'base-hw'.

Get rid of 'base/include/drivers' expect of 'base/include/drivers/uart'.

Merge with the support for trustzone on VEA9X4 that came from
Stefan Kalkowski.

Leave board drivers in 'base/include/platform'.

Rework structure of the other drivers that were moved to
'base_hw/src/core' and those that came with the trustzone support.

Beautify further stuff in 'base_hw'.

Test 'nested_init' with 'hw_imx31' (hardware) and 'hw_panda_a2' (hardware),
'demo' and 'signal' with 'hw_pbxa9' (qemu) and 'hw_vea9x4'
(hardware, no trustzone), and 'vmm' with 'hw_vea9x4'
(hardware, with trustzone).
2012-11-14 16:36:41 +01:00
Norman Feske
5b4edeb031 Introduce 'Uart::Session' interface
The new 'Uart::Session' interface is an extension of the
'Terminal::Session' interface that allows for configuring UART-specific
parameters, i.e., the baud rate.
2012-11-07 13:43:09 +01:00
Norman Feske
0c76bc9cfd Add support for specialized session interfaces
This patch introduces principal support for extending session interfaces
with specialized functionality in a clean way. For example, an 'Uart'
interface may implement the 'Terminal' interface but also offers
additional functions for setting the baud rate. A service that
implements the 'Uart' service will then automatically announce both the
'Uart' and 'Terminal' services.
2012-11-07 13:43:04 +01:00
Christian Prochaska
cb8910b40c Update lwip to version STABLE-1_4_1
Fixes #366.
2012-11-07 13:35:36 +01:00
Josef Söntgen
ac3a362fdf Noux: add dup() to libc_noux
This library function is implemented upon SYSCALL_DUP2. Therfor the
syscall was slightly changed. It now returns the new allocated fd in
dup2_out.fd.
2012-11-07 13:34:54 +01:00
Alexander Boettcher
7a619b9ede base-nova: solely revoke unused capabilities
Extend tracking of delegated and of translated items. The additional
information is used to solely free up unused/unwanted mapped capabilities and
to avoid unnecessary revokes on capability indexes where nothing have been
received.

Fixes #430
2012-11-07 13:32:40 +01:00
Josef Söntgen
db9dc3388d Noux: fix resetting fds in unmarshal_fds
Since FD_ZERO() resets a whole fd_set (which is 128 bytes) using it to
reset dst_fds will override otherwise used memory if the memory was
allocated dynamically and is less than sizeof (fd_set). So instead of
using this macro we reset the fd_set manually.
2012-11-07 11:32:26 +01:00
Josef Söntgen
0539c7180b Noux: add Io_receptor to SYSCALL_SELECT + bugfix
The Io_receptor is now used to unblock certain I/O channels from lwip's
callback-function.

There was also a bug in which all ready-to-ready fds were overriden by
the ready-to-write ones.
2012-11-07 11:32:16 +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
Josef Söntgen
08bd41b1ec Noux: add backend pointer to Io_channel
The backend pointer may be used to provide additional methods in a
Io_channel derived class.
2012-11-07 11:32:01 +01:00
Norman Feske
4b140a5202 Define SIGUSR1 for hybrid Linux/Genode programs
This patch fixes the 'lx_hybrid_pthread_ipc.run' test. In order to use
the 'Genode::Lock' we need to set the SIGUSR1 handler to an empty handler.
Normally, this happens when creating a thread via the Genode API. But as
this test creates a thread via the pthread library and thereby bypasses
the Genode API, the signal handler remained unset.
2012-11-06 17:32:30 +01:00
Norman Feske
21c22b8b5b Black-list 'tar_rom.run' on Linux 2012-11-06 17:16:06 +01:00
Norman Feske
bb8d090922 Resolve possible ambiguity of 'strcmp' 2012-11-06 09:35:47 +01:00
Norman Feske
90395e9428 Linux: Add 'Platform_thread' destructor 2012-11-05 17:31:05 +01:00
Christian Helmuth
d64dea51c0 Linux: Use 'umount2' as it seems more portable
In contrast to the 'umount' syscall, 'umount2' works on 32 bit and 64
bit.
2012-11-05 17:31:05 +01:00
Christian Helmuth
8020462748 Linux: Build hybrid library with Genode tool chain
Using the host compiler in this case seems to be an artifact from an
older change. On x86_64, this approach ended in unsable hybrid binaries
due to incompatible handling of non-trivial return values, i.e.
structures. See '-freg-struct-return' in GCC manual page:

  "[...] If there is no standard convention, GCC defaults to
  -fpcc-struct-return, except on targets where GCC is the principal
  compiler.  In those cases, we can choose the standard, and we chose
  the more efficient register return alternative."

In other words: All x86_64 Linux systems break the ABI standard :-(
2012-11-05 17:31:05 +01:00
Christian Helmuth
2cb604620e Add missing header for snprintf 2012-11-05 17:31:05 +01:00
Norman Feske
087582a964 Linux: Synchronize thread startup
The thread ID reported to core was not always initialized prior the RPC
call. The 'startup_lock' ensures that the thread is completely
initialized before this information gets propagated.
2012-11-05 17:31:05 +01:00
Norman Feske
940a5f1144 Fix narrowing issues reported by gcc-4.7 2012-11-05 17:31:05 +01:00
Norman Feske
b45242c50f Add chroot support to core
Since the recent move of the process creation into core, the original chroot trampoline
mechanism implemented in 'os/src/app/chroot' does not work anymore. A
process could simply escape the chroot environment by spawning a new
process via core's PD service. Therefore, this patch moves the chroot
support into core. So the chroot policy becomes mandatory part of the
process creation.  For each process created by core, core checks for
'root' argument of the PD session. If a path is present, core takes the
precautions needed to execute the new process in the specified chroot
environment.

This conceptual change implies minor changes with respect to the Genode
API and the configuration of the init process. The API changes are the
enhancement of the 'Genode::Child' and 'Genode::Process' constructors to
take the root path as argument. Init supports the specification of a
chroot per process by specifying the new 'root' attribute to the
'<start>' node of the process. In line with these changes, the
'Loader::Session::start' function has been enhanced with the additional
(optional) root argument.
2012-11-05 17:31:05 +01:00
Norman Feske
e1e7ab178f Resolve ambigiouties of size_t
When building in hybrid Linux/Genode mode, there exist two definitions
of 'size_t', one in the 'Genode' namespace and one imported from the
glibc headers.
2012-11-05 17:31:04 +01:00