Hi Stefan,

thank you for your answer!

Are you sure that in the scenario, where the child is created directly
by init, your service's PRAM and PRM interfaces are used at all? When
you route the child's RM and RAM session requests to your component that
does not mean they are used to create the child. For this purpose the
routes of init itself are decisive. Only RM and RAM sessions opened by
the child itself are routed according to the child's policy.

i didn't express myself correctly with the part about starting another component as a child of init. Sorry for that.

What I meant is that when I start a component (created with core-services as environment) next to my server which executes a main method like this:

int main (void)

{
    Proxy::Prm_connection prm;
    PDBG("Prm_connection established -> Prm_session created");

    Proxy::Pram_connection pram;
    PDBG("Pram_connection established -> Pram_session created");

    pram.ref_account(env()->ram_session_cap());
    PDBG("Own ram_session is now ref_account of the pram_session");

    env()->ram_session()->transfer_quota(pram.ram_cap(), 32*1024);
    PDBG("Quota transfered");

    Ram_dataspace_capability ds = pram.alloc(4096);
    PDBG("Dataspace allocated");

    void *addr = prm.attach(ds);
    PDBG("Dataspace attached to Prm_session");

    prm.detach(addr);
    PDBG("Pram dataspace detached from Prm_session");

    pram.free(ds);
    PDBG("Dataspace freed");

}


no problem occurs.

Here are some parts of my code. Could you take a look at it ? I will try your advice with the kernel debug.



Pram_session_component *_create_session(const char *args)            from Pram_root
            {
                Genode::size_t ram_quota = Genode::Arg_string::find_arg(args, "ram_quota").ulong_value(0);

                enum { MAX_LABEL_LEN = 64 };
                char label[MAX_LABEL_LEN];
                Genode::Arg_string::find_arg(args, "label").string(label, ~0UL, "");

                unsigned long phys_start     = Genode::Arg_string::find_arg(args, "size").ulong_value(~0UL);
                unsigned long phys_size        = Genode::Arg_string::find_arg(args, "start").ulong_value(~0UL);

                PDBG("Creating Pram_session_component...");                      
                return new (md_alloc()) Pram_session_component(_ds_ep, ep(), md_alloc(), ram_quota,
                                                                (char *)label, phys_start, phys_size);
            }


__________________________________________________________________________________________________________________


class Pram_session_component : public Genode::Rpc_object<Pram_session>
    {
        private:

            using Ds_slab = Genode::Synced_allocator<Genode::Tslab<Pdataspace_component, 4096> >;

            Genode::Rpc_entrypoint *_ds_ep;
            Genode::Rpc_entrypoint *_pram_session_ep;

            Genode::Allocator_guard _md_alloc;
            Ds_slab _ds_alloc;

            Genode::Ram_connection _ram;

            const char* _label;
            unsigned long _phys_start;
            unsigned long _phys_size;


            . . .

    }


__________________________________________________________________________________________________________________


Pram_session_component::Pram_session_component(Genode::Rpc_entrypoint *ds_ep,
                                                Genode::Rpc_entrypoint *pram_session_ep,
                                                Genode::Allocator *md_alloc, Genode::size_t ram_quota,
                                                const char *label, unsigned long phys_start, unsigned long phys_size)
: _ds_ep(ds_ep), _pram_session_ep(pram_session_ep),
    _md_alloc(md_alloc, ram_quota), _ds_alloc(&_md_alloc),
    _ram(label, phys_start, phys_size), _label(label),
    _phys_start(phys_start), _phys_size(phys_size) { }


Thank you in advance.


Regards,

David