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: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 12 Apr 2017 21:21:28 +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 #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 158d5fa0e1906e7810bdc6ecb7bf598dcc3cd17d (commit)
from 4fee33f8c11447d345b2b1118a98958b54d5fda3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=158d5fa0e1906e7810bdc6ecb7bf598dcc3cd17d
commit 158d5fa0e1906e7810bdc6ecb7bf598dcc3cd17d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Apr 6 17:01:56 2017 -0300
Consolidate Linux mmap implementation (BZ#21270)
This patch consolidates all Linux mmap implementations on default
sysdeps/unix/sysv/linux/mmap{64}.c one. To accomodate all required
architecture specific requeriments a new internal header is created
(mmap_internal.h) where each architecture add its specific code
requirements. Currently only x86_64 (to define MMAP_PREPARE to add
MAP_32BITS), s390 (which have a different kernel ABI for mmap), m68k
(which have variable minimum page sizes), and MIPS n32 (which zero
extend the offset to handle negative one correctly) redefine the new
header.
The patch also fixes BZ#21270 where default mmap64 on architectures
which uses mmap2 silent truncates large offsets value (larger than
1 << (page shift + 8 * sizeof (off_t)) or 1<<44 on architectures with
4096 bytes page size). The new consolidate implementation returns
EINVAL as allowed by POSIX.
It also adds a tests for on current tst-mmap-offset one. I have run
a full make check on x86_64, x86_64-32, i686, aarch64, armhf, powerpc,
powerpc64le, sparc64, and sparcv9 without any regressions. I also ran
some basic tests (tst-mmap-offset) on sh4, m68k, and on qemu simulated
MIPS32 and MIPS64.
[BZ #21270]
* posix/tst-mmap-offset.c (do_prepare): New function.
(do_test): Rename to do_test_bz18877 and use FAIL_RET.
(do_test_bz21270): New function.
* sysdeps/unix/sysv/linux/aarch64/mmap.c: Remove file.
* sysdeps/unix/sysv/linux/arm/mmap.c: Remove file.
* sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/hppa/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/i386/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/m68k/mmap64.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/mmap64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/mmap64.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/mmap_internal.h: New file.
* sysdeps/unix/sysv/linux/m68k/mmap_internal.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/mmap_internal.h: Likewise.
* sysdeps/unix/sysv/linux/s390/mmap_internal.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list: Remove mmap
from auto-generation list.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mmap.c: New file.
* sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Add check for invalid
offsets and support for mmap2 syscall.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 34 ++++++++
posix/tst-mmap-offset.c | 88 +++++++++++++++----
sysdeps/unix/sysv/linux/aarch64/mmap.c | 34 --------
sysdeps/unix/sysv/linux/arm/mmap.c | 18 ----
sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c | 40 ---------
sysdeps/unix/sysv/linux/hppa/mmap.c | 49 -----------
sysdeps/unix/sysv/linux/i386/mmap.c | 36 --------
sysdeps/unix/sysv/linux/m68k/mmap.S | 42 ---------
sysdeps/unix/sysv/linux/m68k/mmap64.c | 5 -
sysdeps/unix/sysv/linux/m68k/mmap_internal.h | 29 +++++++
sysdeps/unix/sysv/linux/microblaze/mmap.S | 50 -----------
sysdeps/unix/sysv/linux/mips/mips32/mmap.c | 1 -
sysdeps/unix/sysv/linux/mips/mips64/n32/mmap.c | 35 --------
.../sysv/linux/mips/mips64/n32/mmap_internal.h | 28 ++++++
.../unix/sysv/linux/mips/mips64/n32/syscalls.list | 2 -
sysdeps/unix/sysv/linux/mips/mips64/n64/mmap64.c | 1 -
.../unix/sysv/linux/mips/mips64/n64/syscalls.list | 2 -
sysdeps/unix/sysv/linux/mmap.c | 51 +++++++++++
sysdeps/unix/sysv/linux/mmap64.c | 57 +++++++------
sysdeps/unix/sysv/linux/mmap_internal.h | 49 +++++++++++
sysdeps/unix/sysv/linux/s390/mmap_internal.h | 32 +++++++
sysdeps/unix/sysv/linux/s390/s390-32/mmap.S | 74 ----------------
sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S | 81 ------------------
sysdeps/unix/sysv/linux/s390/s390-64/mmap.S | 78 -----------------
sysdeps/unix/sysv/linux/wordsize-64/mmap.c | 40 ---------
sysdeps/unix/sysv/linux/wordsize-64/mmap64.c | 1 -
sysdeps/unix/sysv/linux/wordsize-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/x86_64/64/mmap.c | 37 --------
sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h | 42 +++++++++
29 files changed, 364 insertions(+), 673 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/aarch64/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/hppa/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/i386/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/m68k/mmap.S
delete mode 100644 sysdeps/unix/sysv/linux/m68k/mmap64.c
create mode 100644 sysdeps/unix/sysv/linux/m68k/mmap_internal.h
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/mmap.S
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips32/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n32/mmap.c
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n32/mmap_internal.h
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/mmap64.c
create mode 100644 sysdeps/unix/sysv/linux/mmap.c
create mode 100644 sysdeps/unix/sysv/linux/mmap_internal.h
create mode 100644 sysdeps/unix/sysv/linux/s390/mmap_internal.h
delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/mmap.S
delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S
delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/mmap.S
delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/mmap64.c
delete mode 100644 sysdeps/unix/sysv/linux/x86_64/64/mmap.c
create mode 100644 sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h
--
You are receiving this mail because:
You are on the CC list for the bug.