LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de> To: Alexander Graf <agraf@suse.de> Cc: "Arnd Bergmann" <arnd@arndb.de>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, "Will Deacon" <will.deacon@arm.com>, "Catalin Marinas" <Catalin.Marinas@arm.com>, "Michael Matz" <matz@suse.de>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "Dirk Müller" <dmueller@suse.com>, "Suravee Suthikulanit" <suravee.suthikulpanit@amd.com> Subject: [PATCH] arm64: fix implementation of mmap2 compat syscall Date: Thu, 12 Mar 2015 10:07:09 +0100 [thread overview] Message-ID: <mvmh9tqd1oi.fsf_-_@hawking.suse.de> (raw) In-Reply-To: <55008557.3000200@suse.de> (Alexander Graf's message of "Wed, 11 Mar 2015 13:11:35 -0500") 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> --- arch/arm64/include/asm/unistd32.h | 2 +- arch/arm64/kernel/entry32.S | 18 ++++++++++++++++++ arch/arm64/kernel/sys32.c | 6 ++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 2722442..cef934a 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h @@ -406,7 +406,7 @@ __SYSCALL(__NR_vfork, sys_vfork) #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ __SYSCALL(__NR_ugetrlimit, compat_sys_getrlimit) /* SuS compliant getrlimit */ #define __NR_mmap2 192 -__SYSCALL(__NR_mmap2, sys_mmap_pgoff) +__SYSCALL(__NR_mmap2, compat_sys_mmap2_wrapper) #define __NR_truncate64 193 __SYSCALL(__NR_truncate64, compat_sys_truncate64_wrapper) #define __NR_ftruncate64 194 diff --git a/arch/arm64/kernel/entry32.S b/arch/arm64/kernel/entry32.S index 9a8f6ae..17f3296 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 units of 4K. If we can't do the requested + * offset, we return EINVAL. + */ +#if PAGE_SHIFT > 12 +ENTRY(compat_sys_mmap2_wrapper) + tst w5, #~PAGE_MASK >> 12 + b.ne 1f + lsr w5, w5, #PAGE_SHIFT - 12 + b sys_mmap_pgoff +1: mov x0, #-EINVAL + ret lr +ENDPROC(compat_sys_mmap2_wrapper) +#endif + +/* * Wrappers for AArch32 syscalls that either take 64-bit parameters * in registers or that take 32-bit parameters which require sign * extension. diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c index 2d5ab3c..7800bb1 100644 --- a/arch/arm64/kernel/sys32.c +++ b/arch/arm64/kernel/sys32.c @@ -24,6 +24,7 @@ #include <linux/compiler.h> #include <linux/syscalls.h> +#include <asm/page.h> asmlinkage long compat_sys_sigreturn_wrapper(void); asmlinkage long compat_sys_rt_sigreturn_wrapper(void); @@ -37,6 +38,11 @@ asmlinkage long compat_sys_readahead_wrapper(void); asmlinkage long compat_sys_fadvise64_64_wrapper(void); asmlinkage long compat_sys_sync_file_range2_wrapper(void); asmlinkage long compat_sys_fallocate_wrapper(void); +#if PAGE_SHIFT > 12 +asmlinkage long compat_sys_mmap2_wrapper(void); +#else +#define compat_sys_mmap2_wrapper sys_mmap_pgoff +#endif #undef __SYSCALL #define __SYSCALL(nr, sym) [nr] = sym, -- 2.3.2 -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
next prev parent reply other threads:[~2015-03-12 9:07 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-12-04 15:46 [PATCH] arm64: Enable CONFIG_COMPAT also for 64k page size Alexander Graf 2014-12-04 18:18 ` Laura Abbott 2014-12-04 18:20 ` Will Deacon 2014-12-04 23:37 ` Alexander Graf 2014-12-08 13:47 ` Michael Matz 2014-12-06 17:23 ` Alexander Graf 2014-12-08 10:10 ` Will Deacon 2014-12-08 10:47 ` Alexander Graf 2015-03-11 11:24 ` Alexander Graf 2015-03-11 12:43 ` Andreas Schwab 2015-03-11 12:47 ` Arnd Bergmann 2015-03-11 13:08 ` Alexander Graf 2015-03-11 13:35 ` Andreas Schwab 2015-03-11 13:51 ` Arnd Bergmann 2015-03-11 13:57 ` Andreas Schwab 2015-03-11 15:44 ` Alexander Graf 2015-03-11 16:09 ` Andreas Schwab 2015-03-11 18:11 ` Alexander Graf 2015-03-12 9:07 ` Andreas Schwab [this message] 2015-03-16 14:16 ` Christopher Covington 2015-03-16 14:19 ` Arnd Bergmann 2014-12-04 21:15 ` Olof Johansson 2014-12-04 23:41 ` Alexander Graf 2014-12-04 23:48 ` Olof Johansson 2014-12-05 10:39 ` Arnd Bergmann 2014-12-05 11:05 ` Catalin Marinas 2014-12-05 12:24 ` Arnd Bergmann 2014-12-05 12:31 ` Catalin Marinas 2015-02-18 13:40 ` Christopher Covington 2014-12-05 12:06 ` Alexander Graf 2014-12-05 11:14 ` Catalin Marinas 2014-12-05 11:35 ` Will Deacon 2015-03-13 4:44 ` Jon Masters 2014-12-05 16:35 ` Liviu Dudau
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=mvmh9tqd1oi.fsf_-_@hawking.suse.de \ --to=schwab@suse.de \ --cc=Catalin.Marinas@arm.com \ --cc=agraf@suse.de \ --cc=arnd@arndb.de \ --cc=dmueller@suse.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=matz@suse.de \ --cc=suravee.suthikulpanit@amd.com \ --cc=will.deacon@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).