lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1481461003-14361-3-git-send-email-ynorov@caviumnetworks.com>
Date:   Sun, 11 Dec 2016 18:26:41 +0530
From:   Yury Norov <ynorov@...iumnetworks.com>
To:     unlisted-recipients:; (no To-header on input)
CC:     Yury Norov <ynorov@...iumnetworks.com>,
        Arnd Bergmann <arnd@...db.de>,
        "Dr. Philipp Tomsich" <philipp.tomsich@...obroma-systems.com>,
        Catalin Marinas <catalin.marinas@....com>,
        <libc-alpha@...rceware.org>, <linux-arch@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>, <szabolcs.nagy@....com>,
        <heiko.carstens@...ibm.com>, <cmetcalf@...hip.com>,
        "Joseph S. Myers" <joseph@...esourcery.com>,
        <zhouchengming1@...wei.com>,
        "Kapoor, Prasun" <Prasun.Kapoor@...iumnetworks.com>,
        Alexander Graf <agraf@...e.de>, <geert@...ux-m68k.org>,
        <kilobyte@...band.pl>, <manuel.montezelo@...il.com>,
        Andrew Pinski <pinskia@...il.com>, <linyongting@...wei.com>,
        Alexey Klimov <klimov.linux@...il.com>, <broonie@...nel.org>,
        "Zhangjian (Bamvor)" <bamvor.zhangjian@...wei.com>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        Maxim Kuvyrkov <maxim.kuvyrkov@...aro.org>,
        Nathan Lynch <Nathan_Lynch@...tor.com>,
        Martin Schwidefsky <schwidefsky@...ibm.com>,
        <davem@...emloft.net>, <christoph.muellner@...obroma-systems.com>
Subject: [PATCH 2/3] sys_mmap64()

Signed-off-by: Yury Norov <ynorov@...iumnetworks.com>
---
 include/linux/syscalls.h          |  3 +++
 include/uapi/asm-generic/unistd.h |  4 +++-
 mm/mmap.c                         | 25 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 91a740f..869ca76 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -857,6 +857,9 @@ asmlinkage long sys_perf_event_open(
 asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
 			unsigned long prot, unsigned long flags,
 			unsigned long fd, unsigned long pgoff);
+asmlinkage long sys_mmap64(unsigned long addr, unsigned long len,
+			unsigned long prot, unsigned long flags,
+			unsigned long fd, unsigned long long *offset);
 asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg);
 asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name,
 				      struct file_handle __user *handle,
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index d65e232..f9ca919 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -734,9 +734,11 @@ __SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect)
 __SYSCALL(__NR_pkey_alloc,    sys_pkey_alloc)
 #define __NR_pkey_free 290
 __SYSCALL(__NR_pkey_free,     sys_pkey_free)
+#define __NR_mmap64 291
+__SYSCALL(__NR_mmap64, sys_mmap64)
 
 #undef __NR_syscalls
-#define __NR_syscalls 291
+#define __NR_syscalls 292
 
 /*
  * All syscalls below here should go away really,
diff --git a/mm/mmap.c b/mm/mmap.c
index fc1c943..6c6b95a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1504,6 +1504,31 @@ static int mmap_pgoff_prepare(struct file **f, unsigned long *l,
 	return 0;
 }
 
+SYSCALL_DEFINE6(mmap64, unsigned long, addr, unsigned long, len,
+		unsigned long, prot, unsigned long, flags,
+		unsigned long, fd, unsigned long long __user *, offset)
+{
+	int err;
+	unsigned long long koffset;
+	unsigned long retval;
+	struct file *file = NULL;
+
+	if (copy_from_user(&koffset, offset, sizeof(koffset)))
+		return -EFAULT;
+	if (offset_in_page(koffset))
+		return -EINVAL;
+
+	err = mmap_pgoff_prepare(&file, &len, &flags, fd);
+	if (err)
+		return err;
+
+	retval = vm_mmap_pgoff(file, addr, len, prot,
+			flags, koffset >> PAGE_SHIFT);
+	if (file)
+		fput(file);
+	return retval;
+}
+
 SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
 		unsigned long, prot, unsigned long, flags,
 		unsigned long, fd, unsigned long, pgoff)
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