From: Matthew Wilcox (Oracle) Date: Mon, 10 Aug 2020 12:51:44 +0000 (-0400) Subject: mshare: Add new system call X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=10b0ae3004c577d0b190c907ee7c0f15a341f27f;p=users%2Fwilly%2Flinux.git mshare: Add new system call [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) --- diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl index 78847b32e137..05abbdc34a10 100644 --- a/arch/x86/entry/syscalls/syscall_64.tbl +++ b/arch/x86/entry/syscalls/syscall_64.tbl @@ -360,6 +360,7 @@ 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 diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index f4a01305d9a6..69bed18e23f5 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -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 diff --git a/mm/Makefile b/mm/Makefile index 6e9d46b2efc9..01a75d90d352 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -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 index 000000000000..72af82683fdb --- /dev/null +++ b/mm/mshare.c @@ -0,0 +1,19 @@ +#include +#include +#include + +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; +}