commit cf487353b05b680470bb537eb01cbb12c56cf803 Author: Adam Osuchowski <ad...@pld-linux.org> Date: Mon Mar 13 20:49:28 2023 +0100
- up to 5.0.3 ...skip-empty-entries-under-proc-self-cgroup.patch | 60 --------------- lxcfs.init | 87 ++++++++++++++++++++++ lxcfs.spec | 75 +++++-------------- pld.patch | 31 -------- 4 files changed, 106 insertions(+), 147 deletions(-) --- diff --git a/lxcfs.spec b/lxcfs.spec index 0979522..07e7e02 100644 --- a/lxcfs.spec +++ b/lxcfs.spec @@ -1,23 +1,23 @@ Summary: FUSE filesystem for LXC Name: lxcfs -Version: 2.0.2 -Release: 0.1 +Version: 5.0.3 +Release: 1 License: Apache v2.0 Group: Applications/System Source0: https://linuxcontainers.org/downloads/lxcfs/%{name}-%{version}.tar.gz -# Source0-md5: fea9124c9d6d7370e12c4a3f0d405541 +# Source0-md5: 5a5bba028196ce7186f4b58d552f424e +Source1: lxcfs.init URL: https://linuxcontainers.org/lxcfs/ -Patch0: 0001-skip-empty-entries-under-proc-self-cgroup.patch -Patch1: pld.patch BuildRequires: help2man +BuildRequires: libasan-devel BuildRequires: libfuse-devel +BuildRequires: libubsan-devel BuildRequires: pam-devel BuildRequires: pkg-config BuildRequires: pld-release +Requires: lxc BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) -%define _libexecdir %{_prefix}/lib - %description LXCFS is a simple userspace filesystem designed to work around some current limitations of the Linux kernel. @@ -38,58 +38,30 @@ that part is no longer necessary on recent kernels and focus is now on making containers feel more like a real independent system through the proc masking feature. -%package -n pam-pam_cgfs -Summary: CGroup FS pam module -Group: Libraries - -%description -n pam-pam_cgfs -When a user logs in, this pam module will create cgroups which the -user may administer, either for all controllers or for any controllers -listed on the command line. - %prep %setup -q -%patch0 -p1 -%patch1 -p1 %build -%configure \ - --with-distro=pld +%meson build \ + -Dinit-script=sysvinit,systemd \ + -Db_sanitize=address,undefined -%{__make} +%ninja_build -C build %install rm -rf $RPM_BUILD_ROOT -%{__make} install \ - DESTDIR=$RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{,%{systemdunitdir},/etc/rc.d/init.d,/var/lib/%{name}} +install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} -install -d $RPM_BUILD_ROOT{%{systemdunitdir},%{_libexecdir},%{_includedir}/%{name},%{_localstatedir}/lib/%{name}} +%ninja_install -C build -# The shared library liblxcfs.so used by lxcfs is not supposed to be used by -# any other program. So we follow best practice and install it in -# %{_prefix}/lib/lxcfs. Note that lxcfs *expects* liblxcfs.so to be found in -# %{_prefix}/lib/lxcfs when it cannot find it in the lib.so path. -install -p .libs/liblxcfs.so $RPM_BUILD_ROOT%{_libexecdir} -rm $RPM_BUILD_ROOT%{_libdir}/liblxcfs.so* -rm $RPM_BUILD_ROOT%{_libdir}/liblxcfs.la +%{__rm} -f $RPM_BUILD_ROOT/etc/init.d/%{name} +%{__rmdir} $RPM_BUILD_ROOT/etc/init.d +%{__mv} $RPM_BUILD_ROOT{/usr/lib/systemd/system/lxcfs.service,%{systemdunitdir}} %clean rm -rf $RPM_BUILD_ROOT -%if 0 -%pre -%service_add_pre lxcfs.service - -%post -%service_add_post lxcfs.service - -%preun -%service_del_preun lxcfs.service - -%postun -%service_del_postun lxcfs.service -%endif - %files %defattr(644,root,root,755) %doc AUTHORS ChangeLog README @@ -98,19 +70,10 @@ rm -rf $RPM_BUILD_ROOT %{systemdunitdir}/lxcfs.service %attr(754,root,root) /etc/rc.d/init.d/lxcfs %dir %{_datadir}/%{name} +%dir %{_libdir}/%{name} %attr(755,root,root) %{_datadir}/%{name}/lxc.mount.hook %attr(755,root,root) %{_datadir}/%{name}/lxc.reboot.hook %dir %{_localstatedir}/lib/%{name} - %{_datadir}/lxc/config/common.conf.d/00-lxcfs.conf +%attr(755,root,root) %{_libdir}/%{name}/liblxcfs.so -# The lxcfs executable requires liblxcfs.so be installed. It calls dlopen() to -# dynamically reload the shared library on upgrade. This is important. Do *not* -# split into a separate package and do not turn this into a versioned shared -# library! (This shared library allows lxcfs to be updated without having to -# restart it which is good when you have important system containers running!) -%{_libexecdir}/liblxcfs.so - -%files -n pam-pam_cgfs -%defattr(644,root,root,755) -/%{_lib}/security/pam_cgfs.so diff --git a/0001-skip-empty-entries-under-proc-self-cgroup.patch b/0001-skip-empty-entries-under-proc-self-cgroup.patch deleted file mode 100644 index 69466ef..0000000 --- a/0001-skip-empty-entries-under-proc-self-cgroup.patch +++ /dev/null @@ -1,60 +0,0 @@ -From a67719f64d07d7fee96b1e145a03659fe4db0c6e Mon Sep 17 00:00:00 2001 -From: Christian Brauner <cbrau...@suse.de> -Date: Sat, 9 Jul 2016 13:19:06 +0200 -Subject: [PATCH] skip empty entries under /proc/self/cgroup - -If cgroupv2 is enabled either alone or together with legacy hierarchies -/proc/self/cgroup can contain entries of the form: - - 0::/ - -This will cause lxcfs to fail the cgroup mounts because it parses out the empty -string "" and later on passes it to mount(). Let's skip such entries. - -Signed-off-by: Christian Brauner <cbrau...@suse.de> ---- - bindings.c | 8 ++++++++ - lxcfs.c | 8 ++++++++ - 2 files changed, 16 insertions(+) - -diff --git a/bindings.c b/bindings.c -index cb98e12..8186ca9 100644 ---- a/bindings.c -+++ b/bindings.c -@@ -3951,6 +3951,14 @@ static void __attribute__((constructor)) collect_subsystems(void) - goto out; - *p2 = '\0'; - -+ /* With cgroupv2 /proc/self/cgroup can contain entries of the -+ * form: 0::/ This will cause lxcfs to fail the cgroup mounts -+ * because it parses out the empty string "" and later on passes -+ * it to mount(). Let's skip such entries. -+ */ -+ if (!strcmp(p, "")) -+ continue; -+ - if (!store_hierarchy(line, p)) - goto out; - } -diff --git a/lxcfs.c b/lxcfs.c -index 7455267..1d19a10 100644 ---- a/lxcfs.c -+++ b/lxcfs.c -@@ -859,6 +859,14 @@ static bool do_mount_cgroups(void) - goto out; - *p2 = '\0'; - -+ /* With cgroupv2 /proc/self/cgroup can contain entries of the -+ * form: 0::/ This will cause lxcfs to fail the cgroup mounts -+ * because it parses out the empty string "" and later on passes -+ * it to mount(). Let's skip such entries. -+ */ -+ if (!strcmp(p, "")) -+ continue; -+ - if (!do_mount_cgroup(p)) - goto out; - } --- -2.8.4 - diff --git a/lxcfs.init b/lxcfs.init new file mode 100644 index 0000000..49bf0c3 --- /dev/null +++ b/lxcfs.init @@ -0,0 +1,87 @@ +#!/bin/sh +# +# lxcfs FUSE filesystem for LXC +# +# chkconfig: 345 14 91 +# +# description: lxcfs FUSE filesystem for LXC +# + +# Source function library +. /etc/rc.d/init.d/functions + +PIDFILE=/var/run/lxcfs.pid + +LXCFS_OPTIONS= +LXCFS_DIR=/var/lib/lxcfs + +# Get service config +[ -f /etc/sysconfig/lxcfs ] && . /etc/sysconfig/lxcfs + +start() { + # Check if the service is already running? + if [ ! -f /var/lock/subsys/lxcfs ]; then + msg_starting lxcfs; busy + start-stop-daemon -S -q -b -m -p $PIDFILE -x /usr/bin/lxcfs $LXCFS_OPTIONS $LXCFS_DIR + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lxcfs + ok + else + msg_already_running lxcfs + fi +} + +stop() { + if [ -f /var/lock/subsys/lxcfs ]; then + msg_stopping lxcfs + start-stop-daemon -K -p $PIDFILE -n lxcfs + ok + rm -f $PIDFILE /var/lock/subsys/lxcfs >/dev/null 2>&1 + else + msg_not_running lxcfs + fi +} + +condrestart() { + if [ -f /var/lock/subsys/lxcfs ]; then + stop + start + else + msg_not_running lxcfs + RETVAL=$1 + fi +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 + ;; + reload) + killproc -p $PIDFILE -HUP + RETVAL=$? + ;; + force-reload) + condrestart 7 + ;; + status) + status lxcfs + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" + exit 3 +esac + +exit $RETVAL diff --git a/pld.patch b/pld.patch deleted file mode 100644 index 21f3da3..0000000 --- a/pld.patch +++ /dev/null @@ -1,31 +0,0 @@ -upstreamed: https://github.com/lxc/lxcfs/pull/133 - ---- lxcfs-2.0.2/configure.ac~ 2016-06-28 21:27:44.000000000 +0300 -+++ lxcfs-2.0.2/configure.ac 2016-08-26 00:14:40.468048818 +0300 -@@ -66,6 +66,7 @@ - AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva") - AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva") - AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus") -+ AC_CHECK_FILE(/etc/pld-release,with_distro="pld") - fi - with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'` - -@@ -76,7 +77,7 @@ - ubuntu) - distroconf=default.conf.ubuntu - ;; -- redhat|centos|fedora|oracle|oracleserver) -+ redhat|centos|fedora|oracle|oracleserver|pld) - distroconf=default.conf.libvirt - ;; - *) -@@ -108,6 +109,9 @@ - ubuntu) - init_script=upstart,systemd,sysvinit - ;; -+ pld) -+ init_script=systemd,sysvinit -+ ;; - slackware) - echo -n "Warning: bsd init job not yet implemented" - init_script= ================================================================ ---- gitweb: http://git.pld-linux.org/gitweb.cgi/packages/lxcfs.git/commitdiff/cf487353b05b680470bb537eb01cbb12c56cf803 _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit