To: Stephen Smalley Cc: selinux@tycho.nsa.gov From: Laurent Bigonville Message-ID: Date: Sat, 15 Jul 2017 00:38:27 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------9DFF8C2337C38CB76161049A" Subject: Re: open_init_pty: Do not make stdin and stdout non-blocking List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: This is a multi-part message in MIME format. --------------9DFF8C2337C38CB76161049A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > commit fb081eb64b36a9de5a43f3d69d9e628b6eb1afc7 (HEAD -> master, > origin/master) > Author: Stephen Smalley > Date: Mon Jul 10 13:03:01 2017 -0400 > > open_init_pty: Do not make stdin and stdout non-blocking > > It is unclear why this was being done in the first place, and > it has caused multiple bugs with run_init/open_init_pty usage. > > Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863187 > Fixes: https://bugs.gentoo.org/show_bug.cgi?id=621062 > Signed-off-by: Stephen Smalley I see you fixed the issue with run_init/open_init_pty messing up with the terminals but I think it's introducing an other issue :/ FTR I found the reason why stdin/stdout were not blocking, it's a fix for this: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474956#10 Apparently if the descriptors are closed, open_init_pty hangs, example: ./open_init_pty bash -c 'echo hello; exec >&- 2>&- <&-; sleep 1; ' --------------9DFF8C2337C38CB76161049A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

commit fb081eb64b36a9de5a43f3d69d9e628b6eb1afc7 (HEAD -> master, origin/master)
Author: Stephen Smalley <sds@tycho.nsa.gov>
Date:=C2=A0=C2=A0 Mon Jul 10 13:03:01 2017 -0400

=C2=A0=C2=A0=C2=A0 open_init_pty: Do not make stdin and stdout no= n-blocking
=C2=A0=C2=A0 =C2=A0
=C2=A0=C2=A0=C2=A0 It is unclear why this was being done in the f= irst place, and
=C2=A0=C2=A0=C2=A0 it has caused multiple bugs with run_init/open= _init_pty usage.
=C2=A0=C2=A0 =C2=A0
=C2=A0=C2=A0=C2=A0 Fixes: https://bugs.debian.org/cgi-bin/bug= report.cgi?bug=3D863187
=C2=A0=C2=A0=C2=A0 Fixes: https://bugs.gentoo= .org/show_bug.cgi?id=3D621062
=C2=A0=C2=A0=C2=A0 Signed-off-by: Stephen Smalley <sds@tycho.nsa.g= ov>

I see you fixed the issue with run_init/open_init_pty messing up with the terminals but I think it's introducing an other issue :/

FTR I found the reason why stdin/stdout were not blocking, it's a fix for this: https://bugs.debian.org/cgi-bin/bu= greport.cgi?bug=3D474956#10

Apparently if the descriptors are closed, open_init_pty hangs, example:

./open_init_pty bash -c 'echo hello; exec >=
&- 2>&- <&-; sleep 1; '
--------------9DFF8C2337C38CB76161049A--