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


Groups > linux.kernel > #1261953

ptrace and pseudoterminals

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Pavel Labath <labath@google.com>
Newsgroups linux.kernel
Subject ptrace and pseudoterminals
Date Wed, 04 Nov 2015 00:20:02 +0100
Message-ID <qqT1U-RQ-9@gated-at.bofh.it> (permalink)
X-Original-To Oleg Nesterov <oleg@redhat.com>, linux-kernel@vger.kernel.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=XwW4lR9HdEfgt54jBYGeNydT4qgq9I6HA+LpIjpTa/0=; b=D8Qvu5ey+8RvRv3zkSWOunRHPr6EMh/YtxIvME72Ry9kKA5dKZw+PktIvaGjw7kucb yPrA23dE2W7jhBXDQ8tfAYIodSPyPObSWJRR+YemSOOJrZr1wawwDs2y/Z00jQLNbzE4 ndPX3oYn2nM3nXby/au+cJ2PFu7TnYlZYU4k31hceBUwvhCDiFWf7rr94SHENYDsl/kY cnihKhn5kpX11yp7tgAygdwbSVwzbSzKxOtsvs+8mfaDm/ytyaAi34sWa+ulMvkMqU63 djNdqiyHB8shjGplGLnm9PsKi0SqbjEof1jm50BNN095IjmnK8vtNNqalpE280lhf82W i3yQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=XwW4lR9HdEfgt54jBYGeNydT4qgq9I6HA+LpIjpTa/0=; b=i5GngT8dDDb21D00v0lerUBssTBWUIP2jCFy2b5Ih2FBcGK2K/8pZCNyWEtaNEkmKl i/rZ+HHJVh1ZQbqgXu5zROBGGmyVOuduLwuTxdMuyxPn+vmvlkS7wgEJcb4jDSNTY8pz Jni51J9xP3KFnqaH00AaUWSh3N5R/rQYWCbmK/pfA/u6mhw4KNJpaBdvZ7Yf/sxtePUf lsILQqcpTRU7JxPdWdvzSyaxf3QbnMDz9cYJmtV1XwXQfSL3N9VtBsv6wIVfEbNQEl5H dFOnxkp8MwiEI2bqJ2LNj9ZnMQSZDMMqhnDOen8fjRiZHYvt3AJtyVJSpbpvx0b2BiVt JZCA==
X-Gm-Message-State ALoCoQn7cxtitNnrHn8MEAuNurln4UfPephdd95EqlolAFKCtV/HdFF18nBmFYTAgSV1ZEs/NHYl
X-Received by 10.112.131.8 with SMTP id oi8mr11394805lbb.99.1446592639478; Tue, 03 Nov 2015 15:17:19 -0800 (PST)
MIME-Version 1.0
Content-Type multipart/mixed; boundary=e89a8f23501569cbc20523ab18f4
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 72
Organization linux.* mail to news gateway
X-Original-Date Tue, 3 Nov 2015 15:16:59 -0800
X-Original-Message-ID <CAJt8pk_DJbjHFvGiyeg1w62trZjgeGm=2Nrx7iHORCRtXHAyow@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1261953

Show key headers only | 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