public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/ptrace07: handle potential SIGSEGV on older kernels
Date: Thu, 3 Jan 2019 06:00:58 -0500 (EST)	[thread overview]
Message-ID: <949898479.93116882.1546513258421.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAEemH2eL-C0EcU9T_E6qvhqrHYcR9_vrwNuerP_fK7jUNyNKCQ@mail.gmail.com>



----- Original Message -----
> On Fri, Dec 21, 2018 at 9:51 PM Jan Stancek <jstancek@redhat.com> wrote:
> >
> > If a ptraced test process hits SIGSEGV, the entire testcase hangs.
> >
> > Older kernels such as RHEL7 (3.10.0), check the error code returned
> > by restore_fpu_checking() and do drop_init_fpu() if it fails.
> > So the FPU state of the prev task can't leak.
> >
> > But in the more likely case a task with xcomp_bv != 0 will be killed
> > by SIGSEGV; either from do_device_not_available() or from
> > sys_rt_sigreturn()->__restore_xstate_sig().
> >
> > And this is why the test case hangs; it wrongly assumes that the
> > traced child can only exit and report nothing else. But since it
> > receives SIGSEGV it reports this signal to the main process and
> > sleeps in ptrace_stop(), it does not exit and thus the test-case
> > hangs in tst_reap_children() after return from do_test().
> >
> > Replace PTRACE_CONT with PTRACE_DETACH, so we don't need to
> > handle subsequent stops. And treat exit code from test process
> > as info-only.
> 
> ptrace07(with this patch applied) passed with kernel 3.10 and 4.18
> multi arches test.
> 
> >
> > Debugged-by: Oleg Nesterov <onestero@redhat.com>
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> 
> Tested-by: Li Wang <liwang@redhat.com>

Pushed.

Regards,
Jan

      reply	other threads:[~2019-01-03 11:00 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
2019-01-02  8:14 ` Li Wang
2019-01-03 11:00   ` Jan Stancek [this message]

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=949898479.93116882.1546513258421.JavaMail.zimbra@redhat.com \
    --to=jstancek@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox