Skip to content

Add extended shared memory attach structure

Demi Marie Obenour requested to merge DemiMarie/xserver:extended-shm into master

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

  1. The size of the mapping, in bytes.
  2. The offset that should be passed to mmap, in bytes.

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.

Edited by Demi Marie Obenour

Merge request reports