parisc: fix mmap(MAP_FIXED|MAP_SHARED) to already mmapped address
authorHelge Deller <deller@gmx.de>
Wed, 20 Nov 2013 22:07:42 +0000 (23:07 +0100)
committerHelge Deller <deller@gmx.de>
Sat, 30 Nov 2013 19:57:50 +0000 (20:57 +0100)
commit0576da2c08e3d332f1b0653030d28ab804585ab6
tree6fba568d4bbb0a32989ea68dedca00cfcc75f99f
parentdc1ccc48159d63eca5089e507c82c7d22ef60839
parisc: fix mmap(MAP_FIXED|MAP_SHARED) to already mmapped address

locale-gen on Debian showed a strange problem on parisc:
mmap2(NULL, 536870912, PROT_NONE, MAP_SHARED, 3, 0) = 0x42a54000
mmap2(0x42a54000, 103860, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, 3, 0) = -1 EINVAL (Invalid argument)

Basically it was just trying to re-mmap() a file at the same address
which it was given by a previous mmap() call. But this remapping failed
with EINVAL.

The problem is, that when MAP_FIXED and MAP_SHARED flags were used, we didn't
included the mapping-based offset when we verified the alignment of the given
fixed address against the offset which we calculated it in the previous call.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: <stable@vger.kernel.org> # 3.10+
arch/parisc/kernel/sys_parisc.c