From: Oleg Nesterov <oleg@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/ptrace07: handle potential SIGSEGV on older kernels
Date: Fri, 21 Dec 2018 16:43:33 +0100 [thread overview]
Message-ID: <20181221154333.GA14354@redhat.com> (raw)
In-Reply-To: <b8db71df3a21f600e2a52064df6d2a21ed2195a9.1545400016.git.jstancek@redhat.com>
On 12/21, Jan Stancek wrote:
>
> --- a/testcases/kernel/syscalls/ptrace/ptrace07.c
> +++ b/testcases/kernel/syscalls/ptrace/ptrace07.c
> @@ -153,12 +153,32 @@ static void do_test(void)
> "PTRACE_SETREGSET failed with unexpected error");
> }
>
> - TEST(ptrace(PTRACE_CONT, pid, 0, 0));
> + /*
> + * It is possible for test child 'pid' to crash on AMD
> + * systems (e.g. AMD Opteron(TM) Processor 6234) with
> + * older kernels. This causes tracee to stop and sleep
> + * in ptrace_stop(). Without resuming the tracee, the
> + * test hangs at do_test()->tst_reap_children() called
> + * by the library. Use detach here, so we don't need to
> + * worry about potential stops after this point.
> + */
> + TEST(ptrace(PTRACE_DETACH, pid, 0, 0));
> if (TST_RET != 0)
> - tst_brk(TBROK | TTERRNO, "PTRACE_CONT failed");
> + tst_brk(TBROK | TTERRNO, "PTRACE_DETACH failed");
> +
> + /* If child 'pid' crashes, only report it as info. */
> + SAFE_WAITPID(pid, &status, 0);
> + if (WIFEXITED(status)) {
> + tst_res(TINFO, "test child %d exited, retcode: %d",
> + pid, WEXITSTATUS(status));
> + }
> + if (WIFSIGNALED(status)) {
> + tst_res(TINFO, "test child %d exited, termsig: %d",
> + pid, WTERMSIG(status));
> + }
>
> okay = true;
> - for (i = 0; i < num_cpus + 1; i++) {
> + for (i = 0; i < num_cpus; i++) {
> SAFE_WAIT(&status);
> okay &= (WIFEXITED(status) && WEXITSTATUS(status) == 0);
Thanks Jan!
I think this change is correct.
Oleg.
next prev parent reply other threads:[~2018-12-21 15:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 13:51 [LTP] [PATCH] syscalls/ptrace07: handle potential SIGSEGV on older kernels Jan Stancek
2018-12-21 15:43 ` Oleg Nesterov [this message]
2019-01-02 8:14 ` Li Wang
2019-01-03 11:00 ` Jan Stancek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181221154333.GA14354@redhat.com \
--to=oleg@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.