<div dir="ltr">Hi Norman and Christian,<div><br></div><div>thank you both for your answers! I actually got Norman's approach working using a slightly modified version of the demo's launchpad. With this launchpad, all I have to do is load incoming binaries into an Attached_ram_dataspace as Norman said.</div><div><br></div><div><div>diff --git a/repos/demo/include/launchpad/launchpad.h b/repos/demo/include/launchpad/launchpad.h</div><div>index 9aa0ed5..2e319f8 100644</div><div>--- a/repos/demo/include/launchpad/launchpad.h</div><div>+++ b/repos/demo/include/launchpad/launchpad.h</div><div>@@ -268,7 +268,9 @@ class Launchpad</div><div> <span class="" style="white-space:pre">             </span>                          Genode::Allocator *alloc) { }</div><div> </div><div> <span class="" style="white-space:pre">            </span>Launchpad_child *start_child(const char *prg_name, unsigned long quota,</div><div>-<span class="" style="white-space:pre">           </span>                             Genode::Dataspace_capability config_ds);</div><div>+<span class="" style="white-space:pre">               </span>                             Genode::Dataspace_capability config_ds,</div><div>+<span class="" style="white-space:pre">                </span>                             Genode::Dataspace_capability binary_ds = </div><div>+<span class="" style="white-space:pre">             </span>                               Genode::Dataspace_capability());</div><div> </div><div> <span class="" style="white-space:pre">          </span>/**</div><div> <span class="" style="white-space:pre">              </span> * Exit child and close all its sessions</div><div>diff --git a/repos/demo/src/lib/launchpad/launchpad.cc b/repos/demo/src/lib/launchpad/launchpad.cc</div><div>index d60ad51..2fde521 100644</div><div>--- a/repos/demo/src/lib/launchpad/launchpad.cc</div><div>+++ b/repos/demo/src/lib/launchpad/launchpad.cc</div><div>@@ -186,7 +186,8 @@ void Launchpad::process_config()</div><div> </div><div> Launchpad_child *Launchpad::start_child(const char *filename,</div><div>                                         unsigned long ram_quota,</div><div>-                                        Genode::Dataspace_capability config_ds)</div><div>+                                        Genode::Dataspace_capability config_ds,</div><div>+                                        Genode::Dataspace_capability binary_ds)</div><div> {</div><div> <span class="" style="white-space:pre">      </span>printf("starting %s with quota %lu\n", filename, ram_quota);</div><div> </div><div>@@ -212,19 +213,27 @@ Launchpad_child *Launchpad::start_child(const char *filename,</div><div> <span class="" style="white-space:pre">        </span>/* lookup executable elf binary */</div><div> <span class="" style="white-space:pre">       </span>Dataspace_capability  file_cap;</div><div> <span class="" style="white-space:pre"> </span>Rom_session_capability rom_cap;</div><div>-<span class="" style="white-space:pre">   </span>try {</div><div>-<span class="" style="white-space:pre">             </span>/*</div><div>-<span class="" style="white-space:pre">                </span> * When creating a ROM connection for a non-existing file, the</div><div>-<span class="" style="white-space:pre">            </span> * constructor of 'Rom_connection' throws a 'Parent::Service_denied'</div><div>-<span class="" style="white-space:pre">              </span> * exception.</div><div>-<span class="" style="white-space:pre">             </span> */</div><div>-<span class="" style="white-space:pre">               </span>Rom_connection rom(filename, unique_name);</div><div>-<span class="" style="white-space:pre">                </span>rom.on_destruction(Rom_connection::KEEP_OPEN);</div><div>-<span class="" style="white-space:pre">            </span>rom_cap  = rom.cap();</div><div>-<span class="" style="white-space:pre">            </span>file_cap = rom.dataspace();</div><div>-<span class="" style="white-space:pre">       </span>} catch (...) {</div><div>-<span class="" style="white-space:pre">           </span>printf("Error: Could not access file \"%s\" from ROM service.\n", filename);</div><div>-<span class="" style="white-space:pre">          </span>return 0;</div><div>+<span class="" style="white-space:pre"> </span>if (binary_ds == Genode::Dataspace_capability())</div><div>+<span class="" style="white-space:pre">  </span>{</div><div>+<span class="" style="white-space:pre">         </span>/* invalid dataspace, look up in file */</div><div>+<span class="" style="white-space:pre">          </span>try {</div><div>+<span class="" style="white-space:pre">                     </span>/*</div><div>+<span class="" style="white-space:pre">                        </span> * When creating a ROM connection for a non-existing file, the</div><div>+<span class="" style="white-space:pre">                    </span> * constructor of 'Rom_connection' throws a 'Parent::Service_denied'</div><div>+<span class="" style="white-space:pre">                      </span> * exception.</div><div>+<span class="" style="white-space:pre">                     </span> */</div><div>+<span class="" style="white-space:pre">                       </span>Rom_connection rom(filename, unique_name);</div><div>+<span class="" style="white-space:pre">                        </span>rom.on_destruction(Rom_connection::KEEP_OPEN);</div><div>+<span class="" style="white-space:pre">                    </span>rom_cap  = rom.cap();</div><div>+<span class="" style="white-space:pre">                    </span>file_cap = rom.dataspace();</div><div>+<span class="" style="white-space:pre">               </span>} catch (...) {</div><div>+<span class="" style="white-space:pre">                   </span>printf("Error: Could not access file \"%s\" from ROM service.\n", filename);</div><div>+<span class="" style="white-space:pre">                  </span>return 0;</div><div>+<span class="" style="white-space:pre">         </span>}</div><div>+<span class="" style="white-space:pre"> </span>}</div><div>+<span class="" style="white-space:pre"> </span>else</div><div>+<span class="" style="white-space:pre">      </span>{</div><div>+<span class="" style="white-space:pre">         </span>file_cap = binary_ds;</div><div> <span class="" style="white-space:pre">    </span>}</div><div> </div><div> <span class="" style="white-space:pre">       </span>/* create ram session for child with some of our own quota */</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 January 2016 at 18:11, Norman Feske <span dir="ltr"><<a href="mailto:norman.feske@...1..." target="_blank">norman.feske@...1...</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Georg,<br>
<span class=""><br>
> On Thu, Jan 14, 2016 at 12:29:49PM +0100, Georg Guba wrote:<br>
>> I'm trying to start new child components from ELF binaries received at<br>
>> run-time and stored in a server-local buffer. Basically, I am trying to<br>
>> implement a server that can receive task descriptions and matching binaries<br>
>> and then start them at run-time (disregarding security concerns for the<br>
>> moment).<br>
<br>
</span><span class="">On 14.01.2016 17:06, Christian Helmuth wrote:<br>
> The first idea that comes to my mind is: Implement a ROM server<br>
> "elf_rom", which stores the retrieved ELF binaries in dataspaces<br>
> allocated from its RAM session.<br>
<br>
</span>As long as your executable binary is statically linked, the problem can<br>
be solved in an easier way: When creating a subsystem by constructing a<br>
'Child' object, you have to pass a dataspace capability for the ELF<br>
binary. You can simply allocate a new RAM dataspace (i.e., creating an<br>
'Attached_ram_dataspace'), copy the ELF binary into the dataspace and<br>
pass the dataspace capability to the constructor of the 'Child'. There<br>
is no need to create a ROM server.<br>
<br>
However, if you want to start dynamically linked executables, the child<br>
component will initially start the dynamic linker, which, in turn,<br>
requests the executable binary along with the needed shared libraries as<br>
ROM sessions. Your server would need to respond to those requests by<br>
handing out ROM-session capabilities. As an example for this approach, I<br>
recommend you to look at the loader [1], which seems to be similar to<br>
the server you are building.<br>
<br>
[1]<br>
<a href="https://github.com/genodelabs/genode/tree/master/repos/os/src/server/loader" rel="noreferrer" target="_blank">https://github.com/genodelabs/genode/tree/master/repos/os/src/server/loader</a><br>
<br>
Cheers<br>
<span class="HOEnZb"><font color="#888888">Norman<br>
<br>
--<br>
Dr.-Ing. Norman Feske<br>
Genode Labs<br>
<br>
<a href="http://www.genode-labs.com" rel="noreferrer" target="_blank">http://www.genode-labs.com</a> · <a href="http://genode.org" rel="noreferrer" target="_blank">http://genode.org</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden<br>
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth<br>
<br>
------------------------------------------------------------------------------<br>
Site24x7 APM Insight: Get Deep Visibility into Application Performance<br>
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month<br>
Monitor end-to-end web transactions and take corrective actions now<br>
Troubleshoot faster and improve end-user experience. Signup Now!<br>
<a href="http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140" rel="noreferrer" target="_blank">http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140</a><br>
_______________________________________________<br>
genode-main mailing list<br>
<a href="mailto:genode-main@lists.sourceforge.net">genode-main@...12...ceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/genode-main" rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/genode-main</a><br>
</div></div></blockquote></div><br></div>