From: Dmitry V. Levin Date: Thu, 15 Aug 2019 20:23:19 +0000 (+0000) Subject: sparc, sparc64: fix redundant get_regs invocation X-Git-Tag: v5.3~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=37c8cfff11b8691c8ca8c72d122842fc0ae368e3;p=strace sparc, sparc64: fix redundant get_regs invocation An explicit get_regs invocation was added to arch_set_error and arch_set_success on sparc/sparc64 by commit v5.2~27 in attempt to fix syscall tampering on these architectures when PTRACE_GET_SYSCALL_INFO is in use. That change, however, did not fix the bug because set_error and set_success already invoke get_regs on all architectures where ptrace_setregset_or_setregs is defined, this includes sparc and sparc64. * linux/sparc/set_error.c (sparc_set_o0_psr): Do not invoke get_regs. * linux/sparc64/set_error.c (sparc64_set_o0_tstate): Likewise. * NEWS (5.2): Remove the statement about syscall tampering fix on sparc and sparc64 when PTRACE_GET_SYSCALL_INFO is in use. --- diff --git a/NEWS b/NEWS index 4c8b8340..17125b8d 100644 --- a/NEWS +++ b/NEWS @@ -33,7 +33,7 @@ Noteworthy changes in release 5.2 (2019-07-12) * Updated lists of ioctl commands from Linux 5.2. * Bug fixes - * Fixed syscall tampering on powerpc, powerpc64, sparc, and sparc64 when + * Fixed syscall tampering on powerpc and powerpc64 when PTRACE_GET_SYSCALL_INFO is in use. * Fixed build with cutting-edge toolchain. diff --git a/linux/sparc/set_error.c b/linux/sparc/set_error.c index cc608126..767be69d 100644 --- a/linux/sparc/set_error.c +++ b/linux/sparc/set_error.c @@ -9,8 +9,6 @@ static int sparc_set_o0_psr(struct tcb *tcp, const unsigned long o0, const unsigned long psr_set, const unsigned long psr_clear) { - if (ptrace_syscall_info_is_valid() && get_regs(tcp) < 0) - return -1; sparc_regs.u_regs[U_REG_O0] = o0; sparc_regs.psr |= psr_set; sparc_regs.psr &= ~psr_clear; diff --git a/linux/sparc64/set_error.c b/linux/sparc64/set_error.c index 10eb380f..69778e57 100644 --- a/linux/sparc64/set_error.c +++ b/linux/sparc64/set_error.c @@ -10,8 +10,6 @@ sparc64_set_o0_tstate(struct tcb *tcp, const unsigned long o0, const unsigned long tstate_set, const unsigned long tstate_clear) { - if (ptrace_syscall_info_is_valid() && get_regs(tcp) < 0) - return -1; sparc_regs.u_regs[U_REG_O0] = o0; sparc_regs.tstate |= tstate_set; sparc_regs.tstate &= ~tstate_clear;