Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1261953

ptrace and pseudoterminals

From Pavel Labath <labath@google.com>
Newsgroups linux.kernel
Subject ptrace and pseudoterminals
Date 2015-11-04 00:20 +0100
Message-ID <qqT1U-RQ-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello Oleg, everyone,

I have noticed something, which may be considered a race in the
interaction of ptrace and pseudoterminal interfaces. Basically, what
happens is this:
- we have two processes: A and B. B has the slave end of the pty open,
A has the master. A is tracing B.
- B writes some data through the slave end and then stops.
- A waits for B to stop.
- A does a select on the master pty endpoint. select returns there is
no data available
- later, A tries the select again, and this time the data appears.

We are encountering this (very rare) issue in our debugger test suite,
where we check the stdout of the tracee to make sure it is behaving as
expected. I have attached a small program reproducing this behavior
(it fails after about 1000 iterations on a 3.13.0 kernel, I can retry
it on a newer kernel next week if you believe it might work there).
Interestingly, when I replace the pty with a regular pipe, it works as
expected (the data is available as soon as the program stops).

My question is: Is this behavior something that you would consider a
bug? If yes, do you have any pointers, as to where I should look to
fix it?

kind regards,
pavel

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

ptrace and pseudoterminals Pavel Labath <labath@google.com> - 2015-11-04 00:20 +0100
  Re: ptrace and pseudoterminals Peter Hurley <peter@hurleysoftware.com> - 2015-11-04 18:10 +0100
    Re: ptrace and pseudoterminals Oleg Nesterov <oleg@redhat.com> - 2015-11-04 19:50 +0100
      Re: ptrace and pseudoterminals Peter Hurley <peter@hurleysoftware.com> - 2015-11-05 14:30 +0100
        Re: ptrace and pseudoterminals Pavel Labath <labath@google.com> - 2015-11-05 19:40 +0100
          Re: ptrace and pseudoterminals Peter Hurley <peter@hurleysoftware.com> - 2015-11-05 21:30 +0100

csiph-web