[lxc-devel] [lxc/lxc] 014d5e: make escape sequence to exit tty optional

GitHub noreply at github.com
Sun Feb 21 19:16:37 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 014d5e1e58778bbdca755fbb7e51b6355983cb4d
      https://github.com/lxc/lxc/commit/014d5e1e58778bbdca755fbb7e51b6355983cb4d
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-02-21 (Sun, 21 Feb 2016)

  Changed paths:
    M src/lxc/console.c

  Log Message:
  -----------
  make escape sequence to exit tty optional

We want to reuse lxc_console_cb_tty_stdin() in lxc_attach.c.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 0d4137ccb25910b27e0e648a3aa7506f2541c4e6
      https://github.com/lxc/lxc/commit/0d4137ccb25910b27e0e648a3aa7506f2541c4e6
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-02-21 (Sun, 21 Feb 2016)

  Changed paths:
    M src/lxc/cgmanager.c
    M src/lxc/console.c
    M src/lxc/console.h

  Log Message:
  -----------
  make tty helper functions extern

- lxc_console_cb_tty_stdin()
- lxc_console_cb_tty_master()
- lxc_setup_tios(int fd, struct termios *oldtios);
- lxc_console_winsz(int srcfd, int dstfd);
- lxc_console_cb_sigwinch_fd(int fd, uint32_t events, void *cbdata,
	struct lxc_epoll_descr *descr);
- lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd);
- lxc_console_sigwinch_fini(struct lxc_tty_state *ts);

We can make use these functions in other modules.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 39a78bbef05ed240e62fe4863a5d629de9808ea6
      https://github.com/lxc/lxc/commit/39a78bbef05ed240e62fe4863a5d629de9808ea6
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-02-21 (Sun, 21 Feb 2016)

  Changed paths:
    M src/lxc/console.c
    M src/lxc/console.h
    M src/lxc/start.c

  Log Message:
  -----------
  rewrite lxc_console_set_stdfds

Make lxc_console_set_stdfds useable by other callers that do not have access to
lxc_handler.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 9395937a965ad3a777a3008c0615d9d5722e4460
      https://github.com/lxc/lxc/commit/9395937a965ad3a777a3008c0615d9d5722e4460
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-02-21 (Sun, 21 Feb 2016)

  Changed paths:
    M src/lxc/console.c

  Log Message:
  -----------
  clean exit on EPOLLHUP

lxc_console_cb_tty_masterfd() unnecessarily reported a read/write error when
the fd was closed. This happens e.g. when we have allocated a tty in the
container with lxc-console and we shut the container down. lxc-console will
then exit with an error message. This patch introduces a test whether the
EPOLLHUP bit is set in the events mask. If so, we report no error.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 5eacdc3dbd0e45abf3cc90cf0216a7f8ee560abf
      https://github.com/lxc/lxc/commit/5eacdc3dbd0e45abf3cc90cf0216a7f8ee560abf
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-02-21 (Sun, 21 Feb 2016)

  Changed paths:
    M src/lxc/lxc_attach.c

  Log Message:
  -----------
  make lxc-attach use a pty

So far lxc-attach did not use a pty when attaching to a container. This made it
vulnerable to tty input faking via TIOCSTI when switching to a different user.
This patch makes lxc-attach use a pty in most cases. The only current exemption
is when stdin, stdout, and stderr are not referring to a pty.

There are two ways how lxc-attach can receive a pty:
	1. get a pty in the container
	2. get a pty on the host
This patch makes 1. the default and only opts for 2. when 1. fails before
giving up. The rationale behind this is as follows: If we create a pty on the
host (2.) and pass the fds to the container the container may report "no tty"
when the "tty" command is used. This could be irritating for users when they
expect that lxc-attach now always tries to use a pty. Hence, option 1. is the
default.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: cee1de17853511bea4e7e0a99de3649b5eed176e
      https://github.com/lxc/lxc/commit/cee1de17853511bea4e7e0a99de3649b5eed176e
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2016-02-21 (Sun, 21 Feb 2016)

  Changed paths:
    M src/lxc/cgmanager.c
    M src/lxc/console.c
    M src/lxc/console.h
    M src/lxc/lxc_attach.c
    M src/lxc/start.c

  Log Message:
  -----------
  Merge pull request #825 from brauner/2016-02-15/lxc_attach_pty

make lxc-attach use a pty


Compare: https://github.com/lxc/lxc/compare/0b0958047ad9...cee1de178535


More information about the lxc-devel mailing list