* [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/
@ 2015-09-05 8:08 Markos Chandras
0 siblings, 0 replies; 8+ messages in thread
From: Markos Chandras @ 2015-09-05 8:08 UTC (permalink / raw
To: gentoo-commits
commit: 47806fd2a04808de420a72fa58ce89ef3c6c777f
Author: Markos Chandras <hwoarang <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 5 07:06:10 2015 +0000
Commit: Markos Chandras <hwoarang <AT> gentoo <DOT> org>
CommitDate: Sat Sep 5 08:08:22 2015 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47806fd2
app-emulation/lxc: Improve init script for shutting down containers. Bug #556826
Package-Manager: portage-2.2.20.1
app-emulation/lxc/files/lxc.initd.3 | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
diff --git a/app-emulation/lxc/files/lxc.initd.3 b/app-emulation/lxc/files/lxc.initd.3
index c9ef999..0920854 100644
--- a/app-emulation/lxc/files/lxc.initd.3
+++ b/app-emulation/lxc/files/lxc.initd.3
@@ -111,29 +111,8 @@ stop() {
return 0
fi
- init_pid=$(lxc-info -n ${CONTAINER} --pid | awk '{ print $2 }')
-
- if [ -z "${init_pid}" ]; then
- ewarn "${CONTAINER} doesn't seem to be running."
- return 0
- fi
-
- ebegin "Shutting down system in ${CONTAINER}"
- kill -PWR ${init_pid}
- eend $?
-
- TIMEOUT=${TIMEOUT:-30}
- i=0
- while [ -n "$(pgrep -P ${init_pid})" -a $i -lt ${TIMEOUT} ]; do
- sleep 1
- i=$(expr $i + 1)
- done
-
- if [ -n "${missingprocs}" ]; then
- ewarn "Something failed to properly shut down in ${CONTAINER}"
- fi
-
+ # 10s should be enough to shut everything down
ebegin "Stopping ${CONTAINER}"
- lxc-stop -n ${CONTAINER}
+ lxc-stop -t 10 -n ${CONTAINER}
eend $?
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/
@ 2016-02-08 21:37 Sven Wegener
0 siblings, 0 replies; 8+ messages in thread
From: Sven Wegener @ 2016-02-08 21:37 UTC (permalink / raw
To: gentoo-commits
commit: c99f5cf50b84b14bd6f0f47e45321dd31a7fe017
Author: Sven Wegener <swegener <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 8 21:01:36 2016 +0000
Commit: Sven Wegener <swegener <AT> gentoo <DOT> org>
CommitDate: Mon Feb 8 21:37:37 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c99f5cf5
app-emulation/lxc: Use rm -f
Signed-off-by: Sven Wegener <swegener <AT> gentoo.org>
app-emulation/lxc/files/lxc.initd.3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app-emulation/lxc/files/lxc.initd.3 b/app-emulation/lxc/files/lxc.initd.3
index 0920854..970fba7 100644
--- a/app-emulation/lxc/files/lxc.initd.3
+++ b/app-emulation/lxc/files/lxc.initd.3
@@ -79,7 +79,7 @@ depend() {
start() {
checkconfig || return 1
- rm /var/log/lxc/${CONTAINER}.log
+ rm -f /var/log/lxc/${CONTAINER}.log
rootpath=$(lxc_get_var lxc.rootfs)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/
@ 2016-08-24 10:38 Pacho Ramos
0 siblings, 0 replies; 8+ messages in thread
From: Pacho Ramos @ 2016-08-24 10:38 UTC (permalink / raw
To: gentoo-commits
commit: 59d319d160b3d02d6ab0845bec8823589927f232
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 24 10:30:12 2016 +0000
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Wed Aug 24 10:37:46 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59d319d1
app-emulation/lxc: Drop old
Package-Manager: portage-2.3.0
.../lxc/files/lxc-1.1.0-fix-gentoo-template.patch | 35 ------
app-emulation/lxc/files/lxc-1.1.1-shm-tmpfs.patch | 31 ------
.../lxc-1.1.2-fix-gentoo-moresecure-template.patch | 33 ------
.../lxc/files/lxc-1.1.3-bash-completion.patch | 35 ------
.../lxc/files/lxc-2.0.1-bash-completion.patch | 31 ------
.../lxc/files/lxc-2.0.1-omit-sysconfig.patch | 5 -
app-emulation/lxc/files/lxc.initd.4 | 119 ---------------------
app-emulation/lxc/files/lxc_at.service.2 | 14 ---
app-emulation/lxc/files/lxc_at.service.3 | 15 ---
9 files changed, 318 deletions(-)
diff --git a/app-emulation/lxc/files/lxc-1.1.0-fix-gentoo-template.patch b/app-emulation/lxc/files/lxc-1.1.0-fix-gentoo-template.patch
deleted file mode 100644
index 3514186..00000000
--- a/app-emulation/lxc/files/lxc-1.1.0-fix-gentoo-template.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 425aa66d33e1833cfa47b988785def8b42b72f1a Mon Sep 17 00:00:00 2001
-From: Markos Chandras <hwoarang@gentoo.org>
-Date: Sun, 22 Feb 2015 01:25:36 +0200
-Subject: [PATCH] templates/lxc-gentoo.in: Fix stage3 autodetection code
-
-The latest-stage3-$variant.txt files list both the tarball name
-and the released date but we only need to pass the stage3 tarball
-name to the subsequent wget command otherwise we end up with 404
-errors.
-
-Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
----
-Different patches have been posted to the mailing lists or github so this is
-likely to be fixed upstream really soon
----
- templates/lxc-gentoo.in | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/templates/lxc-gentoo.in b/templates/lxc-gentoo.in
-index 5a87866..464c948 100644
---- a/templates/lxc-gentoo.in
-+++ b/templates/lxc-gentoo.in
-@@ -160,7 +160,8 @@ cache_stage3()
- printf "Determining path to latest Gentoo %s (%s) stage3 archive...\n" "${arch}" "${variant}"
- printf " => downloading and processing %s\n" "${stage3_pointer}"
-
-- local stage3_latest_tarball=$(wget -q -O - "${stage3_pointer}" | tail -n1 ) \
-+ local stage3_latest_tarball=$(wget -q -O - "${stage3_pointer}" | \
-+ tail -n1 | cut -d " " -f 1) \
- || die 6 "Error: unable to fetch\n"
-
- printf " => Got: %s\n" "${stage3_latest_tarball}"
---
-2.3.0
-
diff --git a/app-emulation/lxc/files/lxc-1.1.1-shm-tmpfs.patch b/app-emulation/lxc/files/lxc-1.1.1-shm-tmpfs.patch
deleted file mode 100644
index 7c8f595..00000000
--- a/app-emulation/lxc/files/lxc-1.1.1-shm-tmpfs.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 7ed54c6155982bd8376fdb88bed79c664d5e111f Mon Sep 17 00:00:00 2001
-From: Markos Chandras <hwoarang@gentoo.org>
-Date: Thu, 12 Mar 2015 20:52:11 +0000
-Subject: [PATCH] templates: gentoo.common: Add /dev/shm tmpfs mount entry
-
-/dev/shm needs to be mounted as tmpfs. It's needed by python
-and possibly other packages.
-
-Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
----
-Applied in master but not in 1.1.1. It will probably make it
-to 1.1.2
----
- config/templates/gentoo.common.conf.in | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/config/templates/gentoo.common.conf.in b/config/templates/gentoo.common.conf.in
-index ca3ffc1..49cd411 100644
---- a/config/templates/gentoo.common.conf.in
-+++ b/config/templates/gentoo.common.conf.in
-@@ -21,3 +21,7 @@ lxc.cgroup.devices.allow = c 10:232 rwm
- ## To use loop devices, copy the following line to the container's
- ## configuration file (uncommented).
- #lxc.cgroup.devices.allow = b 7:* rwm
-+
-+# /dev/shm needs to be mounted as tmpfs. It's needed by python (bug #496328)
-+# and possibly other packages.
-+lxc.mount.entry = none dev/shm tmpfs rw,nosuid,nodev,create=dir
---
-2.3.2
-
diff --git a/app-emulation/lxc/files/lxc-1.1.2-fix-gentoo-moresecure-template.patch b/app-emulation/lxc/files/lxc-1.1.2-fix-gentoo-moresecure-template.patch
deleted file mode 100644
index 86a4144..00000000
--- a/app-emulation/lxc/files/lxc-1.1.2-fix-gentoo-moresecure-template.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Patch from https://github.com/lxc/lxc/pull/563 didn't make it to stable-1.1
-yes so lets just include it here in case it doesn't end up in 1.1.X in the
-future.
-
-Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
-
-From bc19636d587fbabfbc2252f1bf4887fee87bb247 Mon Sep 17 00:00:00 2001
-From: Dennis Schridde <devurandom@gmx.net>
-Date: Thu, 11 Jun 2015 15:21:19 +0200
-Subject: [PATCH] Fix creation of dev/mqueue and dev/shm on Gentoo
-
-The dev/mqueue and dev/shm directories do not exist when using lxc.autodev, thus they have to be created upon mount.
-
-Signed-off-by: Dennis Schridde <devurandom@gmx.net>
----
- config/templates/gentoo.moresecure.conf.in | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/config/templates/gentoo.moresecure.conf.in b/config/templates/gentoo.moresecure.conf.in
-index 270e9df..f827ad2 100644
---- a/config/templates/gentoo.moresecure.conf.in
-+++ b/config/templates/gentoo.moresecure.conf.in
-@@ -8,8 +8,8 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf
- # Container user ? see gentoo.common.conf
-
- # do not mount sysfs, see http://blog.bofh.it/debian/id_413
--lxc.mount.entry=mqueue dev/mqueue mqueue rw,nodev,noexec,nosuid 0 0
--lxc.mount.entry=shm dev/shm tmpfs rw,nosuid,nodev,noexec,relatime 0 0
-+lxc.mount.entry=mqueue dev/mqueue mqueue rw,nodev,noexec,nosuid,create=dir 0 0
-+lxc.mount.entry=shm dev/shm tmpfs rw,nosuid,nodev,noexec,relatime,create=dir 0 0
- lxc.mount.entry=run run tmpfs rw,nosuid,nodev,relatime,mode=755 0 0
-
- # this part is based on 'linux capabilities', see: man 7 capabilities
diff --git a/app-emulation/lxc/files/lxc-1.1.3-bash-completion.patch b/app-emulation/lxc/files/lxc-1.1.3-bash-completion.patch
deleted file mode 100644
index 3bcb40c..00000000
--- a/app-emulation/lxc/files/lxc-1.1.3-bash-completion.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-Index: lxc-lxc-1.1.3/config/bash/Makefile.am
-===================================================================
---- lxc-lxc-1.1.3.orig/config/bash/Makefile.am
-+++ lxc-lxc-1.1.3/config/bash/Makefile.am
-@@ -2,12 +2,12 @@ EXTRA_DIST = lxc
-
- if ENABLE_BASH
- install-bash:
-- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
-- $(INSTALL_DATA) lxc $(DESTDIR)$(sysconfdir)/bash_completion.d/
-+ $(MKDIR_P) $(DESTDIR)$(datarootdir)/bash-completion/completions//
-+ $(INSTALL_DATA) lxc $(DESTDIR)$(datarootdir)/bash-completion/completions/
-
- uninstall-bash:
-- rm -f $(DESTDIR)$(sysconfdir)/bash_completion.d/lxc
-- rmdir $(DESTDIR)$(sysconfdir)/bash_completion.d/ || :
-+ rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/lxc
-+ rmdir $(DESTDIR)$(datarootdir)/bash-completion/ || :
-
- install-data-local: install-bash
- uninstall-local: uninstall-bash
-Index: lxc-lxc-1.1.3/config/bash/lxc.in
-===================================================================
---- lxc-lxc-1.1.3.orig/config/bash/lxc.in
-+++ lxc-lxc-1.1.3/config/bash/lxc.in
-@@ -1,4 +1,3 @@
--have lxc-start && {
- _lxc_names() {
- COMPREPLY=( $( compgen -W "$( lxc-ls )" "$cur" ) )
- }
-@@ -100,4 +99,3 @@ have lxc-start && {
-
- complete -o default -F _lxc_generic_o lxc-clone
- complete -o default -F _lxc_generic_o lxc-start-ephemeral
--}
diff --git a/app-emulation/lxc/files/lxc-2.0.1-bash-completion.patch b/app-emulation/lxc/files/lxc-2.0.1-bash-completion.patch
deleted file mode 100644
index 9ef6013..00000000
--- a/app-emulation/lxc/files/lxc-2.0.1-bash-completion.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- lxc-lxc-2.0.1/config/bash/Makefile.am.orig 2016-05-18 20:40:42.238487678 +0000
-+++ lxc-lxc-2.0.1/config/bash/Makefile.am 2016-05-18 20:43:02.163497779 +0000
-@@ -2,12 +2,12 @@
-
- if ENABLE_BASH
- install-bash:
-- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
-- $(INSTALL_DATA) lxc $(DESTDIR)$(sysconfdir)/bash_completion.d/
-+ $(MKDIR_P) $(DESTDIR)$(datarootdir)/bash-completion/completions/
-+ $(INSTALL_DATA) lxc $(DESTDIR)$(datarootdir)/bash-completion/completions/
-
- uninstall-bash:
-- rm -f $(DESTDIR)$(sysconfdir)/bash_completion.d/lxc
-- rmdir $(DESTDIR)$(sysconfdir)/bash_completion.d/ || :
-+ rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/lxc
-+ rmdir $(DESTDIR)$(datarootdir)/bash-completion/completions/ || :
-
- install-data-local: install-bash
- uninstall-local: uninstall-bash
---- lxc-lxc-2.0.1/config/bash/lxc.in.orig 2016-05-18 20:40:51.079488316 +0000
-+++ lxc-lxc-2.0.1/config/bash/lxc.in 2016-05-18 20:45:03.506506538 +0000
-@@ -1,4 +1,3 @@
--_have lxc-start && {
- _lxc_names() {
- COMPREPLY=( $( compgen -W "$( lxc-ls )" "$cur" ) )
- }
-@@ -100,4 +99,3 @@
-
- complete -o default -F _lxc_generic_o lxc-copy
- complete -o default -F _lxc_generic_o lxc-start-ephemeral
--}
diff --git a/app-emulation/lxc/files/lxc-2.0.1-omit-sysconfig.patch b/app-emulation/lxc/files/lxc-2.0.1-omit-sysconfig.patch
deleted file mode 100644
index 9b83a3b..00000000
--- a/app-emulation/lxc/files/lxc-2.0.1-omit-sysconfig.patch
+++ /dev/null
@@ -1,5 +0,0 @@
---- lxc-lxc-2.0.1/config/Makefile.am.orig 2016-05-19 02:56:11.891113982 +0000
-+++ lxc-lxc-2.0.1/config/Makefile.am 2016-05-19 02:56:32.596115476 +0000
-@@ -1 +1 @@
--SUBDIRS = apparmor bash etc init selinux templates yum sysconfig
-+SUBDIRS = apparmor bash etc init selinux templates yum
diff --git a/app-emulation/lxc/files/lxc.initd.4 b/app-emulation/lxc/files/lxc.initd.4
deleted file mode 100644
index c8325bc..00000000
--- a/app-emulation/lxc/files/lxc.initd.4
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-CONTAINER=${SVCNAME#*.}
-
-LXC_PATH=`lxc-config lxc.lxcpath`
-
-lxc_get_configfile() {
- if [ -f "${LXC_PATH}/${CONTAINER}.conf" ]; then
- echo "${LXC_PATH}/${CONTAINER}.conf"
- elif [ -f "${LXC_PATH}/${CONTAINER}/config" ]; then
- echo "${LXC_PATH}/${CONTAINER}/config"
- else
- eerror "Unable to find a suitable configuration file."
- eerror "If you set up the container in a non-standard"
- eerror "location, please set the CONFIGFILE variable."
- return 1
- fi
-}
-
-[ $CONTAINER != $SVCNAME ] && CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)}
-
-lxc_get_var() {
- awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
-}
-
-lxc_get_net_link_type() {
- awk 'BEGIN { FS="[ \t]*=[ \t]*"; _link=""; _type="" }
- $1 == "lxc.network.type" {_type=$2;}
- $1 == "lxc.network.link" {_link=$2;}
- {if(_link != "" && _type != ""){
- printf("%s:%s\n", _link, _type );
- _link=""; _type="";
- }; }' <${CONFIGFILE}
-}
-
-checkconfig() {
- if [ ${CONTAINER} = ${SVCNAME} ]; then
- eerror "You have to create an init script for each container:"
- eerror " ln -s lxc /etc/init.d/lxc.container"
- return 1
- fi
-
- # no need to output anything, the function takes care of that.
- [ -z "${CONFIGFILE}" ] && return 1
-
- utsname=$(lxc_get_var lxc.utsname)
- if [ ${CONTAINER} != ${utsname} ]; then
- eerror "You should use the same name for the service and the"
- eerror "container. Right now the container is called ${utsname}"
- return 1
- fi
-}
-
-depend() {
- # be quiet, since we have to run depend() also for the
- # non-muxed init script, unfortunately.
- checkconfig 2>/dev/null || return 0
-
- config ${CONFIGFILE}
- need localmount
- use lxcfs
-
- local _x _if
- for _x in $(lxc_get_net_link_type); do
- _if=${_x%:*}
- case "${_x##*:}" in
- # when the network type is set to phys, we can make use of a
- # network service (for instance to set it up before we disable
- # the net_admin capability), but we might also not set it up
- # at all on the host and leave the net_admin capable service
- # to take care of it.
- phys) use net.${_if} ;;
- *) need net.${_if} ;;
- esac
- done
-}
-
-start() {
- checkconfig || return 1
- rm -f /var/log/lxc/${CONTAINER}.log
-
- rootpath=$(lxc_get_var lxc.rootfs)
-
- # Check the format of our init and the chroot's init, to see
- # if we have to use linux32 or linux64; always use setarch
- # when required, as that makes it easier to deal with
- # x32-based containers.
- case $(scanelf -BF '%a#f' ${rootpath}/sbin/init) in
- EM_X86_64) setarch=linux64;;
- EM_386) setarch=linux32;;
- esac
-
- ebegin "Starting ${CONTAINER}"
- env -i ${setarch} $(which lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
- sleep 0.5
-
- # lxc-start -d will _always_ report a correct startup, even if it
- # failed, so rather than trust that, check that the cgroup exists.
- [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]
- eend $?
-}
-
-stop() {
- checkconfig || return 1
-
-
- if ! [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]; then
- ewarn "${CONTAINER} doesn't seem to be started."
- return 0
- fi
-
- # 10s should be enough to shut everything down
- ebegin "Stopping ${CONTAINER}"
- lxc-stop -t 10 -n ${CONTAINER}
- eend $?
-}
diff --git a/app-emulation/lxc/files/lxc_at.service.2 b/app-emulation/lxc/files/lxc_at.service.2
deleted file mode 100644
index 82306a0..00000000
--- a/app-emulation/lxc/files/lxc_at.service.2
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Linux Container %I
-After=network.target
-
-[Service]
-Restart=always
-ExecStartPre=/usr/libexec/lxc/lxc-devsetup
-ExecStart=/usr/bin/lxc-start -n %i -F
-ExecReload=/usr/bin/lxc-restart -n %i
-ExecStop=/usr/bin/lxc-stop -n %i
-Delegate=yes
-
-[Install]
-WantedBy=multi-user.target
diff --git a/app-emulation/lxc/files/lxc_at.service.3 b/app-emulation/lxc/files/lxc_at.service.3
deleted file mode 100644
index 6726414..00000000
--- a/app-emulation/lxc/files/lxc_at.service.3
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=Linux Container %I
-After=network.target
-Wants=lxcfs.service
-
-[Service]
-Restart=always
-ExecStartPre=/usr/libexec/lxc/lxc-devsetup
-ExecStart=/usr/bin/lxc-start -n %i -F
-ExecReload=/usr/bin/lxc-restart -n %i
-ExecStop=/usr/bin/lxc-stop -n %i
-Delegate=yes
-
-[Install]
-WantedBy=multi-user.target
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/
@ 2017-02-03 8:51 Yixun Lan
0 siblings, 0 replies; 8+ messages in thread
From: Yixun Lan @ 2017-02-03 8:51 UTC (permalink / raw
To: gentoo-commits
commit: e42ccd5828de3283ff796522b38039903c5930f0
Author: Yixun Lan <dlan <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 3 08:15:24 2017 +0000
Commit: Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Fri Feb 3 08:51:45 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e42ccd58
app-emulation/lxc: fix no-POSIX bashism
* QA Notice: shell script appears to use non-POSIX feature(s):
* possible bashism in /etc/init.d/lxc line 98 (sleep only takes one integer):
Package-Manager: Portage-2.3.3, Repoman-2.3.1
app-emulation/lxc/files/lxc.initd.5 | 2 +-
app-emulation/lxc/files/{lxc.initd.5 => lxc.initd.6} | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app-emulation/lxc/files/lxc.initd.5 b/app-emulation/lxc/files/lxc.initd.5
index e5a5236..5ca5c92 100644
--- a/app-emulation/lxc/files/lxc.initd.5
+++ b/app-emulation/lxc/files/lxc.initd.5
@@ -1,5 +1,5 @@
#!/sbin/openrc-run
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
diff --git a/app-emulation/lxc/files/lxc.initd.5 b/app-emulation/lxc/files/lxc.initd.6
similarity index 98%
copy from app-emulation/lxc/files/lxc.initd.5
copy to app-emulation/lxc/files/lxc.initd.6
index e5a5236..c3d70ea 100644
--- a/app-emulation/lxc/files/lxc.initd.5
+++ b/app-emulation/lxc/files/lxc.initd.6
@@ -1,5 +1,5 @@
#!/sbin/openrc-run
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
@@ -95,7 +95,7 @@ start() {
ebegin "Starting ${CONTAINER}"
env -i ${setarch} $(which lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
- sleep 0.5
+ sleep 1
# lxc-start -d will _always_ report a correct startup, even if it
# failed, so rather than trust that, check that the cgroup exists.
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/
@ 2017-04-14 10:11 Sven Wegener
0 siblings, 0 replies; 8+ messages in thread
From: Sven Wegener @ 2017-04-14 10:11 UTC (permalink / raw
To: gentoo-commits
commit: 2ffaabbc863ca7c364d8e2e3d2a3cab179810087
Author: Sven Wegener <swegener <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 14 09:22:03 2017 +0000
Commit: Sven Wegener <swegener <AT> gentoo <DOT> org>
CommitDate: Fri Apr 14 10:11:09 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ffaabbc
app-emulation/lxc: Remove old patch
Package-Manager: Portage-2.3.3, Repoman-2.3.2
.../lxc/files/lxc-1.0.6-bash-completion.patch | 39 ----------------------
1 file changed, 39 deletions(-)
diff --git a/app-emulation/lxc/files/lxc-1.0.6-bash-completion.patch b/app-emulation/lxc/files/lxc-1.0.6-bash-completion.patch
deleted file mode 100644
index 942c12f0519..00000000000
--- a/app-emulation/lxc/files/lxc-1.0.6-bash-completion.patch
+++ /dev/null
@@ -1,39 +0,0 @@
- config/bash/Makefile.am | 8 ++++----
- config/bash/lxc.in | 2 --
- 2 files changed, 4 insertions(+), 6 deletions(-)
-
-diff --git a/config/bash/Makefile.am b/config/bash/Makefile.am
-index b1768c9..3fbbe8e 100644
---- a/config/bash/Makefile.am
-+++ b/config/bash/Makefile.am
-@@ -2,12 +2,12 @@ EXTRA_DIST = lxc
-
- if ENABLE_BASH
- install-bash:
-- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
-- $(INSTALL_DATA) lxc $(DESTDIR)$(sysconfdir)/bash_completion.d/
-+ $(MKDIR_P) $(DESTDIR)$(datarootdir)/bash-completion/completions/
-+ $(INSTALL_DATA) lxc $(DESTDIR)$(datarootdir)/bash-completion/completions/
-
- uninstall-bash:
-- rm -f $(DESTDIR)$(sysconfdir)/bash_completion.d/lxc
-- rmdir $(DESTDIR)$(sysconfdir)/bash_completion.d/ || :
-+ rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/lxc
-+ rmdir $(DESTDIR)$(datarootdir)/bash-completion/ || :
-
- install-data-local: install-bash
- uninstall-local: uninstall-bash
-diff --git a/config/bash/lxc.in b/config/bash/lxc.in
-index 18fd48f..8fff725 100644
---- a/config/bash/lxc.in
-+++ b/config/bash/lxc.in
-@@ -1,4 +1,3 @@
--have lxc-start && {
- _lxc_names() {
- COMPREPLY=( $( compgen -W "$( lxc-ls )" "$cur" ) )
- }
-@@ -100,4 +99,3 @@ have lxc-start && {
-
- complete -o default -F _lxc-generic-o lxc-clone
- complete -o default -F _lxc-generic-o lxc-start-ephemeral
--}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/
@ 2018-01-03 11:06 Patrice Clement
0 siblings, 0 replies; 8+ messages in thread
From: Patrice Clement @ 2018-01-03 11:06 UTC (permalink / raw
To: gentoo-commits
commit: 82fc7433c33e2356188503b0e58e4c74bb2e8542
Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
AuthorDate: Wed Dec 27 08:32:51 2017 +0000
Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Wed Jan 3 11:06:43 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82fc7433
app-emulation/lxc: remove unused patch.
Closes: https://github.com/gentoo/gentoo/pull/6648
app-emulation/lxc/files/lxc-2.0.6-major.patch | 74 ---------------------------
1 file changed, 74 deletions(-)
diff --git a/app-emulation/lxc/files/lxc-2.0.6-major.patch b/app-emulation/lxc/files/lxc-2.0.6-major.patch
deleted file mode 100644
index beb379a5388..00000000000
--- a/app-emulation/lxc/files/lxc-2.0.6-major.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-Adapt to future removal of major()/minor()/makedev() from <sys/types.h>
-
-Gentoo removed it in glibc-2.24.
-
-https://bugs.gentoo.org/575232
-https://bugs.gentoo.org/604360
-diff --git a/configure.ac b/configure.ac
-index 4640c0d..71e6450 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -620,4 +620,7 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
- AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
-
-+# lookup major()/minor()/makedev()
-+AC_HEADER_MAJOR
-+
- # Check for some syscalls functions
- AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat])
-diff --git a/src/lxc/bdev/lxclvm.c b/src/lxc/bdev/lxclvm.c
-index 3d41b10..419d1c2 100644
---- a/src/lxc/bdev/lxclvm.c
-+++ b/src/lxc/bdev/lxclvm.c
-@@ -33,8 +33,17 @@
-
- #include "bdev.h"
-+#include "config.h"
- #include "log.h"
- #include "lxclvm.h"
- #include "utils.h"
-
-+/* major()/minor() */
-+#ifdef MAJOR_IN_MKDEV
-+# include <sys/mkdev.h>
-+#endif
-+#ifdef MAJOR_IN_SYSMACROS
-+# include <sys/sysmacros.h>
-+#endif
-+
- lxc_log_define(lxclvm, lxc);
-
-diff --git a/src/lxc/conf.c b/src/lxc/conf.c
-index c54ee41..9a00e7f 100644
---- a/src/lxc/conf.c
-+++ b/src/lxc/conf.c
-@@ -40,4 +40,12 @@
- #include <time.h>
-
-+/* makedev() */
-+#ifdef MAJOR_IN_MKDEV
-+# include <sys/mkdev.h>
-+#endif
-+#ifdef MAJOR_IN_SYSMACROS
-+# include <sys/sysmacros.h>
-+#endif
-+
- #ifdef HAVE_STATVFS
- #include <sys/statvfs.h>
-diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
-index 3a9e1e3..fe75fcc 100644
---- a/src/lxc/lxccontainer.c
-+++ b/src/lxc/lxccontainer.c
-@@ -62,4 +62,12 @@
- #include "version.h"
-
-+/* major()/minor() */
-+#ifdef MAJOR_IN_MKDEV
-+# include <sys/mkdev.h>
-+#endif
-+#ifdef MAJOR_IN_SYSMACROS
-+# include <sys/sysmacros.h>
-+#endif
-+
- #if HAVE_IFADDRS_H
- #include <ifaddrs.h>
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/
@ 2018-05-05 1:26 Aaron Bauman
0 siblings, 0 replies; 8+ messages in thread
From: Aaron Bauman @ 2018-05-05 1:26 UTC (permalink / raw
To: gentoo-commits
commit: f4441d977a0df1cc059b5ec38a2e7b66c9967f74
Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
AuthorDate: Sat Apr 28 07:51:26 2018 +0000
Commit: Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Sat May 5 01:22:19 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4441d97
app-emulation/lxc: remove unused files
Closes: https://github.com/gentoo/gentoo/pull/8182
app-emulation/lxc/files/lxc.initd.3 | 117 -----------------------------------
app-emulation/lxc/files/lxc.initd.5 | 118 ------------------------------------
2 files changed, 235 deletions(-)
diff --git a/app-emulation/lxc/files/lxc.initd.3 b/app-emulation/lxc/files/lxc.initd.3
deleted file mode 100644
index 7725f571017..00000000000
--- a/app-emulation/lxc/files/lxc.initd.3
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-CONTAINER=${SVCNAME#*.}
-
-LXC_PATH=`lxc-config lxc.lxcpath`
-
-lxc_get_configfile() {
- if [ -f "${LXC_PATH}/${CONTAINER}.conf" ]; then
- echo "${LXC_PATH}/${CONTAINER}.conf"
- elif [ -f "${LXC_PATH}/${CONTAINER}/config" ]; then
- echo "${LXC_PATH}/${CONTAINER}/config"
- else
- eerror "Unable to find a suitable configuration file."
- eerror "If you set up the container in a non-standard"
- eerror "location, please set the CONFIGFILE variable."
- return 1
- fi
-}
-
-[ $CONTAINER != $SVCNAME ] && CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)}
-
-lxc_get_var() {
- awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
-}
-
-lxc_get_net_link_type() {
- awk 'BEGIN { FS="[ \t]*=[ \t]*"; _link=""; _type="" }
- $1 == "lxc.network.type" {_type=$2;}
- $1 == "lxc.network.link" {_link=$2;}
- {if(_link != "" && _type != ""){
- printf("%s:%s\n", _link, _type );
- _link=""; _type="";
- }; }' <${CONFIGFILE}
-}
-
-checkconfig() {
- if [ ${CONTAINER} = ${SVCNAME} ]; then
- eerror "You have to create an init script for each container:"
- eerror " ln -s lxc /etc/init.d/lxc.container"
- return 1
- fi
-
- # no need to output anything, the function takes care of that.
- [ -z "${CONFIGFILE}" ] && return 1
-
- utsname=$(lxc_get_var lxc.utsname)
- if [ ${CONTAINER} != ${utsname} ]; then
- eerror "You should use the same name for the service and the"
- eerror "container. Right now the container is called ${utsname}"
- return 1
- fi
-}
-
-depend() {
- # be quiet, since we have to run depend() also for the
- # non-muxed init script, unfortunately.
- checkconfig 2>/dev/null || return 0
-
- config ${CONFIGFILE}
- need localmount
-
- local _x _if
- for _x in $(lxc_get_net_link_type); do
- _if=${_x%:*}
- case "${_x##*:}" in
- # when the network type is set to phys, we can make use of a
- # network service (for instance to set it up before we disable
- # the net_admin capability), but we might also not set it up
- # at all on the host and leave the net_admin capable service
- # to take care of it.
- phys) use net.${_if} ;;
- *) need net.${_if} ;;
- esac
- done
-}
-
-start() {
- checkconfig || return 1
- rm -f /var/log/lxc/${CONTAINER}.log
-
- rootpath=$(lxc_get_var lxc.rootfs)
-
- # Check the format of our init and the chroot's init, to see
- # if we have to use linux32 or linux64; always use setarch
- # when required, as that makes it easier to deal with
- # x32-based containers.
- case $(scanelf -BF '%a#f' ${rootpath}/sbin/init) in
- EM_X86_64) setarch=linux64;;
- EM_386) setarch=linux32;;
- esac
-
- ebegin "Starting ${CONTAINER}"
- env -i ${setarch} $(type -p lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
- sleep 0.5
-
- # lxc-start -d will _always_ report a correct startup, even if it
- # failed, so rather than trust that, check that the cgroup exists.
- [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]
- eend $?
-}
-
-stop() {
- checkconfig || return 1
-
-
- if ! [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]; then
- ewarn "${CONTAINER} doesn't seem to be started."
- return 0
- fi
-
- # 10s should be enough to shut everything down
- ebegin "Stopping ${CONTAINER}"
- lxc-stop -t 10 -n ${CONTAINER}
- eend $?
-}
diff --git a/app-emulation/lxc/files/lxc.initd.5 b/app-emulation/lxc/files/lxc.initd.5
deleted file mode 100644
index b28d0bfa7aa..00000000000
--- a/app-emulation/lxc/files/lxc.initd.5
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-CONTAINER=${SVCNAME#*.}
-
-LXC_PATH=`lxc-config lxc.lxcpath`
-
-lxc_get_configfile() {
- if [ -f "${LXC_PATH}/${CONTAINER}.conf" ]; then
- echo "${LXC_PATH}/${CONTAINER}.conf"
- elif [ -f "${LXC_PATH}/${CONTAINER}/config" ]; then
- echo "${LXC_PATH}/${CONTAINER}/config"
- else
- eerror "Unable to find a suitable configuration file."
- eerror "If you set up the container in a non-standard"
- eerror "location, please set the CONFIGFILE variable."
- return 1
- fi
-}
-
-[ $CONTAINER != $SVCNAME ] && CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)}
-
-lxc_get_var() {
- awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
-}
-
-lxc_get_net_link_type() {
- awk 'BEGIN { FS="[ \t]*=[ \t]*"; _link=""; _type="" }
- $1 == "lxc.network.type" {_type=$2;}
- $1 == "lxc.network.link" {_link=$2;}
- {if(_link != "" && _type != ""){
- printf("%s:%s\n", _link, _type );
- _link=""; _type="";
- }; }' <${CONFIGFILE}
-}
-
-checkconfig() {
- if [ ${CONTAINER} = ${SVCNAME} ]; then
- eerror "You have to create an init script for each container:"
- eerror " ln -s lxc /etc/init.d/lxc.container"
- return 1
- fi
-
- # no need to output anything, the function takes care of that.
- [ -z "${CONFIGFILE}" ] && return 1
-
- utsname=$(lxc_get_var lxc.utsname)
- if [ ${CONTAINER} != ${utsname} ]; then
- eerror "You should use the same name for the service and the"
- eerror "container. Right now the container is called ${utsname}"
- return 1
- fi
-}
-
-depend() {
- # be quiet, since we have to run depend() also for the
- # non-muxed init script, unfortunately.
- checkconfig 2>/dev/null || return 0
-
- config ${CONFIGFILE}
- need localmount
- use lxcfs
-
- local _x _if
- for _x in $(lxc_get_net_link_type); do
- _if=${_x%:*}
- case "${_x##*:}" in
- # when the network type is set to phys, we can make use of a
- # network service (for instance to set it up before we disable
- # the net_admin capability), but we might also not set it up
- # at all on the host and leave the net_admin capable service
- # to take care of it.
- phys) use net.${_if} ;;
- *) need net.${_if} ;;
- esac
- done
-}
-
-start() {
- checkconfig || return 1
- rm -f /var/log/lxc/${CONTAINER}.log
-
- rootpath=$(lxc_get_var lxc.rootfs)
-
- # Check the format of our init and the chroot's init, to see
- # if we have to use linux32 or linux64; always use setarch
- # when required, as that makes it easier to deal with
- # x32-based containers.
- case $(scanelf -BF '%a#f' ${rootpath}/sbin/init) in
- EM_X86_64) setarch=linux64;;
- EM_386) setarch=linux32;;
- esac
-
- ebegin "Starting ${CONTAINER}"
- env -i ${setarch} $(which lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
- sleep 0.5
-
- # lxc-start -d will _always_ report a correct startup, even if it
- # failed, so rather than trust that, check that the cgroup exists.
- [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]
- eend $?
-}
-
-stop() {
- checkconfig || return 1
-
-
- if ! [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]; then
- ewarn "${CONTAINER} doesn't seem to be started."
- return 0
- fi
-
- # 10s should be enough to shut everything down
- ebegin "Stopping ${CONTAINER}"
- lxc-stop -t 10 -n ${CONTAINER}
- eend $?
-}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/
@ 2020-05-29 13:15 Joonas Niilola
0 siblings, 0 replies; 8+ messages in thread
From: Joonas Niilola @ 2020-05-29 13:15 UTC (permalink / raw
To: gentoo-commits
commit: e6fffc5b9d9ed704179a53f98367aa8ebe6f17f0
Author: Joonas Niilola <juippis <AT> gentoo <DOT> org>
AuthorDate: Fri May 29 13:13:12 2020 +0000
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri May 29 13:15:09 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6fffc5b
app-emulation/lxc: remove unused patch files
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
.../lxc/files/lxc-2.0.6-bash-completion.patch | 27 ----
...ps-enable-container-without-CAP_SYS_ADMIN.patch | 164 ---------------------
.../lxc/files/lxc-2.1.1-cve-2018-6556.patch | 118 ---------------
.../files/lxc-2.1.1-fix-cgroup2-detection.patch | 26 ----
4 files changed, 335 deletions(-)
diff --git a/app-emulation/lxc/files/lxc-2.0.6-bash-completion.patch b/app-emulation/lxc/files/lxc-2.0.6-bash-completion.patch
deleted file mode 100644
index 6033e36c798..00000000000
--- a/app-emulation/lxc/files/lxc-2.0.6-bash-completion.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-diff --git a/config/bash/lxc.in b/config/bash/lxc.in
-index 7dcf302..5927fe2 100644
---- a/config/bash/lxc.in
-+++ b/config/bash/lxc.in
-@@ -1,4 +1,3 @@
--_have lxc-start && {
- _lxc_names() {
- COMPREPLY=( $( compgen -W "$( lxc-ls )" "$cur" ) )
- }
-@@ -100,4 +99,3 @@ _have lxc-start && {
-
- complete -o default -F _lxc_generic_o lxc-copy
- complete -o default -F _lxc_generic_o lxc-start-ephemeral
--}
-diff --git a/configure.ac b/configure.ac
-index 4640c0d..14ccdd3 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -478,7 +478,7 @@ AM_CONDITIONAL([ENABLE_BASH], [test "x$enable_bash" = "xyes"])
- AM_COND_IF([ENABLE_BASH],
- [AC_MSG_CHECKING([bash completion directory])
- PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
-- bashcompdir="${sysconfdir}/bash_completion.d")
-+ bashcompdir="$datadir/bash-completion/completions")
- AC_MSG_RESULT([$bashcompdir])
- AC_SUBST(bashcompdir)
- ])
diff --git a/app-emulation/lxc/files/lxc-2.1.1-cgroups-enable-container-without-CAP_SYS_ADMIN.patch b/app-emulation/lxc/files/lxc-2.1.1-cgroups-enable-container-without-CAP_SYS_ADMIN.patch
deleted file mode 100644
index 8493491d0d6..00000000000
--- a/app-emulation/lxc/files/lxc-2.1.1-cgroups-enable-container-without-CAP_SYS_ADMIN.patch
+++ /dev/null
@@ -1,164 +0,0 @@
-From b635e92d21d2a4d71a553388f18cfa08f44bf1ba Mon Sep 17 00:00:00 2001
-From: Christian Brauner <christian.brauner@ubuntu.com>
-Date: Mon, 30 Oct 2017 14:16:46 +0100
-Subject: [PATCH] cgroups: enable container without CAP_SYS_ADMIN
-
-In case cgroup namespaces are supported but we do not have CAP_SYS_ADMIN we
-need to mount cgroups for the container. This patch enables both privileged and
-unprivileged containers without CAP_SYS_ADMIN.
-
-Closes #1737.
-
-Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
----
- src/lxc/cgroups/cgfs.c | 3 ++-
- src/lxc/cgroups/cgfsng.c | 52 +++++++++++++++++++++++++++++++++++++++++++++---
- src/lxc/cgroups/cgroup.c | 2 +-
- src/lxc/conf.c | 3 ---
- src/lxc/conf.h | 1 +
- 5 files changed, 53 insertions(+), 8 deletions(-)
-
-diff --git a/src/lxc/cgroups/cgfs.c b/src/lxc/cgroups/cgfs.c
-index bcbd6613..efd627f0 100644
---- a/src/lxc/cgroups/cgfs.c
-+++ b/src/lxc/cgroups/cgfs.c
-@@ -1418,11 +1418,12 @@ static bool cgroupfs_mount_cgroup(void *hdata, const char *root, int type)
- struct cgfs_data *cgfs_d;
- struct cgroup_process_info *info, *base_info;
- int r, saved_errno = 0;
-+ struct lxc_handler *handler = hdata;
-
- if (cgns_supported())
- return true;
-
-- cgfs_d = hdata;
-+ cgfs_d = handler->cgroup_data;
- if (!cgfs_d)
- return false;
- base_info = cgfs_d->info;
-diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
-index e43edd7d..ec6440c1 100644
---- a/src/lxc/cgroups/cgfsng.c
-+++ b/src/lxc/cgroups/cgfsng.c
-@@ -50,6 +50,7 @@
- #include <linux/types.h>
- #include <linux/kdev_t.h>
-
-+#include "caps.h"
- #include "cgroup.h"
- #include "cgroup_utils.h"
- #include "commands.h"
-@@ -1616,17 +1617,49 @@ do_secondstage_mounts_if_needed(int type, struct hierarchy *h,
- return 0;
- }
-
-+static int mount_cgroup_cgns_supported(struct hierarchy *h, const char *controllerpath)
-+{
-+ int ret;
-+ char *controllers = NULL;
-+ char *type = "cgroup2";
-+
-+ if (!h->is_cgroup_v2) {
-+ controllers = lxc_string_join(",", (const char **)h->controllers, false);
-+ if (!controllers)
-+ return -ENOMEM;
-+ type = "cgroup";
-+ }
-+
-+ ret = mount("cgroup", controllerpath, type, MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RELATIME, controllers);
-+ free(controllers);
-+ if (ret < 0) {
-+ SYSERROR("Failed to mount %s with cgroup filesystem type %s", controllerpath, type);
-+ return -1;
-+ }
-+
-+ DEBUG("Mounted %s with cgroup filesystem type %s", controllerpath, type);
-+ return 0;
-+}
-+
- static bool cgfsng_mount(void *hdata, const char *root, int type)
- {
-- struct cgfsng_handler_data *d = hdata;
-+ int i;
- char *tmpfspath = NULL;
- bool retval = false;
-- int i;
-+ struct lxc_handler *handler = hdata;
-+ struct cgfsng_handler_data *d = handler->cgroup_data;
-+ bool has_cgns = false, has_sys_admin = true;
-
- if ((type & LXC_AUTO_CGROUP_MASK) == 0)
- return true;
-
-- if (cgns_supported())
-+ has_cgns = cgns_supported();
-+ if (!lxc_list_empty(&handler->conf->keepcaps))
-+ has_sys_admin = in_caplist(CAP_SYS_ADMIN, &handler->conf->keepcaps);
-+ else
-+ has_sys_admin = !in_caplist(CAP_SYS_ADMIN, &handler->conf->caps);
-+
-+ if (has_cgns && has_sys_admin)
- return true;
-
- tmpfspath = must_make_path(root, "/sys/fs/cgroup", NULL);
-@@ -1662,6 +1695,19 @@ static bool cgfsng_mount(void *hdata, const char *root, int type)
- free(controllerpath);
- goto bad;
- }
-+
-+ if (has_cgns && !has_sys_admin) {
-+ /* If cgroup namespaces are supported but the container
-+ * will not have CAP_SYS_ADMIN after it has started we
-+ * need to mount the cgroups manually.
-+ */
-+ r = mount_cgroup_cgns_supported(h, controllerpath);
-+ free(controllerpath);
-+ if (r < 0)
-+ goto bad;
-+ continue;
-+ }
-+
- if (mount_cgroup_full(type, h, controllerpath, d->container_cgroup) < 0) {
- free(controllerpath);
- goto bad;
-diff --git a/src/lxc/cgroups/cgroup.c b/src/lxc/cgroups/cgroup.c
-index 674e3090..36a665b1 100644
---- a/src/lxc/cgroups/cgroup.c
-+++ b/src/lxc/cgroups/cgroup.c
-@@ -166,7 +166,7 @@ bool cgroup_chown(struct lxc_handler *handler)
- bool cgroup_mount(const char *root, struct lxc_handler *handler, int type)
- {
- if (ops)
-- return ops->mount_cgroup(handler->cgroup_data, root, type);
-+ return ops->mount_cgroup(handler, root, type);
-
- return false;
- }
-diff --git a/src/lxc/conf.c b/src/lxc/conf.c
-index d2fab945..44d97843 100644
---- a/src/lxc/conf.c
-+++ b/src/lxc/conf.c
-@@ -210,9 +210,6 @@ __thread struct lxc_conf *current_config;
- struct lxc_conf *current_config;
- #endif
-
--/* Declare this here, since we don't want to reshuffle the whole file. */
--static int in_caplist(int cap, struct lxc_list *caps);
--
- static struct mount_opt mount_opt[] = {
- { "async", 1, MS_SYNCHRONOUS },
- { "atime", 1, MS_NOATIME },
-diff --git a/src/lxc/conf.h b/src/lxc/conf.h
-index c61f861e..63e71e2d 100644
---- a/src/lxc/conf.h
-+++ b/src/lxc/conf.h
-@@ -402,5 +402,6 @@ extern unsigned long add_required_remount_flags(const char *s, const char *d,
- unsigned long flags);
- extern int run_script(const char *name, const char *section, const char *script,
- ...);
-+extern int in_caplist(int cap, struct lxc_list *caps);
-
- #endif /* __LXC_CONF_H */
---
-2.13.6
-
diff --git a/app-emulation/lxc/files/lxc-2.1.1-cve-2018-6556.patch b/app-emulation/lxc/files/lxc-2.1.1-cve-2018-6556.patch
deleted file mode 100644
index bad1e274527..00000000000
--- a/app-emulation/lxc/files/lxc-2.1.1-cve-2018-6556.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-From d183654ec1a2cd1149bdb92601ccb7246bddb14e Mon Sep 17 00:00:00 2001
-From: Christian Brauner <christian.brauner@ubuntu.com>
-Date: Wed, 25 Jul 2018 19:56:54 +0200
-Subject: [PATCH] CVE 2018-6556: verify netns fd in lxc-user-nic
-
-Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
----
- src/lxc/lxc_user_nic.c | 35 ++++++++++++++++++++++++++++++++---
- src/lxc/utils.c | 12 ++++++++++++
- src/lxc/utils.h | 5 +++++
- 3 files changed, 49 insertions(+), 3 deletions(-)
-
-ADDENDUM from vdupras@gentoo.org: Original patch from Christian didn't
-include LXC_PROC_PID_FD_LEN define, but referenced it. This resulted in
-code that doesn't compile. I fetched the definition from the stable-3.0
-branch and included it to this patch. Also, this diff is regenerated
-from lxc-2.1.1 tag instead of stable-2.0 branch.
-
-diff --git a/src/lxc/lxc_user_nic.c b/src/lxc/lxc_user_nic.c
-index 6f550f0d..09a342ac 100644
---- a/src/lxc/lxc_user_nic.c
-+++ b/src/lxc/lxc_user_nic.c
-@@ -1124,12 +1124,41 @@ int main(int argc, char *argv[])
- exit(EXIT_FAILURE);
- }
- } else if (request == LXC_USERNIC_DELETE) {
-- netns_fd = open(args.pid, O_RDONLY);
-+ char opath[LXC_PROC_PID_FD_LEN];
-+
-+ /* Open the path with O_PATH which will not trigger an actual
-+ * open(). Don't report an errno to the caller to not leak
-+ * information whether the path exists or not.
-+ * When stracing setuid is stripped so this is not a concern
-+ * either.
-+ */
-+ netns_fd = open(args.pid, O_PATH | O_CLOEXEC);
- if (netns_fd < 0) {
-- usernic_error("Could not open \"%s\": %s\n", args.pid,
-- strerror(errno));
-+ usernic_error("Failed to open \"%s\"\n", args.pid);
- exit(EXIT_FAILURE);
- }
-+
-+ if (!fhas_fs_type(netns_fd, NSFS_MAGIC)) {
-+ usernic_error("Path \"%s\" does not refer to a network namespace path\n", args.pid);
-+ close(netns_fd);
-+ exit(EXIT_FAILURE);
-+ }
-+
-+ ret = snprintf(opath, sizeof(opath), "/proc/self/fd/%d", netns_fd);
-+ if (ret < 0 || (size_t)ret >= sizeof(opath)) {
-+ close(netns_fd);
-+ exit(EXIT_FAILURE);
-+ }
-+
-+ /* Now get an fd that we can use in setns() calls. */
-+ ret = open(opath, O_RDONLY | O_CLOEXEC);
-+ if (ret < 0) {
-+ usernic_error("Failed to open \"%s\": %s\n", args.pid, strerror(errno));
-+ close(netns_fd);
-+ exit(EXIT_FAILURE);
-+ }
-+ close(netns_fd);
-+ netns_fd = ret;
- }
-
- if (!create_db_dir(LXC_USERNIC_DB)) {
-diff --git a/src/lxc/utils.c b/src/lxc/utils.c
-index e6a44a51..c2a08a9d 100644
---- a/src/lxc/utils.c
-+++ b/src/lxc/utils.c
-@@ -2380,6 +2380,18 @@ bool has_fs_type(const char *path, fs_type_magic magic_val)
- return has_type;
- }
-
-+bool fhas_fs_type(int fd, fs_type_magic magic_val)
-+{
-+ int ret;
-+ struct statfs sb;
-+
-+ ret = fstatfs(fd, &sb);
-+ if (ret < 0)
-+ return false;
-+
-+ return is_fs_type(&sb, magic_val);
-+}
-+
- bool lxc_nic_exists(char *nic)
- {
- #define __LXC_SYS_CLASS_NET_LEN 15 + IFNAMSIZ + 1
-diff --git a/src/lxc/utils.h b/src/lxc/utils.h
-index e83ed49e..06ec74d7 100644
---- a/src/lxc/utils.h
-+++ b/src/lxc/utils.h
-@@ -46,11 +46,16 @@
- #define __S_ISTYPE(mode, mask) (((mode)&S_IFMT) == (mask))
- #endif
-
-+#ifndef NSFS_MAGIC
-+#define NSFS_MAGIC 0x6e736673
-+#endif
-+
- /* Useful macros */
- /* Maximum number for 64 bit integer is a string with 21 digits: 2^64 - 1 = 21 */
- #define LXC_NUMSTRLEN64 21
- #define LXC_LINELEN 4096
- #define LXC_IDMAPLEN 4096
-+#define LXC_PROC_PID_FD_LEN (6 + LXC_NUMSTRLEN64 + 4 + LXC_NUMSTRLEN64 + 1)
-
- /* returns 1 on success, 0 if there were any failures */
- extern int lxc_rmdir_onedev(char *path, const char *exclude);
-@@ -402,6 +407,7 @@ extern void *must_realloc(void *orig, size_t sz);
- /* __typeof__ should be safe to use with all compilers. */
- typedef __typeof__(((struct statfs *)NULL)->f_type) fs_type_magic;
- extern bool has_fs_type(const char *path, fs_type_magic magic_val);
-+extern bool fhas_fs_type(int fd, fs_type_magic magic_val);
- extern bool is_fs_type(const struct statfs *fs, fs_type_magic magic_val);
- extern bool lxc_nic_exists(char *nic);
diff --git a/app-emulation/lxc/files/lxc-2.1.1-fix-cgroup2-detection.patch b/app-emulation/lxc/files/lxc-2.1.1-fix-cgroup2-detection.patch
deleted file mode 100644
index c16d28ac303..00000000000
--- a/app-emulation/lxc/files/lxc-2.1.1-fix-cgroup2-detection.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From cdfe90a49f516b0f1210d181980f14a4765e10da Mon Sep 17 00:00:00 2001
-From: Christian Brauner <christian.brauner@ubuntu.com>
-Date: Mon, 30 Oct 2017 14:17:20 +0100
-Subject: [PATCH] cgfsng: fix cgroup2 detection
-
-Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
----
- src/lxc/cgroups/cgfsng.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
-index 897336f0..e43edd7d 100644
---- a/src/lxc/cgroups/cgfsng.c
-+++ b/src/lxc/cgroups/cgfsng.c
-@@ -815,7 +815,7 @@ static void add_controller(char **clist, char *mountpoint, char *base_cgroup)
- new->fullcgpath = NULL;
-
- /* record if this is the cgroup v2 hierarchy */
-- if (!strcmp(base_cgroup, "cgroup2"))
-+ if (clist && !strcmp(*clist, "cgroup2"))
- new->is_cgroup_v2 = true;
- else
- new->is_cgroup_v2 = false;
---
-2.13.6
-
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-05-29 13:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-14 10:11 [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxc/files/ Sven Wegener
-- strict thread matches above, loose matches on Subject: below --
2020-05-29 13:15 Joonas Niilola
2018-05-05 1:26 Aaron Bauman
2018-01-03 11:06 Patrice Clement
2017-02-03 8:51 Yixun Lan
2016-08-24 10:38 Pacho Ramos
2016-02-08 21:37 Sven Wegener
2015-09-05 8:08 Markos Chandras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox