Commit graph

6 commits

Author SHA1 Message Date
Elliott Hughes
9bd9b7dd20 If the kernel doesn't have MADV_MERGEABLE, stop asking for it.
Note that a dynamically-linked binary will still probably see two attempts ---
one by the dynamic linker (which will set its copy of the flag so it won't try
again) and then one by the executable itself (which gets a new uninitialized
copy of the flag).

Change-Id: Id6b7e47780f0f24d2ca0384a75373f4824fa8f12
2014-03-03 11:54:21 -08:00
Elliott Hughes
431166d995 Fix 32-bit mmap/mmap64 handling of negative offsets.
We don't actually need to worry about sign extension if we reject
negative values ourselves. Previously it was possible to come up
with negative but aligned values that we would pass to the kernel;
in the case of mmap (as opposed to mmap64) we'd incorrectly turn
those into large positive offsets.

Change-Id: I2aa583e0f892d59bb77429aea8730b72db32dcb0
2014-01-27 16:36:56 -08:00
Elliott Hughes
99868904fe Avoid sign extension in 32-bit mmap.
Change-Id: I2a77925f62f381a0b34648c3db8154a55dd80c46
2013-12-20 18:17:34 -08:00
Daniel Leung
afcc0cccda Add mmap64()
This adds mmap64() to bionic so that it is possible to have
large offset passed to kernel. However, the syscall mechanism
only passes 32-bit number to kernel. So effectively, the
largest offset that can be passed is about 43 bits (since
offset is signed, and the number passed to kernel is number
of pages (page size == 4K => 12 bits)).

Change-Id: Ib54f4e9b54acb6ef8b0324f3b89c9bc810b07281
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2013-09-19 14:11:26 -07:00
Elliott Hughes
e320a8c780 Avoid sign extension of the mmap offset.
off_t is signed to support seeking backwards, but that's a liability
when using off_t to represent a subset of a file.

Change-Id: I2a3615166eb16212347eb47f1242e3bfb93c2022
2013-07-25 10:15:07 -07:00
Elliott Hughes
107cdd406b Prevent the madvise(MADV_MERGEABLE) mmap hack from affecting errno.
Bug: 9889616
Change-Id: I4a7323e0ae5aeb5cbe0da1b2bc7501d83b3a2aa4
2013-07-17 13:12:26 -07:00
Renamed from libc/bionic/mmap.c (Browse further)