SIGBUS on wl_shm clients (Re: Newest git version of Wayland is even worse)

Pekka Paalanen ppaalanen at gmail.com
Mon Dec 10 00:08:01 PST 2012


On Sun, 09 Dec 2012 16:50:54 -0800
Bill Spitzak <spitzak at gmail.com> wrote:

> Another question: I thought XDG_RUNTIME_DIR was being used for the locks 
> and sockets and other status indicators. I expected large shm buffers to 
> go to some more-standard place (though I don't know what the Linux 
> standard is). I certainly was suprised to find that XDG_RUNTIME_DIR has 
> such a major effect on behavior.
> 
> What is the standard location that a Linux desktop application that 
> wants to allocate a large shm buffer use? Perhaps Wayland apps should 
> use that, too.

The requirements for shm buffers are basically:
- have an fd associated, so secure buffer passing works
- is not backed by a disk or such, must be just memory (swapping is ok)
- is automatically released, when all fds are closed and mmaps gone,
  e.g. due to process crash
- accessible only to the user who created it, on the fs level

I know /dev/zero does not work for buffer passing, and /dev/null does
not work at all.

There is POSIX shared memory (shm_overview(7)), though, maybe we could
use it, and fall back to XDG_RUNTIME_DIR. Does anyone remember a reason
for not using POSIX shm?

Android didn't have POSIX shm, but they can fall back to
XDG_RUNTIME_DIR. IIRC Raspberry Pi did not have a separate tmpfs
for /dev/shm, it was all just /dev.

Do not confuse with System V SHM.


Thanks,
pq


More information about the wayland-devel mailing list