[PATCH:shmfd 2/2] Use /var/tmp instead of /run/shm on non-linux OS'es

Keith Packard keithp at keithp.com
Tue Nov 12 14:38:20 PST 2013


Mark Kettenis <mark.kettenis at xs4all.nl> writes:

> 1. shm_open(3) is hard to use safely; it pretty much forces you to use
>    mktemp(3) with all its traps.  This is why some people suggested we
>    need shm_mkstemp(3), and Ted Unangst actually implemented this on
>    OpenBSD.  The code under the ISC license, so it shouldn't be an
>    issue to include it in Xorg.

shm_mkstemp sounds like what we want, however, I suspect the real
problem will be choosing a place to stick the temp file. Can we come up
with a list of directories and just pick one at configure time?

And, given that the hard part is the configure piece, I'm wondering how
shm_mkstemp differs from what the code currently does with mkstemp.

> 2. shm_open(3) (and shm_mkstemp(3)) will set the FD_CLOEXEC flag on
>    the file descriptor.  This is actually a good thing, but it means
>    you'll have to unset that flag if you want to share the
>    filedescriptor by doing a fork(2) and exec(2).


> 3. Some systems don't have shm_open(3).  But I guess pretty much all
>    systems that support file descriptor passing using the 4.4BSD
>    interface do support it.  And it's always possible to fall back to
>    code that's more or less equivalent to what we have now.

Using shm_open is just a security disaster; we're definitely not going
to use that.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20131113/aa22910b/attachment.pgp>


More information about the xorg-devel mailing list