path: root/arch
diff options
authorDavid Herrmann <>2014-08-08 21:25:29 (GMT)
committerMaciej Wereski <>2014-12-29 08:31:35 (GMT)
commit5ea1e3301b22ca848fd1bf21dff65f0abe10e624 (patch)
tree9192c185297c6a4407959c36e8e42ddf1bb28753 /arch
parent57ad118090f109ea3338869cef66150cc2a9550f (diff)
shm: add memfd_create() syscallrefs/changes/06/32906/1
memfd_create() is similar to mmap(MAP_ANON), but returns a file-descriptor that you can pass to mmap(). It can support sealing and avoids any connection to user-visible mount-points. Thus, it's not subject to quotas on mounted file-systems, but can be used like malloc()'ed memory, but with a file-descriptor to it. memfd_create() returns the raw shmem file, so calls like ftruncate() can be used to modify the underlying inode. Also calls like fstat() will return proper information and mark the file as regular file. If you want sealing, you can specify MFD_ALLOW_SEALING. Otherwise, sealing is not supported (like on all other regular files). Compared to O_TMPFILE, it does not require a tmpfs mount-point and is not subject to a filesystem size limit. It is still properly accounted to memcg limits, though, and to the same overcommit or no-overcommit accounting as all user memory. Signed-off-by: David Herrmann <> Acked-by: Hugh Dickins <> Cc: Michael Kerrisk <> Cc: Ryan Lortie <> Cc: Lennart Poettering <> Cc: Daniel Mack <> Cc: Andy Lutomirski <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <> Change-Id: I2ac7e2b47a1d68d4b83680f4527e5ed2aa9a420c Origin: Backported-by: Maciej Wereski <> Signed-off-by: Maciej Wereski <>
Diffstat (limited to 'arch')
2 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index aabfb83..a56149e 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -357,3 +357,4 @@
348 i386 process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
349 i386 kcmp sys_kcmp
350 i386 finit_module sys_finit_module
+356 i386 memfd_create sys_memfd_create
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index 63a8993..db53911 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -320,6 +320,7 @@
311 64 process_vm_writev sys_process_vm_writev
312 common kcmp sys_kcmp
313 common finit_module sys_finit_module
+319 common memfd_create sys_memfd_create
# x32-specific system call numbers start at 512 to avoid cache impact