SOLARIS: support mmap() over 4GiB 91/12291/2
authorMark Vitale <mvitale@sinenomine.net>
Thu, 26 May 2016 20:53:47 +0000 (16:53 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 20 Jul 2016 23:39:11 +0000 (19:39 -0400)
When mmap() is issued for exactly 4GiB of a large AFS-resident file,
mmap() fails with ENOMEM.  This is because the AFS code is handling the
requested length as u_int instead of size_t, resulting in a 0 being
passed back to the caller.

When mmap() is issued for non-multiples of 4GiB, the subsequent mapping
will not contain all the requested pages, and for the same reason - the
mapped size has been truncated to 32 bits.  This results in SIGSEGV when
accessing the non-mapped page(s).

Fix the signature of afs_map() to specify the correct type for the length.

Thanks to Robert Milkowski for the report and diagnosis.

Change-Id: I8a9f0cb04ff9b80de5516e14d0679b06ef0b3f9a
Reviewed-on: https://gerrit.openafs.org/12291
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/SOLARIS/osi_vnodeops.c

index 69dd985..f5e6ffd 100644 (file)
@@ -931,7 +931,7 @@ afs_nfsrdwr(struct vcache *avc, struct uio *auio, enum uio_rw arw,
 }
 
 int
-afs_map(struct vnode *vp, offset_t off, struct as *as, caddr_t *addr, u_int len, u_char prot, u_char maxprot, u_int flags, afs_ucred_t *cred)
+afs_map(struct vnode *vp, offset_t off, struct as *as, caddr_t *addr, size_t len, u_char prot, u_char maxprot, u_int flags, afs_ucred_t *cred)
 {
     struct segvn_crargs crargs;
     afs_int32 code;