[Bug 3853] MIPS mmap can not access over 4G file

bugzilla at busybox.net bugzilla at busybox.net
Mon Apr 9 16:46:34 UTC 2012


https://bugs.busybox.net/show_bug.cgi?id=3853

Leonid <lly.dev at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P5                          |P3

--- Comment #3 from Leonid <lly.dev at gmail.com> 2012-04-09 16:46:34 UTC ---
I apologize that this issue must be renamed - problems with mmap64 & offsets >
4Gb observed on any 32-bit platform(__USE_FILE_OFFSET64 not set) has
sizeof(__u_long) == 4.

Bug introduced in commit 22a4424b0b "Fix arm mmap when using mmap2 syscall. 
Fixes bug #1303" - wrong parentheses placement cause off64_t offset argument
truncated to low 32-bit.

Trivial fix:

diff --git a/libc/sysdeps/linux/common/mmap64.c
b/libc/sysdeps/linux/common/mmap64.c
--- a/libc/sysdeps/linux/common/mmap64.c
+++ b/libc/sysdeps/linux/common/mmap64.c
@@ -61,10 +61,10 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int
flags, int fd, __off64_t offset)

 #  ifdef __USE_FILE_OFFSET64
     return __syscall_mmap2(addr, len, prot, flags,
-                           fd, ((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
+                           fd, (__u_quad_t)(offset >> MMAP2_PAGE_SHIFT));
 #  else
     return __syscall_mmap2(addr, len, prot, flags,
-                           fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT));
+                           fd, (__u_long)(offset >> MMAP2_PAGE_SHIFT));
 #  endif
 }

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list