Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753482AbcLKM6T (ORCPT ); Sun, 11 Dec 2016 07:58:19 -0500 Received: from mail-bl2nam02on0087.outbound.protection.outlook.com ([104.47.38.87]:48236 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753152AbcLKM6R (ORCPT ); Sun, 11 Dec 2016 07:58:17 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov CC: Yury Norov , Arnd Bergmann , "Dr. Philipp Tomsich" , Catalin Marinas , , , LKML , , , , "Joseph S. Myers" , , "Kapoor, Prasun" , Alexander Graf , , , , Andrew Pinski , , Alexey Klimov , , "Zhangjian (Bamvor)" , linux-arm-kernel , Maxim Kuvyrkov , Nathan Lynch , Martin Schwidefsky , , Subject: [PATCH 2/3] sys_mmap64() Date: Sun, 11 Dec 2016 18:26:41 +0530 Message-ID: <1481461003-14361-3-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481461003-14361-1-git-send-email-ynorov@caviumnetworks.com> References: <1481461003-14361-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.125.246.42] X-ClientProxiedBy: HE1PR0802CA0004.eurprd08.prod.outlook.com (10.172.123.142) To CY1PR07MB2247.namprd07.prod.outlook.com (10.164.112.149) X-MS-Office365-Filtering-Correlation-Id: b275446a-2a04-44b9-dcac-08d421c55e61 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2247; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2247;3:GmGGVsFLe8EPeMscJ1puu5fGgQyxU8/y3c2wc7fg6+fXxTrFdlI63SN1WnmtH1cEvBkQg8YSb7dUJv4ubFU9QWS5JUpCcTXyd8fSo7/HWbC7tYj0HYrWKBVB7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88wcM4ZnQECN8AnTCgasCq6N+MC2HiuO3gvUcGsEacB+tD6S6QArn5zyVNt9ex7Y+Qjj01zOophk6cvE04T+P/3UxPPn8oJBgWHR+KAmpe3sDyoYIRI7iBCt4o6K6dHP7knoHf1VGsn6VCuMtNH6HurKGRSj3JxFZFykY8UmVy+gcvKrtHAH8jRxEfNzrr4C3yyBYGyG5up6AUQozVQhY+OVaR3wTjMNBvhiamyBJReErs3KeyH85zuzuJ+qxeHRu0xoLabkJvpsnGMS0jIiZSukckfJOXDiy4baSSW5scwikYYWEEtSmcVIq55AeLfhqEr3bRnahPC4QNBOTvCfdNX7iDCde5roexqomps8F1PBaFoW02e5vFmetsWpvJJbcQ0XzW+CVtbdxNWlvhR+GgFeF7SVDEkZ2SN6cMJhN/w++xP+iJSSbR11EzlR6jx3osXpGWmf2z2QzCYQ089vgLyuPP/PCtT/WVSHjabg8BZ7+rqeEbJ9k= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(6072148);SRVR:CY1PR07MB2247;BCL:0;PCL:0;RULEID:;SRVR:CY1PR07MB2247; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2247;4:My/xq5BW2DyCpjV75pZXhb7ROVfZ6LmiGH+MUA1Ae9bAGoeg7wqLB8hV16sHndVto9oeUnJhZEiRM9CmfznIUweBRDmE70oom+Nz/7Fh+RZZs1KdpXKYr7zN4DzYlOGeJG3f0JZ0MShkLpwgI5oMNw7rZqnAZl4N1DajsW8FtUvfjDLW368H+RFODmx3xvnyZbaqX0V/T9MJbXncr+PM4nBtb2EixWjEHCgX0kpA4sgDS/xyFUAKjDAT2gr8th/UK8yjnbIZpJ9aIjhpiUpid9QV3D2XhSFx9yZMPb/+8ohR8pJjzz5GqCcM7j+xRCT952MnGh++QcV/P97UPrnWj6fpDqamd5JSClB/12AS0d5zsNidlppQJPrqW1L74finlP+B9KeS+B7HiSGFQEUfmF+W7a6566JqI4Iyp3Doje9KGa+fxh7lIx4TG0laJAZEBr47KIXJ8uCLX9Rw7GqOaG/CqeXOjxtUeLZJoHWmNZetahZwtmNGz2F6dGm0GputBUAf6S33p92mjvEnSomrASWJztsdfEVwASsE44/ueEeo9xyaW+VifB1iVxN//Ed1McQIyX2Kk9qJpTAP7EBwcA== X-Forefront-PRVS: 0153A8321A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(39840400002)(39410400002)(189002)(199003)(39060400001)(4326007)(50226002)(7416002)(101416001)(1671002)(305945005)(50986999)(76176999)(7736002)(97736004)(81166006)(42186005)(109986004)(6496003)(5660300001)(6486002)(5009440100003)(81156014)(105586002)(8676002)(2906002)(47776003)(2950100002)(76506005)(6666003)(110136003)(106356001)(48376002)(36756003)(189998001)(68736007)(92566002)(3846002)(66066001)(50466002)(5003940100001)(6116002)(33646002)(38730400001)(266003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2247;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2247;23:qiw+beOfODcyfuDpwNd6HegGtsVXkOl4aFeBK67Xc?= =?us-ascii?Q?ZRPhRk/QrjS5Fb64De9jlGFkd4t0hjcqYw1SOR+z15vrj/WMV4ni/9db/QTK?= =?us-ascii?Q?9cDhVyI/tikP2s6EmKTJWQjtBxBjQNETyAmzxEXciiOxkeaT6GdcFWFqc94E?= =?us-ascii?Q?EklvfCnDM1HTSmVyYf9SB99AVsYCxntZ8Ee7Nw3gANav1MSXtM7fs9FfhnDZ?= =?us-ascii?Q?xpp4m1PSWjHjPdyqUbXg/Gx8IGUzYbUefdiCofnDb6n09k/vGpjYorKWUB1C?= =?us-ascii?Q?Pe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MdTU1WdTByfOo?= =?us-ascii?Q?FrmPVakvSm2Q4/cOS8DE+m9auRtIVIe9qMOuTHk3XfJqTpfRbPidH4rXw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2247;6:UDP7DqNf+gvGrdYaPhjbSeSc++QvHc/wVuE+LTP8HnqEz2WXnxsgy86cxM0xjz/vb/y61sSH8lO+oloO4VL08D8a5Swk+sOMnlXMq6T4thPvonGS0bS7YSuwxNlCcYqCliKt7CxAVDPOwpcWgDdLYFJtSnHvTqUuQRZ/TVHF2vgOZWXR5fyJLKDFrjDIkEpE4B53YNKu96PLpyA4E757SDnHevP9yqb3LMvK7GRc5Hk+TJz/Kx9WEGsx8HddNlphVh3aQKMlSkAYVOhvvZQgoISAoVprbNRv1U13axNEZIpTf82h3vb6KNzbznAilrdQDuYfmOtNOb3j1/MMoFodBg/GcNq96uO4W3oqKVAhsufBw1CpV2YvsVIohRRbcZOPpWI6QXtz5kvdWpNC8gro6g8Pma7AEZ6B3eopFsh+yes=;5:pXiB9wLT27H3uladOme+j5gXm6Kre/HB9WZr+WjOrxyL754RwfYHiVOVvaMCAJXwD/2D/e6tthMhHM5eLaaOz/CEBe/HYLYecZoIGjHjm480aiyTlvg5qgY9N6k+9uCQNfLtF84IdTSX7p6JIvaJOywOnvglFf4R6+njaRx51kE=;24:jcXiqZh22lrY0PBbSCV2VNeGAn8quAnscwhUoYhap2oA2eTgjkgHgx4lgzbyrEzVcBaEou83VPWdzj2JVPE/VOs/MUzlbwQDg2TB4LXSHM8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2247;7:99XEvsQtrGIKkImb5ObYZp1AcWvW07uCS6MIEaQwk1u5440xIDnomlu5jFBiGiKqzfhsCY6qI3WkJzCi/AeYyjKMax4IrU+jexuQpfzADJNhTPOIwpEmIiypeaq+dlw2Sn910jI8ZsCdCzQWFhSdMxfvE4oRdQ7gJMD8L8Xi48s7CWMhub39xoyZKa3N0MQfM+T8LUoWSNm+v1b6KmXFCse4bSTo4gOkjqcoaBm51o3VRZ3isbecR1ETZ7nz1WY+gZhiigIA6jHeEbDBy3JJluH9aXp2Tov7DyWQENFTWfT2zBNjLLstD2VOMPrfR5rTOMEq/6xFvCVoanrPY5SEFMwdg0bO8IFgG7rA0LqWR/c+YPyQrEa7iTExNnwHbyKW8Qc0zwvhlDjj8IBFIqItYu5gt+iHRKiJr15WC7wKxyEqSITBHAE8KTgbGGV0xagXc/DVAR0Mq7b9tpDionC5ow== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2016 12:58:11.8579 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2247 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2549 Lines: 76 Signed-off-by: Yury Norov --- 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