cursor: Use memfd_create() when available

Graphics / Wayland / Wayland - Emmanuel Gil Peyrot [] - 21 July 2019 09:06 EDT

This (so-far) Linux-only API lets users create file descriptors purely in memory, without any backing file on the filesystem and the race condition which could ensue when unlink()ing it.

It also allows seals to be placed on the file, ensuring to every other process that we won’t be allowed to shrink the contents, potentially causing a SIGBUS when they try reading it.

This patch is best viewed with the -w option of git log -p.

6908c8c cursor: Use memfd_create() when available | 2 +-
cursor/os-compatibility.c | 56 ++++++++++++++++++++++++++++++++++-------------
2 files changed, 42 insertions(+), 16 deletions(-)


  • Share