From 9284ce55f077d69d0d9e857d947b38ea667bd07c Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 4 Aug 2017 18:47:59 +0000 Subject: [PATCH] sparc64: do not bail out in get_scno if PTRACE_PEEKTEXT fails If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3, PTRACE_PEEKTEXT becames unavailable when the process dumpable flag is cleared. As this is not a fatal condition for get_scno, do not bail out if PTRACE_PEEKTEXT fails. This condition is triggered and therefore tested by prctl-dumpable test. * linux/sparc64/get_scno.c (arch_get_scno): Do not bail out if PTRACE_PEEKTEXT fails. --- linux/sparc64/get_scno.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/linux/sparc64/get_scno.c b/linux/sparc64/get_scno.c index 4abe2a1f..81a3aa93 100644 --- a/linux/sparc64/get_scno.c +++ b/linux/sparc64/get_scno.c @@ -6,18 +6,18 @@ arch_get_scno(struct tcb *tcp) unsigned long trap; errno = 0; trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (void *) sparc_regs.tpc, 0); - if (errno) - return -1; - trap >>= 32; - switch (trap) { - case 0x91d02010: - /* Linux/SPARC syscall trap. */ - update_personality(tcp, 1); - break; - case 0x91d0206d: - /* Linux/SPARC64 syscall trap. */ - update_personality(tcp, 0); - break; + if (errno == 0) { + trap >>= 32; + switch (trap) { + case 0x91d02010: + /* Linux/SPARC syscall trap. */ + update_personality(tcp, 1); + break; + case 0x91d0206d: + /* Linux/SPARC64 syscall trap. */ + update_personality(tcp, 0); + break; + } } tcp->scno = sparc_regs.u_regs[U_REG_G1]; -- 2.50.1