* [PATCH] lxc: always strdup lxc.rootfs.mount @ 2014-02-10 13:09 Josep Puigdemont 2014-02-10 14:06 ` David Nyström 0 siblings, 1 reply; 5+ messages in thread From: Josep Puigdemont @ 2014-02-10 13:09 UTC (permalink / raw) To: meta-virtualization The reason is that the generic code which handles reading lxc.rootfs.mount always frees the old value if not NULL. So without this setting lxc.rootfs.mount = /mnt causes segfault. This is a backport for lxc-0.9.0 (dora) of the same fix found in upstream's master, see commits 54c30e29 and 53f3f048. Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com> --- .../lxc-0.9.0-always-strdup-rootfs-mount.patch | 27 ++++++++++++++++++++ recipes-containers/lxc/lxc_0.9.0.bb | 1 + 2 files changed, 28 insertions(+) create mode 100644 recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch diff --git a/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch new file mode 100644 index 0000000..3e299d2 --- /dev/null +++ b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch @@ -0,0 +1,27 @@ +diff --git a/src/lxc/conf.c b/src/lxc/conf.c +index 6b3f318..2f8b9e6 100644 +--- a/src/lxc/conf.c ++++ b/src/lxc/conf.c +@@ -2072,7 +2072,12 @@ struct lxc_conf *lxc_conf_init(void) + new->console.slave = -1; + new->console.name[0] = '\0'; + new->maincmd_fd = -1; +- new->rootfs.mount = default_rootfs_mount; ++ new->rootfs.mount = strdup(default_rootfs_mount); ++ if (!new->rootfs.mount) { ++ ERROR("lxc_conf_init : %m"); ++ free(new); ++ return NULL; ++ } + new->kmsg = 1; + lxc_list_init(&new->cgroup); + lxc_list_init(&new->network); +@@ -3084,7 +3089,7 @@ void lxc_conf_free(struct lxc_conf *conf) + return; + if (conf->console.path) + free(conf->console.path); +- if (conf->rootfs.mount != default_rootfs_mount) ++ if (conf->rootfs.mount) + free(conf->rootfs.mount); + if (conf->rootfs.path) + free(conf->rootfs.path); diff --git a/recipes-containers/lxc/lxc_0.9.0.bb b/recipes-containers/lxc/lxc_0.9.0.bb index 8f7736b..fceefff 100644 --- a/recipes-containers/lxc/lxc_0.9.0.bb +++ b/recipes-containers/lxc/lxc_0.9.0.bb @@ -26,6 +26,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${PN}-${PV}.tar.gz \ file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch \ file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \ file://lxc-0.9.0-don-t-let-LXC_PATH-end-in-failure.patch \ + file://lxc-0.9.0-always-strdup-rootfs-mount.patch \ " SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9" SRC_URI[sha256sum] = "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120" -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] lxc: always strdup lxc.rootfs.mount 2014-02-10 13:09 [PATCH] lxc: always strdup lxc.rootfs.mount Josep Puigdemont @ 2014-02-10 14:06 ` David Nyström 2014-02-10 16:23 ` Bruce Ashfield 0 siblings, 1 reply; 5+ messages in thread From: David Nyström @ 2014-02-10 14:06 UTC (permalink / raw) To: Josep Puigdemont, meta-virtualization On 2014-02-10 14:09, Josep Puigdemont wrote: > The reason is that the generic code which handles reading lxc.rootfs.mount > always frees the old value if not NULL. So without this setting > lxc.rootfs.mount = /mnt causes segfault. > > This is a backport for lxc-0.9.0 (dora) of the same fix found in > upstream's master, see commits 54c30e29 and 53f3f048. > > Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com> > --- > .../lxc-0.9.0-always-strdup-rootfs-mount.patch | 27 ++++++++++++++++++++ > recipes-containers/lxc/lxc_0.9.0.bb | 1 + > 2 files changed, 28 insertions(+) > create mode 100644 recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch > > diff --git a/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch > new file mode 100644 > index 0000000..3e299d2 > --- /dev/null > +++ b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch > @@ -0,0 +1,27 @@ > +diff --git a/src/lxc/conf.c b/src/lxc/conf.c > +index 6b3f318..2f8b9e6 100644 > +--- a/src/lxc/conf.c > ++++ b/src/lxc/conf.c > +@@ -2072,7 +2072,12 @@ struct lxc_conf *lxc_conf_init(void) > + new->console.slave = -1; > + new->console.name[0] = '\0'; > + new->maincmd_fd = -1; > +- new->rootfs.mount = default_rootfs_mount; > ++ new->rootfs.mount = strdup(default_rootfs_mount); > ++ if (!new->rootfs.mount) { > ++ ERROR("lxc_conf_init : %m"); > ++ free(new); > ++ return NULL; > ++ } > + new->kmsg = 1; > + lxc_list_init(&new->cgroup); > + lxc_list_init(&new->network); > +@@ -3084,7 +3089,7 @@ void lxc_conf_free(struct lxc_conf *conf) > + return; > + if (conf->console.path) > + free(conf->console.path); > +- if (conf->rootfs.mount != default_rootfs_mount) > ++ if (conf->rootfs.mount) > + free(conf->rootfs.mount); > + if (conf->rootfs.path) > + free(conf->rootfs.path); > diff --git a/recipes-containers/lxc/lxc_0.9.0.bb b/recipes-containers/lxc/lxc_0.9.0.bb > index 8f7736b..fceefff 100644 > --- a/recipes-containers/lxc/lxc_0.9.0.bb > +++ b/recipes-containers/lxc/lxc_0.9.0.bb > @@ -26,6 +26,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${PN}-${PV}.tar.gz \ > file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch \ > file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \ > file://lxc-0.9.0-don-t-let-LXC_PATH-end-in-failure.patch \ > + file://lxc-0.9.0-always-strdup-rootfs-mount.patch \ > " > SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9" > SRC_URI[sha256sum] = "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120" > Reviewed-by: David Nyström <david.nystrom@enea.com> Minor nitpicking, please add the branch name in the subject as: [dora][PATCH]blah for future patches, unless its for master. Br, David ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] lxc: always strdup lxc.rootfs.mount 2014-02-10 14:06 ` David Nyström @ 2014-02-10 16:23 ` Bruce Ashfield 2014-02-10 19:10 ` David Nystrom 0 siblings, 1 reply; 5+ messages in thread From: Bruce Ashfield @ 2014-02-10 16:23 UTC (permalink / raw) To: David Nyström; +Cc: meta-virtualization@yoctoproject.org On Mon, Feb 10, 2014 at 9:06 AM, David Nyström <david.nystrom@enea.com> wrote: > On 2014-02-10 14:09, Josep Puigdemont wrote: >> >> The reason is that the generic code which handles reading lxc.rootfs.mount >> always frees the old value if not NULL. So without this setting >> lxc.rootfs.mount = /mnt causes segfault. >> >> This is a backport for lxc-0.9.0 (dora) of the same fix found in >> upstream's master, see commits 54c30e29 and 53f3f048. >> >> Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com> >> --- >> .../lxc-0.9.0-always-strdup-rootfs-mount.patch | 27 >> ++++++++++++++++++++ >> recipes-containers/lxc/lxc_0.9.0.bb | 1 + >> 2 files changed, 28 insertions(+) >> create mode 100644 >> recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch >> >> diff --git >> a/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch >> b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch >> new file mode 100644 >> index 0000000..3e299d2 >> --- /dev/null >> +++ >> b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch >> @@ -0,0 +1,27 @@ >> +diff --git a/src/lxc/conf.c b/src/lxc/conf.c >> +index 6b3f318..2f8b9e6 100644 >> +--- a/src/lxc/conf.c >> ++++ b/src/lxc/conf.c >> +@@ -2072,7 +2072,12 @@ struct lxc_conf *lxc_conf_init(void) >> + new->console.slave = -1; >> + new->console.name[0] = '\0'; >> + new->maincmd_fd = -1; >> +- new->rootfs.mount = default_rootfs_mount; >> ++ new->rootfs.mount = strdup(default_rootfs_mount); >> ++ if (!new->rootfs.mount) { >> ++ ERROR("lxc_conf_init : %m"); >> ++ free(new); >> ++ return NULL; >> ++ } >> + new->kmsg = 1; >> + lxc_list_init(&new->cgroup); >> + lxc_list_init(&new->network); >> +@@ -3084,7 +3089,7 @@ void lxc_conf_free(struct lxc_conf *conf) >> + return; >> + if (conf->console.path) >> + free(conf->console.path); >> +- if (conf->rootfs.mount != default_rootfs_mount) >> ++ if (conf->rootfs.mount) >> + free(conf->rootfs.mount); >> + if (conf->rootfs.path) >> + free(conf->rootfs.path); >> diff --git a/recipes-containers/lxc/lxc_0.9.0.bb >> b/recipes-containers/lxc/lxc_0.9.0.bb >> index 8f7736b..fceefff 100644 >> --- a/recipes-containers/lxc/lxc_0.9.0.bb >> +++ b/recipes-containers/lxc/lxc_0.9.0.bb >> @@ -26,6 +26,7 @@ SRC_URI = >> "http://linuxcontainers.org/downloads/${PN}-${PV}.tar.gz \ >> >> file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch >> \ >> file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \ >> file://lxc-0.9.0-don-t-let-LXC_PATH-end-in-failure.patch \ >> + file://lxc-0.9.0-always-strdup-rootfs-mount.patch \ >> " >> SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9" >> SRC_URI[sha256sum] = >> "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120" >> > > Reviewed-by: David Nyström <david.nystrom@enea.com> > > Minor nitpicking, please add the branch name in the subject as: > [dora][PATCH]blah for future patches, unless its for master. Agreed. But in this case, don't we also want this on master ? The dora and master version of lxc are the same, so doesn't this fix apply to both branches ? Bruce > > Br, > David > > > _______________________________________________ > meta-virtualization mailing list > meta-virtualization@yoctoproject.org > https://lists.yoctoproject.org/listinfo/meta-virtualization -- "Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end" ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] lxc: always strdup lxc.rootfs.mount 2014-02-10 16:23 ` Bruce Ashfield @ 2014-02-10 19:10 ` David Nystrom 2014-02-11 20:48 ` Bruce Ashfield 0 siblings, 1 reply; 5+ messages in thread From: David Nystrom @ 2014-02-10 19:10 UTC (permalink / raw) To: Bruce Ashfield; +Cc: meta-virtualization [-- Attachment #1: Type: text/plain, Size: 4278 bytes --] On 10 Feb 2014 17:23, "Bruce Ashfield" <bruce.ashfield@gmail.com> wrote: > > On Mon, Feb 10, 2014 at 9:06 AM, David Nyström <david.nystrom@enea.com> wrote: > > On 2014-02-10 14:09, Josep Puigdemont wrote: > >> > >> The reason is that the generic code which handles reading lxc.rootfs.mount > >> always frees the old value if not NULL. So without this setting > >> lxc.rootfs.mount = /mnt causes segfault. > >> > >> This is a backport for lxc-0.9.0 (dora) of the same fix found in > >> upstream's master, see commits 54c30e29 and 53f3f048. > >> > >> Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com> > >> --- > >> .../lxc-0.9.0-always-strdup-rootfs-mount.patch | 27 > >> ++++++++++++++++++++ > >> recipes-containers/lxc/lxc_0.9.0.bb | 1 + > >> 2 files changed, 28 insertions(+) > >> create mode 100644 > >> recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch > >> > >> diff --git > >> a/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch > >> b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch > >> new file mode 100644 > >> index 0000000..3e299d2 > >> --- /dev/null > >> +++ > >> b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch > >> @@ -0,0 +1,27 @@ > >> +diff --git a/src/lxc/conf.c b/src/lxc/conf.c > >> +index 6b3f318..2f8b9e6 100644 > >> +--- a/src/lxc/conf.c > >> ++++ b/src/lxc/conf.c > >> +@@ -2072,7 +2072,12 @@ struct lxc_conf *lxc_conf_init(void) > >> + new->console.slave = -1; > >> + new->console.name[0] = '\0'; > >> + new->maincmd_fd = -1; > >> +- new->rootfs.mount = default_rootfs_mount; > >> ++ new->rootfs.mount = strdup(default_rootfs_mount); > >> ++ if (!new->rootfs.mount) { > >> ++ ERROR("lxc_conf_init : %m"); > >> ++ free(new); > >> ++ return NULL; > >> ++ } > >> + new->kmsg = 1; > >> + lxc_list_init(&new->cgroup); > >> + lxc_list_init(&new->network); > >> +@@ -3084,7 +3089,7 @@ void lxc_conf_free(struct lxc_conf *conf) > >> + return; > >> + if (conf->console.path) > >> + free(conf->console.path); > >> +- if (conf->rootfs.mount != default_rootfs_mount) > >> ++ if (conf->rootfs.mount) > >> + free(conf->rootfs.mount); > >> + if (conf->rootfs.path) > >> + free(conf->rootfs.path); > >> diff --git a/recipes-containers/lxc/lxc_0.9.0.bb > >> b/recipes-containers/lxc/lxc_0.9.0.bb > >> index 8f7736b..fceefff 100644 > >> --- a/recipes-containers/lxc/lxc_0.9.0.bb > >> +++ b/recipes-containers/lxc/lxc_0.9.0.bb > >> @@ -26,6 +26,7 @@ SRC_URI = > >> "http://linuxcontainers.org/downloads/${PN}-${PV}.tar.gz \ > >> > >> file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch > >> \ > >> file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \ > >> file://lxc-0.9.0-don-t-let-LXC_PATH-end-in-failure.patch \ > >> + file://lxc-0.9.0-always-strdup-rootfs-mount.patch \ > >> " > >> SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9" > >> SRC_URI[sha256sum] = > >> "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120" > >> > > > > Reviewed-by: David Nyström <david.nystrom@enea.com> > > > > Minor nitpicking, please add the branch name in the subject as: > > [dora][PATCH]blah for future patches, unless its for master. > > Agreed. But in this case, don't we also want this on master ? The dora and > master version of lxc are the same, so doesn't this fix apply to both branches ? Yes, you are correct. Misunderstanding on my behalf. Br, David > Bruce > > > > > Br, > > David > > > > > > _______________________________________________ > > meta-virtualization mailing list > > meta-virtualization@yoctoproject.org > > https://lists.yoctoproject.org/listinfo/meta-virtualization > > > > -- > "Thou shalt not follow the NULL pointer, for chaos and madness await > thee at its end" > _______________________________________________ > meta-virtualization mailing list > meta-virtualization@yoctoproject.org > https://lists.yoctoproject.org/listinfo/meta-virtualization [-- Attachment #2: Type: text/html, Size: 6420 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] lxc: always strdup lxc.rootfs.mount 2014-02-10 19:10 ` David Nystrom @ 2014-02-11 20:48 ` Bruce Ashfield 0 siblings, 0 replies; 5+ messages in thread From: Bruce Ashfield @ 2014-02-11 20:48 UTC (permalink / raw) To: David Nystrom; +Cc: meta-virtualization@yoctoproject.org On Mon, Feb 10, 2014 at 2:10 PM, David Nystrom <david.c.nystrom@gmail.com> wrote: > > On 10 Feb 2014 17:23, "Bruce Ashfield" <bruce.ashfield@gmail.com> wrote: >> >> On Mon, Feb 10, 2014 at 9:06 AM, David Nyström <david.nystrom@enea.com> >> wrote: >> > On 2014-02-10 14:09, Josep Puigdemont wrote: >> >> >> >> The reason is that the generic code which handles reading >> >> lxc.rootfs.mount >> >> always frees the old value if not NULL. So without this setting >> >> lxc.rootfs.mount = /mnt causes segfault. >> >> >> >> This is a backport for lxc-0.9.0 (dora) of the same fix found in >> >> upstream's master, see commits 54c30e29 and 53f3f048. >> >> >> >> Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com> >> >> --- >> >> .../lxc-0.9.0-always-strdup-rootfs-mount.patch | 27 >> >> ++++++++++++++++++++ >> >> recipes-containers/lxc/lxc_0.9.0.bb | 1 + >> >> 2 files changed, 28 insertions(+) >> >> create mode 100644 >> >> recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch >> >> >> >> diff --git >> >> >> >> a/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch >> >> >> >> b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch >> >> new file mode 100644 >> >> index 0000000..3e299d2 >> >> --- /dev/null >> >> +++ >> >> >> >> b/recipes-containers/lxc/files/lxc-0.9.0-always-strdup-rootfs-mount.patch >> >> @@ -0,0 +1,27 @@ >> >> +diff --git a/src/lxc/conf.c b/src/lxc/conf.c >> >> +index 6b3f318..2f8b9e6 100644 >> >> +--- a/src/lxc/conf.c >> >> ++++ b/src/lxc/conf.c >> >> +@@ -2072,7 +2072,12 @@ struct lxc_conf *lxc_conf_init(void) >> >> + new->console.slave = -1; >> >> + new->console.name[0] = '\0'; >> >> + new->maincmd_fd = -1; >> >> +- new->rootfs.mount = default_rootfs_mount; >> >> ++ new->rootfs.mount = strdup(default_rootfs_mount); >> >> ++ if (!new->rootfs.mount) { >> >> ++ ERROR("lxc_conf_init : %m"); >> >> ++ free(new); >> >> ++ return NULL; >> >> ++ } >> >> + new->kmsg = 1; >> >> + lxc_list_init(&new->cgroup); >> >> + lxc_list_init(&new->network); >> >> +@@ -3084,7 +3089,7 @@ void lxc_conf_free(struct lxc_conf *conf) >> >> + return; >> >> + if (conf->console.path) >> >> + free(conf->console.path); >> >> +- if (conf->rootfs.mount != default_rootfs_mount) >> >> ++ if (conf->rootfs.mount) >> >> + free(conf->rootfs.mount); >> >> + if (conf->rootfs.path) >> >> + free(conf->rootfs.path); >> >> diff --git a/recipes-containers/lxc/lxc_0.9.0.bb >> >> b/recipes-containers/lxc/lxc_0.9.0.bb >> >> index 8f7736b..fceefff 100644 >> >> --- a/recipes-containers/lxc/lxc_0.9.0.bb >> >> +++ b/recipes-containers/lxc/lxc_0.9.0.bb >> >> @@ -26,6 +26,7 @@ SRC_URI = >> >> "http://linuxcontainers.org/downloads/${PN}-${PV}.tar.gz \ >> >> >> >> >> >> file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch >> >> \ >> >> file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \ >> >> file://lxc-0.9.0-don-t-let-LXC_PATH-end-in-failure.patch \ >> >> + file://lxc-0.9.0-always-strdup-rootfs-mount.patch \ >> >> " >> >> SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9" >> >> SRC_URI[sha256sum] = >> >> "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120" >> >> >> > >> > Reviewed-by: David Nyström <david.nystrom@enea.com> >> > >> > Minor nitpicking, please add the branch name in the subject as: >> > [dora][PATCH]blah for future patches, unless its for master. >> >> Agreed. But in this case, don't we also want this on master ? The dora and >> master version of lxc are the same, so doesn't this fix apply to both >> branches ? > > Yes, you are correct. > Misunderstanding on my behalf. I wouldn't say that, since the patch was definitely intended for dora (with it's context), but the reject was trivial to resolve. I did a build test on master and all looks fine. So I went ahead and pushed this to dora and master. Bruce > > Br, > David > >> Bruce >> >> > >> > Br, >> > David >> > >> > >> > _______________________________________________ >> > meta-virtualization mailing list >> > meta-virtualization@yoctoproject.org >> > https://lists.yoctoproject.org/listinfo/meta-virtualization >> >> >> >> -- >> "Thou shalt not follow the NULL pointer, for chaos and madness await >> thee at its end" >> _______________________________________________ >> meta-virtualization mailing list >> meta-virtualization@yoctoproject.org >> https://lists.yoctoproject.org/listinfo/meta-virtualization -- "Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end" ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-11 20:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-02-10 13:09 [PATCH] lxc: always strdup lxc.rootfs.mount Josep Puigdemont 2014-02-10 14:06 ` David Nyström 2014-02-10 16:23 ` Bruce Ashfield 2014-02-10 19:10 ` David Nystrom 2014-02-11 20:48 ` Bruce Ashfield
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.