From: Paul Gofman <pgofman@codeweavers.com> --- configure.ac | 2 ++ server/mapping.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 77b80ecb395..f63669df192 100644 --- a/configure.ac +++ b/configure.ac @@ -691,6 +691,7 @@ AC_CHECK_HEADERS(\ linux/input.h \ linux/ioctl.h \ linux/major.h \ + linux/memfd.h \ linux/ntsync.h \ linux/param.h \ linux/serial.h \ @@ -2116,6 +2117,7 @@ AC_CHECK_FUNCS(\ getifaddrs \ getrandom \ kqueue \ + memfd_create \ pipe2 \ port_create \ posix_fadvise \ diff --git a/server/mapping.c b/server/mapping.c index 905d528b04f..d7383387b6d 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -29,7 +29,9 @@ #include <sys/stat.h> #include <sys/mman.h> #include <unistd.h> - +#ifdef HAVE_LINUX_MEMFD_H +# include <linux/memfd.h> +#endif #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" @@ -365,6 +367,13 @@ static int create_temp_file( file_pos_t size ) char tmpfn[16]; int fd; +#if defined(HAVE_MEMFD_CREATE) && defined(MFD_EXEC) + if ((fd = memfd_create( "wine-mapping", MFD_EXEC )) != -1) + { + if (grow_file( fd, size )) return fd; + close( fd ); + } +#endif if (temp_dir_fd == -1) { temp_dir_fd = server_dir_fd; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10251