summaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/entry32.S
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2015-03-16 16:32:22 (GMT)
committerWill Deacon <will.deacon@arm.com>2015-03-19 10:43:51 (GMT)
commit18ccb0cab49ef7868eaf9504f257e1a84683dbbd (patch)
tree54d6aecbdfc68fb7a40d39cb09cee3b11ca87158 /arch/arm64/kernel/entry32.S
parentad08fd494bf00c03ae372e0bbd9cefa37bf608d6 (diff)
downloadlinux-18ccb0cab49ef7868eaf9504f257e1a84683dbbd.tar.xz
arm64: fix implementation of mmap2 compat syscall
The arm mmap2 syscall takes the offset in units of 4K, thus with 64K pages the offset needs to be scaled to units of pages. Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de> [will: removed redundant lr parameter, localised PAGE_SHIFT #if check] Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/entry32.S')
-rw-r--r--arch/arm64/kernel/entry32.S18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/arm64/kernel/entry32.S b/arch/arm64/kernel/entry32.S
index 9a8f6ae..bd9bfaa 100644
--- a/arch/arm64/kernel/entry32.S
+++ b/arch/arm64/kernel/entry32.S
@@ -19,9 +19,12 @@
*/
#include <linux/linkage.h>
+#include <linux/const.h>
#include <asm/assembler.h>
#include <asm/asm-offsets.h>
+#include <asm/errno.h>
+#include <asm/page.h>
/*
* System call wrappers for the AArch32 compatibility layer.
@@ -54,6 +57,21 @@ ENTRY(compat_sys_fstatfs64_wrapper)
ENDPROC(compat_sys_fstatfs64_wrapper)
/*
+ * Note: off_4k (w5) is always in units of 4K. If we can't do the
+ * requested offset because it is not page-aligned, we return -EINVAL.
+ */
+ENTRY(compat_sys_mmap2_wrapper)
+#if PAGE_SHIFT > 12
+ tst w5, #~PAGE_MASK >> 12
+ b.ne 1f
+ lsr w5, w5, #PAGE_SHIFT - 12
+#endif
+ b sys_mmap_pgoff
+1: mov x0, #-EINVAL
+ ret
+ENDPROC(compat_sys_mmap2_wrapper)
+
+/*
* Wrappers for AArch32 syscalls that either take 64-bit parameters
* in registers or that take 32-bit parameters which require sign
* extension.