]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/terminal.c
lxc_setup_tios(): Ignore SIGTTOU and SIGTTIN signals
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Thu, 2 Feb 2017 11:48:35 +0000 (12:48 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 8 Feb 2017 12:50:47 +0000 (13:50 +0100)
commit4dc96430afec0669228e541935640710dffaa9bd
treef87d79085dd7fdc8ac3db057e2c3a771053f835b
parent920da314e664e5f45f6d9cc07b843bd77f79f5e8
lxc_setup_tios(): Ignore SIGTTOU and SIGTTIN signals

Prevent an endless loop while executing lxc-attach in the background:

The kernel might fire SIGTTOU while an ioctl() in tcsetattr()
is executed. When the ioctl() is resumed and retries,
the signal handler interrupts it again.

We can't configure the TTY to stop sending
the signals in the first place since that
is a modification/write to the TTY already.

Still we clear the TOSTOP flag to prevent further signals.

Command to reproduce the hang:
----------------------------
cat > lxc_hang.sh << EOF
/usr/bin/timeout 5s /usr/bin/lxc-attach -n SOMECONTAINER -- /bin/true
EOF
sh lxc_hang.sh    # hangs
----------------------------

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
src/lxc/console.c