treewide: memfd_create: use exec flags

Use the flags MEMFD_EXEC or MEMFD_NOEXEC_SEAL as applicable.

These warnings instruct the kernel wether the memfd is executable or
not.

Without specifying those flags the kernel will emit the following
warning since version 6.3,
commit 105ff5339f49 ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC"):

    kernel: memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=1 'systemd'
This commit is contained in:
Thomas Weißschuh
2023-03-15 01:18:59 +00:00
parent ad62530ebb
commit c29715a8f7
4 changed files with 20 additions and 11 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ int memfd_new(const char *name) {
}
}
return RET_NERRNO(memfd_create(name, MFD_ALLOW_SEALING | MFD_CLOEXEC));
return memfd_create_wrapper(name, MFD_ALLOW_SEALING | MFD_CLOEXEC | MFD_NOEXEC_SEAL);
}
int memfd_map(int fd, uint64_t offset, size_t size, void **p) {