Skip to content

Commit

Permalink
add new flag to suppress harmless kernel warning from memfd_create()
Browse files Browse the repository at this point in the history
  • Loading branch information
ka9q committed Apr 12, 2024
1 parent 586f6a1 commit a1a9d35
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion misc.c
Expand Up @@ -484,7 +484,12 @@ void *mirror_alloc(size_t size){
int fd;

#if __linux__
fd = memfd_create("mirror_alloc",0);
int flags = 0;
// New flag? Not documented on man page but mentioned in kernel warning message, so pass it if defined
#ifdef MFD_NOEXEC_SEAL
flags |= MFD_NOEXEC_SEAL; // not executable and sealed to prevent changing to executable.
#endif
fd = memfd_create("mirror_alloc",flags);
if(fd < 0){
perror("mirror_alloc memfd_create");
munmap(base,size * 2);
Expand Down

0 comments on commit a1a9d35

Please sign in to comment.