lkml.org 
[lkml]   [2019]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arm64: Mirror arm for small unimplemented compat syscalls
On Thu, Jan 03, 2019 at 03:45:47PM +0800, Pi-Hsun Shih wrote:
> For syscall number smaller than 0xf0000, arm calls sys_ni_syscall
> instead of arm_syscall in arch/arm/kernel/entry-common.S, which returns
> -ENOSYS instead of raising SIGILL. Mirror this behavior for compat
> syscalls in arm64.
>
> Fixes: 532826f3712b607 ("arm64: Mirror arm for unimplemented compat
> syscalls")
> Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
> ---
> arch/arm64/kernel/syscall.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
> index 8f3371415642ad..95fd8c7ec8a171 100644
> --- a/arch/arm64/kernel/syscall.c
> +++ b/arch/arm64/kernel/syscall.c
> @@ -21,7 +21,7 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
> {
> #ifdef CONFIG_COMPAT
> long ret;
> - if (is_compat_task()) {
> + if (is_compat_task() && regs->regs[7] >= __ARM_NR_COMPAT_BASE) {

compat_arm_syscall() ignores all bits r7 except for bits [15:0].

So, doesn't this mean that 0xf0000, 0x100000, 0x110000 will all do the
same thing now? (Previously to your patch, 0xe0000, 0xd0000 etc. would
also match in this code I've misunderstood something.)

The gating check in arch/arm/kernel/trapc.s:arm_syscall() is

if ((no >> 16) != (__ARM_NR_BASE>> 16))

I would expect that arm64 needs a similar check somewhere. Is the check
already present? I may have missed it.


Cheers
---Dave

\
 
 \ /
  Last update: 2019-01-03 12:50    [W:0.073 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site