]> www.infradead.org Git - users/willy/linux.git/commitdiff
mshare: Add new system call
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 10 Aug 2020 12:51:44 +0000 (08:51 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 10 Aug 2020 12:51:44 +0000 (08:51 -0400)
[wired up x86-64 only, fix before submission]

Almost no implementation here; just return a file descriptor that can't
actually do anything.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
arch/x86/entry/syscalls/syscall_64.tbl
include/uapi/asm-generic/unistd.h
mm/Makefile
mm/mshare.c [new file with mode: 0644]

index 78847b32e1370f56f273020e64a36e0a054bded4..05abbdc34a1043cb4ad008d0af6b6730218568a6 100644 (file)
 437    common  openat2                 sys_openat2
 438    common  pidfd_getfd             sys_pidfd_getfd
 439    common  faccessat2              sys_faccessat2
+449    common  mshare                  sys_mshare
 
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
index f4a01305d9a65c14fe46652970ec3195a8bce61c..69bed18e23f5fa7a43d0a221ab4c0cefec683d3a 100644 (file)
@@ -859,7 +859,7 @@ __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd)
 __SYSCALL(__NR_faccessat2, sys_faccessat2)
 
 #undef __NR_syscalls
-#define __NR_syscalls 440
+#define __NR_syscalls 450
 
 /*
  * 32 bit systems traditionally used different
index 6e9d46b2efc9a0e4bd4094d6de667758bdc229d7..01a75d90d3529ac4dc76bc0028b24942c8ed473f 100644 (file)
@@ -35,7 +35,7 @@ CFLAGS_init-mm.o += $(call cc-disable-warning, override-init)
 CFLAGS_init-mm.o += $(call cc-disable-warning, initializer-overrides)
 
 mmu-y                  := nommu.o
-mmu-$(CONFIG_MMU)      := highmem.o memory.o mincore.o \
+mmu-$(CONFIG_MMU)      := highmem.o memory.o mincore.o mshare.o \
                           mlock.o mmap.o mmu_gather.o mprotect.o mremap.o \
                           msync.o page_vma_mapped.o pagewalk.o \
                           pgtable-generic.o rmap.o vmalloc.o
diff --git a/mm/mshare.c b/mm/mshare.c
new file mode 100644 (file)
index 0000000..72af826
--- /dev/null
@@ -0,0 +1,19 @@
+#include <linux/anon_inodes.h>
+#include <linux/fs.h>
+#include <linux/syscalls.h>
+
+static const struct file_operations mshare_fops = {
+};
+
+SYSCALL_DEFINE3(mshare, unsigned long, addr, unsigned long, len,
+               unsigned long, flags)
+{
+       int fd;
+
+       if ((addr | len) & (PGDIR_SIZE - 1))
+               return -EINVAL;
+
+       fd = anon_inode_getfd("mshare", &mshare_fops, NULL, O_RDWR);
+
+       return fd;
+}