Re: Problem with setting up namespaces
Tobias Stumpf <[email protected]>
| Newsgroups | gmane.comp.micro-kernel.l4.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Johannes, I extended Björns example, see attachment. Now a trusted app creates the IPC gate, which can be used for client-server communication. To try the example you have to use the attached patch. Best regards, Tobias On Thu, 2013-07-18 at 21:00 +0200, Johannes Schlatow wrote: > Thanks Björn. > > The problem I have is not lua specific though. I was not only trying to > pass the client capability via namespaces (which works perfectly as you > just demonstrated) but also to register the server capability of an > ipc_gate to the server's namespace. > > Basically, I don't want the server to create the ipc_gate by itself. > Instead I have another (trusted) application that has access to both > namespaces (i.e. the one of the server and the one of the client). This > application creates the ipc_gate and registers its capability with > appropriate rights to the corresponding namespaces. > > The lua config I sent initially was just my approach to reproduce this > problem without posting too much of my code and to minimize the PEBKAC > factor ;) > > Johannes > > On Thu, 18 Jul 2013 18:53:37 +0200 > Björn Döbel <[email protected]> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Hi Johannes, > > > > >> Well, I want to provide capabilities for an application by > > >> putting them into a local namespace. Since our system changes > > >> dynamically I want to add capabilities at runtime by registering > > >> them to the corresponding namespace. > > > > please find attached the clntsrv example adapted to use namespaces. > > The general approach is: > > > > 1) In the Lua config create an empty namespace and make it accessible > > to your application(s). Note that the example also uses different > > access rights for client and server. > > > > 2) On the server side I use the object registry's register_object() > > function, which internally creates an IPC gate and binds the > > calling thread to it. Then I use the namespace's register_object() > > call to make the new channel externally visible. > > > > 3) In the client I query for the object name. This call blocks until > > the server has registered the new channel. > > > > Apart from these steps, client and server implementation are identical > > to the original example. > > > > Regarding your approach of putting a channel into the namespace within > > the Lua config file: This does not work for me. We are still trying to > > figure out, why. It's probably indeed be related to the downgrading as > > suggested by Christian. > > > > Bjoern > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.12 (GNU/Linux) > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > > > iEYEARECAAYFAlHoHZAACgkQP5ijxgQLUNlt0wCfX3qShBjEXdXvaXGmVtbk5IgG > > Ys8An2vS/Uqj5qrFyKVxFAvGBB0BgtE0 > > =0Qez > > -----END PGP SIGNATURE----- > > > _______________________________________________ > l4-hackers mailing list > [email protected] > http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers _______________________________________________ l4-hackers mailing list [email protected] http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
ns.patch
(text/x-patch, 1.2 KB)
Index: pkg/l4re/util/libs/name_space_svr.cc
===================================================================
--- pkg/l4re/util/libs/name_space_svr.cc (revision 42493)
+++ pkg/l4re/util/libs/name_space_svr.cc (working copy)
@@ -164,7 +164,7 @@
if (n->obj()->is_rw()) flags |= L4_FPAGE_RX;
if (n->obj()->is_strong()) flags |= L4_FPAGE_RW;
- ios << L4::Ipc::Snd_fpage(n->obj()->cap().fpage(flags));
+ ios << L4::Ipc::Snd_fpage(n->obj()->cap(), flags );
_dbg.printf(" result = %lx flgs=%x strg=%d\n",
result, flags, (int)n->obj()->is_strong());
return result;
Index: include/impl/namespace_impl.h
===================================================================
--- pkg/l4re/include/impl/namespace_impl.h (revision 42493)
+++ pkg/l4re/include/impl/namespace_impl.h (working copy)
@@ -128,7 +128,7 @@
io << L4::Opcode(L4Re::Namespace_::Register)
<< flags << L4::Ipc::Buf_cp_out<char const>(name, strlen(name));
if (o.is_valid())
- io << L4::Ipc::Snd_fpage(o.fpage(L4_FPAGE_RWX & flags));
+ io << L4::Ipc::Snd_fpage(o, L4_FPAGE_RWX & flags) ;
l4_msgtag_t res = io.call(cap(), L4Re::Protocol::Namespace);
return l4_error(res);
}
clntsrv_ML.tbz
(application/x-bzip-compressed-tar, 3.1 KB) - not displayed