Serge Hallyn | 1 Sep 22:01 2014

[PATCH 1/1] config: fix the handling of lxc.hook and hwaddrs in unexpanded config

And add a testcase.

The code to update hwaddrs in a clone was walking through the container
configuration and re-printing all network entries.  However network
entries from an include file which should not be printed out were being
added to the unexpanded config.  With this patch, at clone we simply
update the hwaddr in-place in the unexpanded configuration file, making
sure to make the same update to the expanded network configuration.

The code to update out lxc.hook statements had the same problem.
We also update it in-place in the unexpanded configuration, though
we mirror the logic we use when updating the expanded configuration.
(Perhaps that should be changed, to simplify future updates)

This code isn't particularly easy to review, so testcases are added
to make sure that (1) extra lxc.network entries are not added (or
removed), even if they are present in an included file, (2) lxc.hook
entries are not added, (3) hwaddr entries are updated, and (4)
the lxc.hook entries are properly updated (only when they should be).

Reported-by: Stéphane Graber <stgraber <at> ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn <at> ubuntu.com>
---
 src/lxc/confile.c              | 231 +++++++++++++++++++++++++----------------
 src/lxc/confile.h              |   5 +-
 src/lxc/lxccontainer.c         |  37 +------
 src/tests/Makefile.am          |   2 +-
 src/tests/lxc-test-cloneconfig | 139 +++++++++++++++++++++++++
 5 files changed, 291 insertions(+), 123 deletions(-)
 create mode 100755 src/tests/lxc-test-cloneconfig
(Continue reading)

Steven Stewart-Gallus | 1 Sep 05:24 2014
Picon

[PATCH V1] Use pivot_root and umount2 instead of chroot

chrooting leaves the old mount information in /proc/mounts and gives
me anxiety. Explicitly switch root directories and unmount the old
root directory.

Signed-off-by: Steven Stewart-Gallus <sstewartgallus00 <at> mylangara.bc.ca>
---

Hello! In my own little sandbox program I use pivot_root and umount2
instead of chroot.  It seems a lot more fool proof to me and also
removes the old mount information from /proc/mounts.  I noticed that
LXC didn't use this technique so I wanted to share it with LXC.
Unfortunately, LXC's build system was mysteriously failing at building
the documentation so I couldn't test this patch.  In any case, I
wanted to discuss the general approach anyways mostly.

Thank you,
Steven Stewart-Gallus

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index ee8f491..38e33f4 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
 <at>  <at>  -3397,10 +3397,17  <at>  <at>  static bool do_add_remove_node(pid_t init_pid, const
char *path, bool add,
 	if (ret < 0 || ret >= MAXPATHLEN)
 		return false;

-	if (chroot(chrootpath) < 0)
+	if (chdir(chrootpath) < 0)
 		exit(1);
(Continue reading)

GitHub | 29 Aug 16:28 2014

[lxc/lxc] d6559c: lxc-cgm: fix issue with nested chowning

  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: d6559c5d09c99e42b532a6259b98d4030dc5b616
      https://github.com/lxc/lxc/commit/d6559c5d09c99e42b532a6259b98d4030dc5b616
  Author: Serge Hallyn <serge.hallyn@...>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M src/lxc/cgmanager.c

  Log Message:
  -----------
  lxc-cgm: fix issue with nested chowning

To ask cgmanager to chown files as an unpriv user, we must send the
request from the container's namespace (with our own userid also
mapped in).  However when we create a new namespace then we must
open a new dbus connection, so that our credential and the credential
on the dbus socket match.  Otherwise the proxy will refuse the request.

Because we were warning about this failure but not exiting, the failure
was not noticed until the unprivileged container went on to try to
administer its cgroups, i.e. creating a container inside itself.

Fix this by having the do_chown_cgroup create a new cgmanager connection.
In order to reduce the number of connections, since the list of subsystems
is global anyway, don't call do_chown_cgroup once for each controller,
just call it once and have it run over all controllers.

