[lxc-devel] [lxc/lxc] f69980: fix console stdin,stdout,stderr fds

GitHub noreply at github.com
Fri Mar 7 16:37:58 UTC 2014


  Branch: refs/heads/stable-1.0
  Home:   https://github.com/lxc/lxc
  Commit: f699807c1ed0dc224641cb6c0517694bd5e934a8
      https://github.com/lxc/lxc/commit/f699807c1ed0dc224641cb6c0517694bd5e934a8
  Author: Dwight Engen <dwight.engen at oracle.com>
  Date:   2014-03-07 (Fri, 07 Mar 2014)

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

  Log Message:
  -----------
  fix console stdin,stdout,stderr fds

The fds for stdin,stdout,stderr that we were leaving open for /sbin/init
in the container were those from /dev/tty or lxc.console (if given), which
wasn't right. Inside the container it should only have access to the pty
that lxc creates representing the console.

This was noticed because busybox's init was resetting the termio on its
stdin which was effecting the actual users terminal instead of the pty.
This meant it was setting icanon so were were not passing keystrokes
immediately to the pty, and hence command line history/editing wasn't
working.

Fix by dup'ing the console pty to stdin,stdout,stderr just before
exec()ing /sbin/init. Fix fd leak in error handling that I noticed while
going through this code.

Also tested with lxc.console = none, lxc.console = /dev/tty7 and no
lxc.console specified.

Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>


  Commit: dbc3de6a609cd5fb8625df9747129987af339883
      https://github.com/lxc/lxc/commit/dbc3de6a609cd5fb8625df9747129987af339883
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2014-03-07 (Fri, 07 Mar 2014)

  Changed paths:
    M src/lxc/cgmanager.c

  Log Message:
  -----------
  add missing return false on error path

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: 5f1bf6e3547c24168e24f73fe2cd2814dd1d301d
      https://github.com/lxc/lxc/commit/5f1bf6e3547c24168e24f73fe2cd2814dd1d301d
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2014-03-07 (Fri, 07 Mar 2014)

  Changed paths:
    M src/lxc/cgmanager.c

  Log Message:
  -----------
  cgmanager: tell dbus to do locking

Thanks to S.Çağlar for figuring out that we needed this!

Also fix a memory leak found by coverity.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: 8e0d09fc15bb160b95bb7ab49bdd60410234c98f
      https://github.com/lxc/lxc/commit/8e0d09fc15bb160b95bb7ab49bdd60410234c98f
  Author: S.Çağlar Onur <caglar at 10ur.org>
  Date:   2014-03-07 (Fri, 07 Mar 2014)

  Changed paths:
    M src/tests/concurrent.c

  Log Message:
  -----------
  wait 15 seconds instead of forever and produce debug logs for further analyze

Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: 88895aba5bb194c6492221db27411950ae538a94
      https://github.com/lxc/lxc/commit/88895aba5bb194c6492221db27411950ae538a94
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2014-03-07 (Fri, 07 Mar 2014)

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

  Log Message:
  -----------
  Revert "fix console stdin,stdout,stderr fds"

This reverts commit 1da0ad1e0adff18c6d588772146eb054440db95b.


  Commit: 6485e01d30f345221f3fdc29d0f22f0e39aecbd7
      https://github.com/lxc/lxc/commit/6485e01d30f345221f3fdc29d0f22f0e39aecbd7
  Author: S.Çağlar Onur <caglar at 10ur.org>
  Date:   2014-03-07 (Fri, 07 Mar 2014)

  Changed paths:
    M src/lxc/log.c

  Log Message:
  -----------
  put shared variables into thread-local storage

This doesn't solve the general design problem of the log.c (eg; some log lines
got lost or scattered into multiple files) but at least prevent multithreaded
code from crashing.

Before this change something like following;

sudo src/tests/lxc-test-concurrent -i 10 -j 20

was crashing nearly all the time due to 3afbcc4600a as we started to
set lxc.loglevel and lxc.logfile with that commit.

Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: 2c529221b4709b26ecb7e97aabb75d4f5d1fdf95
      https://github.com/lxc/lxc/commit/2c529221b4709b26ecb7e97aabb75d4f5d1fdf95
  Author: S.Çağlar Onur <caglar at 10ur.org>
  Date:   2014-03-07 (Fri, 07 Mar 2014)

  Changed paths:
    M src/lxc/log.c
    M src/lxc/log.h

  Log Message:
  -----------
  add shared lxc_log_fd into TLS

Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


Compare: https://github.com/lxc/lxc/compare/0faa844caee7...2c529221b470


More information about the lxc-devel mailing list