Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbcLGKgk (ORCPT ); Wed, 7 Dec 2016 05:36:40 -0500 Received: from mail-sn1nam01on0041.outbound.protection.outlook.com ([104.47.32.41]:51116 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751985AbcLGKgf (ORCPT ); Wed, 7 Dec 2016 05:36:35 -0500 X-Greylist: delayed 101074 seconds by postgrey-1.27 at vger.kernel.org; Wed, 07 Dec 2016 05:35:58 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Date: Wed, 7 Dec 2016 16:04:51 +0530 From: Yury Norov To: Arnd Bergmann CC: , , , Catalin Marinas , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [Question] New mmap64 syscall? Message-ID: <20161207103451.GA869@yury-N73SV> References: <20161206185440.GA4654@yury-N73SV> <3014428.VXGdOARdm1@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <3014428.VXGdOARdm1@wuerfel> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [223.196.173.64] X-ClientProxiedBy: AM5PR0101CA0013.eurprd01.prod.exchangelabs.com (10.169.240.23) To BN4PR07MB2241.namprd07.prod.outlook.com (10.164.63.147) X-MS-Office365-Filtering-Correlation-Id: 38f98838-3ba4-4dfe-cee7-08d41e8cb527 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN4PR07MB2241; X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2241;3:fLn6jDMb6T8GrP3P7lt2SU63joWwpR5c7YbB3OEf3zFKJntgrzUbffr3zE+A46tg5WXChwrTp/BPCNDgvYhRSsK3U76iM9Keu1n3qlfjcDqrMQ4E2LPulq5tk8vPyqn8SRzjis3OX+TS9KFUXlwT75CBfMD/uMj5XJUAIjQeRDaLuk0E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BCMeSDViJZKVMeDOqaP5LdUT4LdE4urqEz6ysfxevA58yp5s9eRCGOApNpCobUgMBk6ndIg69RI6ncQNsfR2ig9D7a8JuRro+SRIsIVV5QZFjHV1zy/UD06qY8UQ3gzfXy7Ko4HYJf8SIlRpja1Jn0OCogcvMl1bdH7kOTbzRza5M7lWDUziKp95uMYjJ9lcG/BWzPV0h8FDW/06+Vmqoqg6Jy1xszqyLZ3W7hPlPKv3jAAS4tSBBCi97ajTYlQ0WYAtfuQT0SzhXfL9mMKkYYwdV4uNHmujHHseXGUUpX7BCIz7CqVLCDRxKtkzI7NNSvTuJtCvWCqlW6fn5ITzzJfovsGWEOWpqDVcc7WKooVyLOXLYU5XRhy8RnmOxtoMjQZerBXUiGoeqq8zoCsiYmI239rWkuSh30YhkuKqcuQHWSPzyezuSA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148);SRVR:BN4PR07MB2241;BCL:0;PCL:0;RULEID:;SRVR:BN4PR07MB2241; X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2241;4:jUt5/N7t1QDD5EnhmVGvS+vQN/3/6gSIT56c9JpS4xvz7uD4WMTLG4zITOzk9RqQLt7IM1qmcHdik4hyFpUVFC326sNMsUeavRXwVCYOualGervNC8h53z1EDotGvqYtTw9w/dhGLtHsPz4tISuFzkCO6M7cM6xmjfQzwn+s0Z5+vTBLqPj/tjcQv6pYwhcuj7yz9NknWhAp/1J0fgt2P8XTE7Kl0TR5I1aM8BX9aemJ2z+zZev+njUNu0vtXj0VFCb8gAYQSIe9E4FGtuy026Ne3dZ2aMg91g++UP/y5rWU4kIRhi9kqihANyaBke6h1JhJYsZtFE5WdokwNrED+xhWSdrf2R9Nsh8HRZW7fcWsFXfdlpLXbUnjlaMPq0rUmOg8YGfhr+AW/+oyz+y47L/403WD0CRLmDjvwFyOlncC+KvTI7nQK7PRGsKyWXe+Uj81b6EI3ZoiiR79vZgLGPIt4laEPOalfrHXAtnWneQPimJKWTOnkKoRp1He5rKk2awj13vMbv1DVao1Mqh8Z3CvT7an06C41+u9Sl7HhCEumgpAHDlVfnO663OT5/oNMYMCFGGqTirhsHtbpNhEPQ== X-Forefront-PRVS: 01494FA7F7 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(377454003)(189002)(24454002)(39410400001)(229853002)(6116002)(92566002)(39450400002)(83506001)(81156014)(3846002)(105586002)(68736007)(33716001)(76506005)(106356001)(23726003)(39840400001)(38730400001)(39060400001)(39850400001)(46406003)(1076002)(50466002)(47776003)(66066001)(6486002)(6496003)(733004)(110136003)(189998001)(5660300001)(9686002)(33656002)(6916009)(2950100002)(6666003)(2906002)(4326007)(4001350100001)(97756001)(575784001)(97736004)(7416002)(7736002)(7846002)(76176999)(54356999)(305945005)(8676002)(42186005)(101416001)(50986999)(81166006)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN4PR07MB2241;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN4PR07MB2241;23:3De9WGXHHgLumwjc62IdQBMliHSFh0A6d/COSxGQB?= =?us-ascii?Q?ws53AZ26Hl8I0CazVu1ejkecyXTMtWV/qLKUs7I+zYpzrt3QrdndyFm9Jkj0?= =?us-ascii?Q?YPjSln6/5ZuDcWEN4jy8wr+Oa2osYx+sE/btRwWIIDhtYKl5GcEu0lFgFWr8?= =?us-ascii?Q?nDnVpQvlWEv/aKf+CLnsrW7bD9WdDC9IVOYBQTwRB4Qy2FJtuGdvE/FHNWZN?= =?us-ascii?Q?Vawj5HxRle1YU0+omtSj+6X5ToFXzxmKKvuQFuD+XElJfiVvvdFhrNXNPC/L?= =?us-asc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RDjxauj2N/t2Rktz9h+QDqSbUCaV0beif385yQOGIn/sk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2241;7:bmaj71iLnCp+JzRnCDr+ctLaCMHFPQ+Km+UlcTEKVaTA7AOIYzkzs9Jl8V32WFu+pdEq3peIrKI00TO0970Z67Vabh/wnc354mkZUPyR+30mSt1qoChd/uUH1A7C+bbrTG4Wdy5q/0GF3EWJNjzld4A+eexuuHPYzVuYaz570ZEPsen7O4765J8Vdkr5Rw3FHnfn5OnnMtZBeh040+gYjZpWtniezlx2lzdfUvs2nIKenY6dkBbDkUWF4HMh5tmnpWAlVZp1p200K1hvjzuWDqyeOJRnmE54+ICAPqPOZYmbRk0RIX3GiG/JkXkTiLMT00hXWPk/XhmpzLjRPMm3174hRppx8U1boqSqnu8rTR8YrAd3tfxbcZQH2LidEkDf3J/pQHe8nELhZFQr7Rc9MHCBxFiUzOpuq6le7UK6QEZc4pFJkLB05ZBZC9kysDUwuMcMchG7z1NvwF4d3rsRzQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2016 10:35:03.8603 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR07MB2241 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2532 Lines: 56 On Tue, Dec 06, 2016 at 10:20:20PM +0100, Arnd Bergmann wrote: > On Wednesday, December 7, 2016 12:24:40 AM CET Yury Norov wrote: > > 3. Introduce new mmap64() syscall like this: > > sys_mmap64(void *addr, size_t len, int prot, int flags, int fd, struct off_pair *off); > > (The pointer here because otherwise we have 7 args, if simply pass off_hi and > > off_lo in registers.) > > This wouldn't have to be a pair, just a pointer to a 64-bit number. > > > With new 64-bit interface we can deprecate mmap2(), and generalize all > > implementations in kernel. > > > > I think we can discuss it because 64-bit is the default size for off_t > > in all new 32-bit architectures. So generic solution may take place. > > > > The last question here is how important to support offsets bigger than > > 2^44 on 32-bit machines in practice? It may be a case for ARM64 servers, > > which are looking like main aarch64/ilp32 users. If no, we can leave > > things as is, and just do nothing. > > If there is a use case for larger than 16TB offsets, we should add > the call on all architectures, probably using your approach 3. I don't > think that we should treat it as anything special for arm64 though. >From this point of view, 16+TB offset is a matter of 16+TB storage, and it's more than real. The other consideration to add it is that we have 64-bit support for offsets in syscalls like sys_llseek(). So mmap64() will simply extend this support. I can prepare this patch. Some implementation details I'd like to clarify: Syscall declaration: SYSCALL_DEFINE6(mmap64, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, unsigned long, fd, unsigned long long *, offset); sys_mmap64() deprecates sys_mmap2(), and __ARCH_WANT_MMAP2 is introduced to keep it enabled for all existing architectures. All modern arches (aarch64/ilp32 is the first candidate) will have mmap64() only. The example is set/getrlimit() or renameat() drop patches (b0da6d44). On GLIBC side, __OFF_T_MATCHES_OFF64_t will wire mmap() from linux/generic/wordsize32/mmap.c to mmap64() from linux/mmap64.c. mmap64() will first try __NR_mmap64, and if not defined, or ENOSYS is returned, __NR_mmap2 will be called. This is to let userspace that supports both mmap2() and mmap64() have full 64-bit offset support, not 44-bit one. For __NR_mmap2 case, I'd also add the check against offsets more than 2^44, and set errno to EOVERFLOW in that case. Any thoughts? Yury.