]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
arch, mm: wire up memfd_secret system call where relevant
authorMike Rapoport <rppt@linux.ibm.com>
Thu, 31 Dec 2020 22:05:06 +0000 (22:05 +0000)
committerJohannes Weiner <hannes@cmpxchg.org>
Thu, 31 Dec 2020 22:05:06 +0000 (22:05 +0000)
Wire up memfd_secret system call on architectures that define
ARCH_HAS_SET_DIRECT_MAP, namely arm64, risc-v and x86.

Link: https://lkml.kernel.org/r/20201203062949.5484-10-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christopher Lameter <cl@linux.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Cc: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Roman Gushchin <guro@fb.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tycho Andersen <tycho@tycho.ws>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/arm64/include/uapi/asm/unistd.h
arch/riscv/include/asm/unistd.h
arch/x86/entry/syscalls/syscall_32.tbl
arch/x86/entry/syscalls/syscall_64.tbl
include/linux/syscalls.h
mm/secretmem.c
scripts/checksyscalls.sh

index f83a70e07df85ca5029a1e91cde93b8e0dd9fb7e..ce2ee8f1e361091e462cd658257709bf09fc9c84 100644 (file)
@@ -20,5 +20,6 @@
 #define __ARCH_WANT_SET_GET_RLIMIT
 #define __ARCH_WANT_TIME32_SYSCALLS
 #define __ARCH_WANT_SYS_CLONE3
+#define __ARCH_WANT_MEMFD_SECRET
 
 #include <asm-generic/unistd.h>
index 977ee6181dabf4801725767e55af92336915a3f5..6c316093a1e59457b0e03d5493cc02a65b50801c 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #define __ARCH_WANT_SYS_CLONE
+#define __ARCH_WANT_MEMFD_SECRET
 
 #include <uapi/asm/unistd.h>
 
index 02a349afaf9c3705602fc67afcbd100b53e96a70..a1578cdf6d91bae87b6b367467bedd42263b6f61 100644 (file)
 440    i386    process_madvise         sys_process_madvise
 441    i386    epoll_pwait2            sys_epoll_pwait2                compat_sys_epoll_pwait2
 442    i386    watch_mount             sys_watch_mount
+443    i386    memfd_secret            sys_memfd_secret
index d9bcc4e02588911d3a3c2e642b225415e304e4b9..d8ecd9df0942c85a34b2f9f09ddce831857563a7 100644 (file)
 440    common  process_madvise         sys_process_madvise
 441    common  epoll_pwait2            sys_epoll_pwait2
 442    common  watch_mount             sys_watch_mount
+443    common  memfd_secret            sys_memfd_secret
 
 #
 # Due to a historical design error, certain syscalls are numbered differently
index e2828e03fd98d120ace0e99a11e1faac97261507..fb040fc0f94082c5b8f0ce518e9ec65b42e08ba1 100644 (file)
@@ -1015,6 +1015,7 @@ asmlinkage long sys_pidfd_send_signal(int pidfd, int sig,
 asmlinkage long sys_pidfd_getfd(int pidfd, int fd, unsigned int flags);
 asmlinkage long sys_watch_mount(int dfd, const char __user *path,
                                unsigned int at_flags, int watch_fd, int watch_id);
+asmlinkage long sys_memfd_secret(unsigned long flags);
 
 /*
  * Architecture-specific system calls
index 7236f4d9458ada910443c2f982642cd711a8040b..b8a32954ac68cc009cee44437d2a94e1243200e0 100644 (file)
@@ -415,6 +415,9 @@ static int __init secretmem_setup(char *str)
        unsigned long reserved_size;
        int err;
 
+       if (!can_set_direct_map())
+               return 0;
+
        reserved_size = memparse(str, NULL);
        if (!reserved_size)
                return 0;
index a18b47695f55f1521569884c56ba6864558a1e4c..b7609958ee3640b53f025f0010366b6f24958e0c 100755 (executable)
@@ -40,6 +40,10 @@ cat << EOF
 #define __IGNORE_setrlimit     /* setrlimit */
 #endif
 
+#ifndef __ARCH_WANT_MEMFD_SECRET
+#define __IGNORE_memfd_secret
+#endif
+
 /* Missing flags argument */
 #define __IGNORE_renameat      /* renameat2 */