moving file descriptor passing into a header

Lennart Poettering mzqohf at 0pointer.de
Tue Apr 13 16:29:55 PDT 2010


On Wed, 14.04.10 01:19, Marcus Brinkmann (marcus.brinkmann at ruhr-uni-bochum.de) wrote:

> >This is about passing any kind of fds (files, sockets of all kinds,
> >device handles, fs fifosq, socketpair(), pipe(), inotify(), epoll() --
> >whatever kind of fd your OS supports) . And yes, this is not portable
> >beyond Unix. That's why the type is called DBUS_TYPE_UNIX_FD, not
> >DBUS_TYPE_FILE or so.
> 
> As far as compatibility is concerned, many systems provide such a
> mechanism for their type of canonical descriptor (or handle), in
> some way or another, although implementation details differ.  I am
> not sure if all Unix systems provide it, though, 

All major Unix systems do support this these days in some way or
another.

> and implementation across Unix varied considerably (although it may
> have converged by now, or it's just that there are less relevant Unix
> target platforms today).

Hey, isn't it nice that D-Bus can abstract all that for you?

> The underlying principle is certainly an important part of any
> capability-based communication facility, however, in my
> understanding, the dbus design does not aim for that title, so I am
> not sure the analogy applies well here.  There is an important
> difference between capability systems and Unix fds on the one hand
> and DBus on the other hand: In the former, descriptors passed
> through descriptors are still subject to the same policies and
> access rules as the descriptors they are passed through, ie they
> belong to the same class of objects.  Unix FDs passed through a DBus
> connection however are not subject to DBus policies and controls.
> This may complicate reasoning about the implications of allowing
> such desciptor passing (I am not familiar with the design enough to
> say if this is a valid concern or not).

D-Bus is not really useful for anything but the most trivial policies.

SELinux knows about them. And that's where you can control things more
finegrained.

> This has little to do with windows vs unix though: A unix fd on one
> system can also not be passed to another unix system, as there is no
> network transparency at the unix kernel level for this feature.

Sure. But nobody would even try that, so this doesn't matter!

> By the way: Windows can pass HANDLEs (the underlying descriptor
> object) from one process to another just fine, although again the
> details of the mechanism are somewhat different.  As an example for
> a system which does not provide this facility: Windows CE is a very
> restricted platform and fails to implement inter-process HANDLE
> passing.

Ah, nice, so I invite you to implement DBUS_TYPE_WIN32_HANLDE akin to
DBUS_UNIX_FD!

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the dbus mailing list