summaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/sys_compat.c
diff options
context:
space:
mode:
authorMichael Weiser <michael.weiser@gmx.de>2018-02-01 23:13:37 +0100
committerWill Deacon <will.deacon@arm.com>2018-03-05 12:06:43 +0000
commit532826f3712b607256eb30f92f23d1c604d3fa34 (patch)
treedd6212345eb15ff81dbfebbe0a8e9b30411e3f23 /arch/arm64/kernel/sys_compat.c
parent4a3928c6f8a53fa1aed28ccba227742486e8ddcb (diff)
arm64: Mirror arm for unimplemented compat syscalls
Mirror arm behaviour for unimplemented syscalls: Below 2048 return -ENOSYS, above 2048 raise SIGILL. Signed-off-by: Michael Weiser <michael.weiser@gmx.de> [will: Tweak die string to identify as compat syscall] Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/sys_compat.c')
-rw-r--r--arch/arm64/kernel/sys_compat.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c
index a382b2a1b84e..9897f416b29e 100644
--- a/arch/arm64/kernel/sys_compat.c
+++ b/arch/arm64/kernel/sys_compat.c
@@ -27,6 +27,7 @@
#include <linux/uaccess.h>
#include <asm/cacheflush.h>
+#include <asm/system_misc.h>
#include <asm/unistd.h>
static long
@@ -67,6 +68,7 @@ do_compat_cache_op(unsigned long start, unsigned long end, int flags)
*/
long compat_arm_syscall(struct pt_regs *regs)
{
+ siginfo_t info;
unsigned int no = regs->regs[7];
switch (no) {
@@ -99,6 +101,23 @@ long compat_arm_syscall(struct pt_regs *regs)
return 0;
default:
- return -ENOSYS;
+ /*
+ * Calls 9f00xx..9f07ff are defined to return -ENOSYS
+ * if not implemented, rather than raising SIGILL. This
+ * way the calling program can gracefully determine whether
+ * a feature is supported.
+ */
+ if ((no & 0xffff) <= 0x7ff)
+ return -ENOSYS;
+ break;
}
+
+ info.si_signo = SIGILL;
+ info.si_errno = 0;
+ info.si_code = ILL_ILLTRP;
+ info.si_addr = (void __user *)instruction_pointer(regs) -
+ (compat_thumb_mode(regs) ? 2 : 4);
+
+ arm64_notify_die("Oops - bad compat syscall(2)", regs, &info, no);
+ return 0;
}