Skip to content

Add extended shared memory attach structure

Demi Marie Obenour requested to merge DemiMarie/xcbproto:shm-ext into master

This provides an extended version of X_ShmAttachFd, called X_ShmAttachFdExt, which allows the client to specify three additional parameters:

  1. The size of the mapping, in bytes.
  2. The offset that should be passed to mmap, in bytes.
  3. The number of bytes at the start of the mapping that the X11 server should not consider to be part of the drawable.

The intended use-case for this extension is when one needs to map a drawable from a character special device, but it can also be used with regular files if one needs to map with a nonzero offset. Qubes OS needs the X server to map the /dev/xen/gntdev character device, which represents memory shared from a different virtual machine. This is currently accomplished with an LD_PRELOAD’d shared library that overrides shmat, shmctl, and shmdt, and I have written a version that instead overrides fstat and mmap. With this extension, the preloaded shared library will not be required.

Merge request reports