diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/memfd.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/memfd.h b/include/linux/memfd.h index c159e40e3f34..272479317cf1 100644 --- a/include/linux/memfd.h +++ b/include/linux/memfd.h @@ -2,10 +2,19 @@ #ifndef __LINUX_MEMFD_H #define __LINUX_MEMFD_H +#include <linux/fcntl.h> #include <linux/file.h> #define MEMFD_ANON_NAME "[memfd]" +static inline int memfd_check_seals_mode(unsigned int seals, umode_t old_mode, + umode_t new_mode) +{ + if ((seals & F_SEAL_EXEC) && ((old_mode ^ new_mode) & 0111)) + return -EPERM; + return 0; +} + #ifdef CONFIG_MEMFD_CREATE extern long memfd_fcntl(struct file *file, unsigned int cmd, unsigned int arg); struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx); |
