Hi Georg,
On Thu, Jan 14, 2016 at 12:29:49PM +0100, Georg Guba wrote:
I'm trying to start new child components from ELF binaries received at run-time and stored in a server-local buffer. Basically, I am trying to implement a server that can receive task descriptions and matching binaries and then start them at run-time (disregarding security concerns for the moment).
On 14.01.2016 17:06, Christian Helmuth wrote:
The first idea that comes to my mind is: Implement a ROM server "elf_rom", which stores the retrieved ELF binaries in dataspaces allocated from its RAM session.
As long as your executable binary is statically linked, the problem can be solved in an easier way: When creating a subsystem by constructing a 'Child' object, you have to pass a dataspace capability for the ELF binary. You can simply allocate a new RAM dataspace (i.e., creating an 'Attached_ram_dataspace'), copy the ELF binary into the dataspace and pass the dataspace capability to the constructor of the 'Child'. There is no need to create a ROM server.
However, if you want to start dynamically linked executables, the child component will initially start the dynamic linker, which, in turn, requests the executable binary along with the needed shared libraries as ROM sessions. Your server would need to respond to those requests by handing out ROM-session capabilities. As an example for this approach, I recommend you to look at the loader [1], which seems to be similar to the server you are building.
[1] https://github.com/genodelabs/genode/tree/master/repos/os/src/server/loader
Cheers Norman