[Bug libc/21270] mmap64 silently truncates large offset values
thiago at kde dot org
sourceware-bugzilla@sourceware.org
Mon Mar 20 15:57:00 GMT 2017
https://sourceware.org/bugzilla/show_bug.cgi?id=21270
--- Comment #3 from Thiago Macieira <thiago at kde dot org> ---
(In reply to Szabolcs Nagy from comment #2)
> posix allows EINVAL if ".. off is not a multiple of the page size as
> returned by sysconf(), or is considered invalid by the implementation".
>
> so EINVAL is conforming too, silently truncating is not. (musl libc uses
> EINVAL).
EINVAL would indeed be better.
You're also right, musl does check for invalid size. I had missed the
definition of the OFF_MASK that includes the bits for 1<<44 and higher. They
have a weird definition of it:
#define OFF_MASK ((-0x2000ULL << (8*sizeof(long)-1)) | (UNIT-1))
Instead of -0x2000ULL and shifting left by the number of bits in long minus
one, I'd have done -0x1000ULL (which is a page) and shift left by the number of
bits.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list