From c7e8fc0e63937c7896c0ad4fd2cdcb9868472df4 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 24 Jan 2018 01:56:15 +0000 Subject: [PATCH] ia64: do not bail out in get_syscall_args if umove fails with EPERM If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3, both PTRACE_PEEKDATA and process_vm_readv become unavailable when the process dumpable flag is cleared, on ia64 this results to all syscall arguments being unavailable. Recognize this situation and do not treat it as get_syscall_args error because the latter leaves the tracee in a ptrace stop. This condition used to be triggered by prctl-dumpable test that caused strace to hang indefinitely. * linux/ia64/get_syscall_args.c (get_syscall_args): Do not bail out if umove fails. * tests/prctl-dumpable.c [__ia64__]: Skip the test. --- linux/ia64/get_syscall_args.c | 8 ++++++-- tests/prctl-dumpable.c | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/linux/ia64/get_syscall_args.c b/linux/ia64/get_syscall_args.c index cd305590..80f7404e 100644 --- a/linux/ia64/get_syscall_args.c +++ b/linux/ia64/get_syscall_args.c @@ -15,8 +15,12 @@ get_syscall_args(struct tcb *tcp) for (i = 0; i < tcp->s_ent->nargs; ++i) { if (umove(tcp, (unsigned long) ia64_rse_skip_regs(out0, i), - &tcp->u_arg[i]) < 0) - return -1; + &tcp->u_arg[i]) < 0) { + if (errno == EPERM) + tcp->u_arg[i] = 0; + else + return -1; + } } } else { /* truncate away IVE sign-extension */ diff --git a/tests/prctl-dumpable.c b/tests/prctl-dumpable.c index 1049bcee..e9c0b8ca 100644 --- a/tests/prctl-dumpable.c +++ b/tests/prctl-dumpable.c @@ -32,7 +32,8 @@ #include #include -#if defined __NR_prctl && defined PR_GET_DUMPABLE && defined PR_SET_DUMPABLE +#if defined __NR_prctl && defined PR_GET_DUMPABLE && defined PR_SET_DUMPABLE \ + && !defined __ia64__ # include # include @@ -101,6 +102,7 @@ main(void) #else -SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_DUMPABLE && PR_SET_DUMPABLE") +SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_DUMPABLE && PR_SET_DUMPABLE" + " && !__ia64__") #endif -- 2.40.0