lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150218155627.GF13666@redhat.com>
Date:	Wed, 18 Feb 2015 10:56:28 -0500
From:	Aristeu Rozanski <aris@...hat.com>
To:	Peter Hurley <peter@...leysoftware.com>
Cc:	linux-kernel@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jslaby@...e.cz>
Subject: Re: [PATCH] n_tty_read: check for hanging tty while waiting for input

Hi Peter,
On Wed, Feb 18, 2015 at 10:40:10AM -0500, Peter Hurley wrote:
> The child is not receiving SIGHUP because /dev/ttyS0 was not set as the
> controlling terminal by ioctl(TIOCSCTTY), which is failing (probably
> with errno == EPERM). You need to check the return value and errno.
> 
> To set the controlling tty, the calling process must be a session leader;
> ie., have called setsid() before ioctl(TIOCSCTTY). Check the return value
> for that too.
> 
> FWIW, the idiom for starting a session leader is for the parent to
> fork a child and exit and for the child to become the session leader with
> setsid() and establish its controlling tty either with ioctl(TIOCSCTTY)
> or simply opening the first tty.
> 
> The reason for this idiom is that setsid() will fail for an existing
> group leader (because otherwise a group leader could abandon existing
> members of its process group, leaving them without a group leader in
> a different session).
> 
> I highly recommend Ch 34 of Michael Kerrisk's book, "The Linux Programming
> Interface", especially if this is not a toy project.

Actually wrote this trying to reproduce a problem a customer is seeing
in a commercial application, but clearly I need to read it. Specifically
about the console behavior, would you recommend the same book? Every
time I need details like this I fail to find any reference online.
Thanks for your help

-- 
Aristeu

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