Dmitry V. Levin 9284ce55f0 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.
2017-08-04 18:47:59 +00:00

26 lines
556 B
C

/* Return codes: 1 - ok, 0 - ignore, other - error. */
static int
arch_get_scno(struct tcb *tcp)
{
/* Retrieve the syscall trap instruction. */
unsigned long trap;
errno = 0;
trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (void *) sparc_regs.tpc, 0);
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];
return 1;
}