This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/21270] mmap64 silently truncates large offset values
- From: "thiago at kde dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 20 Mar 2017 15:57:39 +0000
- Subject: [Bug libc/21270] mmap64 silently truncates large offset values
- Auto-submitted: auto-generated
- References: <bug-21270-131@http.sourceware.org/bugzilla/>
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.