]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: ptrace: Fix seccomp of traced syscall -1 (NO_SYSCALL)
authorTimothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
Sat, 16 Jan 2021 15:18:54 +0000 (15:18 +0000)
committerWill Deacon <will@kernel.org>
Thu, 25 Feb 2021 10:27:43 +0000 (10:27 +0000)
commitd94eb6e998b1ab924b8bc089fcf83b442795cd03
tree4537dfc37ef57128591863a26c60ebc4e04b7b03
parentcc093e676a7a5b5e4c7d16879c08fb6ed297df76
arm64: ptrace: Fix seccomp of traced syscall -1 (NO_SYSCALL)

Since commit f20d954accdc ("arm64: ptrace: add support for syscall
emulation"), if system call number -1 is called and the process is being
traced with PTRACE_SYSCALL, for example by strace, the seccomp check is
skipped and -ENOSYS is returned unconditionally (unless altered by the
tracer) rather than carrying out action specified in the seccomp filter.

The consequence of this is that it is not possible to reliably strace
a seccomp based implementation of a foreign system call interface in
which r7/x8 is permitted to be -1 on entry to a system call.

Also trace_sys_enter and audit_syscall_entry are skipped if a system
call is skipped.

Fix by removing the in_syscall(regs) check restoring the previous
behaviour which is like AArch32, x86 (which uses generic code) and
everything else.

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Catalin Marinas<catalin.marinas@arm.com>
Cc: <stable@vger.kernel.org>
Fixes: f20d954accdc ("arm64: ptrace: add support for syscall emulation")
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Timothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
Link: https://lore.kernel.org/r/90edd33b-6353-1228-791f-0336d94d5f8c@majoroak.me.uk
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/ptrace.c