(This patch does not change the fact that we don't fail if the
(Continue reading)

Serge Hallyn | 29 Aug 16:20 2014

[PATCH 1/1] lxc-cgm: fix issue with nested chowning

To ask cgmanager to chown files as an unpriv user, we must send the
request from the container's namespace (with our own userid also
mapped in).  However when we create a new namespace then we must
open a new dbus connection, so that our credential and the credential
on the dbus socket match.  Otherwise the proxy will refuse the request.

Because we were warning about this failure but not exiting, the failure
was not noticed until the unprivileged container went on to try to
administer its cgroups, i.e. creating a container inside itself.

Fix this by having the do_chown_cgroup create a new cgmanager connection.
In order to reduce the number of connections, since the list of subsystems
is global anyway, don't call do_chown_cgroup once for each controller,
just call it once and have it run over all controllers.

(This patch does not change the fact that we don't fail if the
chown failed.  I think we should change that, but let's do it in a
later patch)

Reported-by: Stéphane Graber <stgraber <at> ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn <at> ubuntu.com>
---
 src/lxc/cgmanager.c | 61 ++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 22 deletions(-)

diff --git a/src/lxc/cgmanager.c b/src/lxc/cgmanager.c
index 4db61c1..97d19ca 100644
--- a/src/lxc/cgmanager.c
+++ b/src/lxc/cgmanager.c
 <at>  <at>  -261,19 +261,16  <at>  <at>  static bool lxc_cgmanager_escape(void)
(Continue reading)

KATOH Yasufumi | 28 Aug 12:51 2014
Picon

[PATCH v2] Remove a comment part from a config value

When a config line has a comment part, currently the comment part is
included in the value. This patch remove the comment from the value.

Signed-off-by: KATOH Yasufumi <karma <at> jazz.email.ne.jp>
---
 src/lxc/confile.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 5de1241..ec5023c 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
 <at>  <at>  -1700,6 +1700,7  <at>  <at>  static int parse_line(char *buffer, void *data)
 	struct lxc_config_t *config;
 	char *line, *linep;
 	char *dot;
+	char *comment;
 	char *key;
 	char *value;
 	int ret = 0;
 <at>  <at>  -1743,6 +1744,9  <at>  <at>  static int parse_line(char *buffer, void *data)
 	*dot = '\0';
 	value = dot + 1;

+	comment = strstr(value, "#");
+	*comment = '\0';
+
 	key = line;
 	key[lxc_char_right_gc(key, strlen(key))] = '\0';

(Continue reading)

KATOH Yasufumi | 28 Aug 10:38 2014
Picon

[PATCH] Remove a comment part from a config value

When a config line has a comment part, currently the comment part is
included in the value. This patch remove the comment from the value.

Signed-off-by: KATOH Yasufumi <karma <at> jazz.email.ne.jp>
---
 src/lxc/confile.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 5de1241..8aab5d0 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
 <at>  <at>  -1700,6 +1700,7  <at>  <at>  static int parse_line(char *buffer, void *data)
 	struct lxc_config_t *config;
 	char *line, *linep;
 	char *dot;
+        char *comment;
 	char *key;
 	char *value;
 	int ret = 0;
 <at>  <at>  -1743,6 +1744,11  <at>  <at>  static int parse_line(char *buffer, void *data)
 	*dot = '\0';
 	value = dot + 1;

+	comment = strstr(value, "#");
+	if (comment) {
+		*comment = '\0';
+	}
+
 	key = line;
(Continue reading)

GitHub | 27 Aug 16:47 2014

[lxc/lxc] b0e26c: doc: Translate lxc-checkpoint(1) into Japanese

  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: b0e26ca77b3bb9908dda4a27504e805f1b8b5ee0
      https://github.com/lxc/lxc/commit/b0e26ca77b3bb9908dda4a27504e805f1b8b5ee0
  Author: KATOH Yasufumi <karma@...>
  Date:   2014-08-27 (Wed, 27 Aug 2014)

  Changed paths:
    M configure.ac
    M doc/ja/Makefile.am
    A doc/ja/lxc-checkpoint.sgml.in

  Log Message:
  -----------
  doc: Translate lxc-checkpoint(1) into Japanese

