diff options
author | Timm Bäder <mail@baedert.org> | 2018-10-10 11:12:03 +0000 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2018-10-10 11:12:03 +0000 |
commit | 48e88c6ea40e9f89b5b12617094d3025ec089b4f (patch) | |
tree | be5f21b08d78bf2bc03ef2fe57a6639cf9dd22e5 | |
parent | 50c63fc39a524d44f44cd67f5100064778ba5d07 (diff) | |
parent | e9a67cc6d03012f3210d36d96dae9227825b0ce6 (diff) | |
download | gtk+-48e88c6ea40e9f89b5b12617094d3025ec089b4f.tar.gz |
Merge branch 'file-sealing' into 'master'
gdk: seal in-memory files when possible
See merge request GNOME/gtk!353
-rw-r--r-- | gdk/wayland/gdkdisplay-wayland.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 712112b565..7bcf18ca30 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -1207,13 +1207,21 @@ open_shared_memory (void) #if defined (__NR_memfd_create) if (!force_shm_open) { - ret = syscall (__NR_memfd_create, "gdk-wayland", MFD_CLOEXEC); + int options = MFD_CLOEXEC; +#if defined (MFD_ALLOW_SEALING) + options |= MFD_ALLOW_SEALING; +#endif + ret = syscall (__NR_memfd_create, "gdk-wayland", options); /* fall back to shm_open until debian stops shipping 3.16 kernel * See bug 766341 */ if (ret < 0 && errno == ENOSYS) force_shm_open = TRUE; +#if defined (F_ADD_SEALS) && defined (F_SEAL_SHRINK) + if (ret >= 0) + fcntl (ret, F_ADD_SEALS, F_SEAL_SHRINK); +#endif } #endif |