diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2019-08-15 20:23:19 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2019-08-15 20:23:19 +0000 |
commit | 37c8cfff11b8691c8ca8c72d122842fc0ae368e3 (patch) | |
tree | 3168ebdb36a0d0cfb44ab1aab9b4f401abf7eed5 | |
parent | 91281fec7823f1cd3df3374fbcbd14af52a3fa1b (diff) | |
download | strace-37c8cfff11b8691c8ca8c72d122842fc0ae368e3.tar.gz |
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.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | linux/sparc/set_error.c | 2 | ||||
-rw-r--r-- | linux/sparc64/set_error.c | 2 |
3 files changed, 1 insertions, 5 deletions
@@ -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 cc6081260..767be69d3 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 10eb380fc..69778e573 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; |