Update for commit 735f2c6

Signed-off-by: KATOH Yasufumi <karma@...>
Acked-by: Stéphane Graber <stgraber@...>

_______________________________________________
lxc-devel mailing list
lxc-devel <at> lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel
KATOH Yasufumi | 27 Aug 09:09 2014
Picon

[PATCH] doc: Translate lxc-checkpoint(1) into Japanese

Update for commit 735f2c6

Signed-off-by: KATOH Yasufumi <karma <at> jazz.email.ne.jp>
---
 configure.ac                  |   1 +
 doc/ja/Makefile.am            |   1 +
 doc/ja/lxc-checkpoint.sgml.in | 227 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 229 insertions(+)
 create mode 100644 doc/ja/lxc-checkpoint.sgml.in

diff --git a/configure.ac b/configure.ac
index 882e759..3e73d49 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -692,6 +692,7  <at>  <at>  AC_CONFIG_FILES([
 	doc/ja/lxc-autostart.sgml
 	doc/ja/lxc-cgroup.sgml
 	doc/ja/lxc-checkconfig.sgml
+	doc/ja/lxc-checkpoint.sgml
 	doc/ja/lxc-clone.sgml
 	doc/ja/lxc-config.sgml
 	doc/ja/lxc-console.sgml
diff --git a/doc/ja/Makefile.am b/doc/ja/Makefile.am
index a9c85a9..72e22fe 100644
--- a/doc/ja/Makefile.am
+++ b/doc/ja/Makefile.am
 <at>  <at>  -12,6 +12,7  <at>  <at>  man_MANS = \
 	lxc-autostart.1 \
 	lxc-cgroup.1 \
 	lxc-checkconfig.1 \
(Continue reading)

GitHub | 26 Aug 18:39 2014

[lxc/lxc] 0f9873: Add lxc-restore-net to extra_DIST

  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 0f987303e3642cb3c486ba74e56cd6e138c6b87e
      https://github.com/lxc/lxc/commit/0f987303e3642cb3c486ba74e56cd6e138c6b87e
  Author: Stéphane Graber <stgraber@...>
  Date:   2014-08-26 (Tue, 26 Aug 2014)

  Changed paths:
    M src/lxc/Makefile.am

  Log Message:
  -----------
  Add lxc-restore-net to extra_DIST

Signed-off-by: Stéphane Graber <stgraber@...>

_______________________________________________
lxc-devel mailing list
lxc-devel <at> lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel
Travis CI | 26 Aug 17:19 2014

Fixed: lxc/lxc#656 (master - 188adf0)

lxc / lxc (master)
Build #656 was fixed.
1 minute and 8 seconds
Stéphane Graber 188adf0 Changeset →
  Fix build failure due to wrong test name

Signed-off-by: Stéphane Graber <stgraber-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>

Would you like to test your private code?

Travis Pro could be your new best friend!

_______________________________________________
lxc-devel mailing list
lxc-devel <at> lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel
GitHub | 26 Aug 17:11 2014

[lxc/lxc] 188adf: Fix build failure due to wrong test name

  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 188adf0594f623a1273b89a646402484b6816f90
      https://github.com/lxc/lxc/commit/188adf0594f623a1273b89a646402484b6816f90
  Author: Stéphane Graber <stgraber@...>
  Date:   2014-08-26 (Tue, 26 Aug 2014)

  Changed paths:
    M src/tests/Makefile.am

  Log Message:
  -----------
  Fix build failure due to wrong test name

Signed-off-by: Stéphane Graber <stgraber@...>

_______________________________________________
lxc-devel mailing list
lxc-devel <at> lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Gmane