diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2012-08-08 03:32:20 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-08-08 10:32:57 -0400 |
commit | e85871218513c54f7dfdb6009043cb638f2fecbe (patch) | |
tree | b50c4079fed166c1fd0e5b3de2a519bf617eb483 /arch/s390 | |
parent | 82aabdb6f1eb61e0034ec23901480f5dd23db7c4 (diff) |
s390/compat: fix mmap compat system calls
The native 31 bit and the compat behaviour for the mmap system calls differ:
In native 31 bit mode the passed in address for the mmap system call will be
unmodified passed to sys_mmap_pgoff().
In compat mode however the passed in address will be modified with
compat_ptr() which masks out the most significant bit.
The result is that in native 31 bit mode each mmap request (with MAP_FIXED)
will fail where the most significat bit is set, while in compat mode it
may succeed.
This odd behaviour was introduced with d3815898 "[S390] mmap: add missing
compat_ptr conversion to both mmap compat syscalls".
To restore a consistent behaviour accross native and compat mode this
patch functionally reverts the above mentioned commit.
Cc: stable@vger.kernel.org
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kernel/compat_linux.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index d1225089a4bb..f606d935f495 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -620,7 +620,6 @@ asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg) | |||
620 | return -EFAULT; | 620 | return -EFAULT; |
621 | if (a.offset & ~PAGE_MASK) | 621 | if (a.offset & ~PAGE_MASK) |
622 | return -EINVAL; | 622 | return -EINVAL; |
623 | a.addr = (unsigned long) compat_ptr(a.addr); | ||
624 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | 623 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, |
625 | a.offset >> PAGE_SHIFT); | 624 | a.offset >> PAGE_SHIFT); |
626 | } | 625 | } |
@@ -631,7 +630,6 @@ asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) | |||
631 | 630 | ||
632 | if (copy_from_user(&a, arg, sizeof(a))) | 631 | if (copy_from_user(&a, arg, sizeof(a))) |
633 | return -EFAULT; | 632 | return -EFAULT; |
634 | a.addr = (unsigned long) compat_ptr(a.addr); | ||
635 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); | 633 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); |
636 | } | 634 | } |
637 | 635 | ||