From: Vibhav Pant vibhavp@gmail.com
--- server/mapping.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/server/mapping.c b/server/mapping.c index 6b239e11807..a2958629c4d 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -30,6 +30,9 @@ #include <sys/stat.h> #include <sys/mman.h> #include <unistd.h> +#ifdef __linux__ +#include <linux/memfd.h> +#endif
#include "ntstatus.h" #define WIN32_NO_STATUS @@ -341,6 +344,10 @@ static int create_memfd( ULONG file_access, ULONG sec_flags, file_pos_t size ) unsigned int memfd_flags = MFD_ALLOW_SEALING; unsigned int seal_flags = F_SEAL_SEAL | F_SEAL_WRITE;
+#ifdef MFD_EXEC + memfd_flags |= MFD_EXEC; +#endif + make_memfd_name( NULL, sec_flags, memfd_name );
if (sec_flags & SEC_LARGE_PAGES) @@ -357,7 +364,6 @@ static int create_memfd( ULONG file_access, ULONG sec_flags, file_pos_t size ) fd = memfd_create( memfd_name, memfd_flags & ~MFD_HUGETLB ); if (fd == -1) { - file_set_error(); return -1; } }