Skip to contentSkip to conversation

libcgroup: upgrade to 2.0

PATCH New Ross Burton 1 participant 1 message Aug 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libcgroup: upgrade to 2.0

Our UPSTREAM_CHECK_URI was looking at SourceForge, but development has moved to GitHub so update the URI.

Update to 2.0.

Swap musl-decls-compat.patch for a backport of an upstream commit.

Replace do_install commands with a backport of an upstream commit to install the PAM module correctly.

Don't mess about installing the library into base_libdir as the /lib vs /usr/lib prefix split is moot these days.

Delete libcgroupfortesting.so as we don't install the test suite.

---
 .../libcgroup/libcgroup/CVE-2018-14348.patch  |  37 ----
 .../libcgroup/libcgroup/module.patch          |  36 ++++
 .../libcgroup/musl-decls-compat.patch         | 187 +++++++++++-------
 meta/recipes-core/libcgroup/libcgroup_0.41.bb |  46 -----
 meta/recipes-core/libcgroup/libcgroup_2.0.bb  |  34 ++++
 5 files changed, 188 insertions(+), 152 deletions(-)
 delete mode 100644 meta/recipes-core/libcgroup/libcgroup/CVE-2018-14348.patch
 create mode 100644 meta/recipes-core/libcgroup/libcgroup/module.patch
 delete mode 100644 meta/recipes-core/libcgroup/libcgroup_0.41.bb
 create mode 100644 meta/recipes-core/libcgroup/libcgroup_2.0.bb
meta/recipes-core/libcgroup/libcgroup/CVE-2018-14348.patch deleted +0 -37
deleted file mode 100644
index d133703dec8..00000000000
@@ -1,37 +0,0 @@
-From 0d88b73d189ea3440ccaab00418d6469f76fa590 Mon Sep 17 00:00:00 2001
-From: Michal Hocko <[email protected]>
-Date: Wed, 18 Jul 2018 11:24:29 +0200
-Subject: [PATCH] cgrulesengd: remove umask(0)
-
-One of our partners has noticed that cgred daemon is creating a log file
-(/var/log/cgred) with too wide permissions (0666) and that is seen as
-a security bug because an untrusted user can write to otherwise
-restricted area. CVE-2018-14348 has been assigned to this issue.
-
-CVE: CVE-2018-14348
-Upstream-Status: Backport [https://sourceforge.net/p/libcg/libcg/ci/0d88b73d189ea3440ccaab00418d6469f76fa590]
-
-Signed-off-by: Michal Hocko <[email protected]>
-Acked-by: Balbir Singh <[email protected]>
-Signed-off-by: Jagadeesh Krishnanjanappa <[email protected]>
----
- src/daemon/cgrulesengd.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c
-index ea51f11..0d288f3 100644
---- a/src/daemon/cgrulesengd.c
-+++ b/src/daemon/cgrulesengd.c
-@@ -889,9 +889,6 @@ int cgre_start_daemon(const char *logp, const int logf,
- 		} else if (pid > 0) {
- 			exit(EXIT_SUCCESS);
- 		}
--
--		/* Change the file mode mask. */
--		umask(0);
- 	} else {
- 		flog(LOG_DEBUG, "Not using daemon mode\n");
- 		pid = getpid();
--- 
-2.13.3
-
meta/recipes-core/libcgroup/libcgroup/module.patch new file +36 -0
new file mode 100644
index 00000000000..d8ff9b1479f
@@ -0,0 +1,36 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+From 76f0879056ce7e3f0123c277f2303954d0b6cead Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= <[email protected]>
+Date: Wed, 12 May 2021 20:36:02 +0000
+Subject: [PATCH 2/2] automake: build PAM module as unversioned DSO
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+PAM modules should be build as unversioned DSO.
+Add -avoid-version to pam_cgroup_la_LDFLAGS
+
+Signed-off-by: Tomasz Kłoczko <[email protected]>
+Signed-off-by: Tom Hromatka <[email protected]>
+---
+ src/pam/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pam/Makefile.am b/src/pam/Makefile.am
+index bd5a91d..4b0b2a9 100644
+--- a/src/pam/Makefile.am
++++ b/src/pam/Makefile.am
+@@ -4,7 +4,7 @@ if WITH_PAM
+ 
+ pamlib_LTLIBRARIES = pam_cgroup.la
+ pam_cgroup_la_SOURCES = pam_cgroup.c
+-pam_cgroup_la_LDFLAGS = -module
++pam_cgroup_la_LDFLAGS = -module -avoid-version
+ pam_cgroup_la_LIBADD = $(top_builddir)/src/libcgroup.la -lpam
+ 
+ endif
+-- 
+2.32.0
+
meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch +118 -69

302 lines not on this page · raw message

meta/recipes-core/libcgroup/libcgroup_0.41.bb deleted +0 -46

46 lines not on this page · raw message

meta/recipes-core/libcgroup/libcgroup_2.0.bb new file +34 -0
new file mode 100644
index 00000000000..bc0a75d46c1
@@ -0,0 +1,34 @@
+SUMMARY = "Linux control group abstraction library"
+HOMEPAGE = "http://libcg.sourceforge.net/"
+DESCRIPTION = "libcgroup is a library that abstracts the control group file system \
+in Linux. Control groups allow you to limit, account and isolate resource usage \
+(CPU, memory, disk I/O, etc.) of groups of processes."
+SECTION = "libs"
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=2d5025d4aa3495befef8f17206a5b0a1"
+
+inherit autotools pkgconfig
+
+DEPENDS = "bison-native flex-native"
+
+SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.bz2 \
+           file://musl-decls-compat.patch \
+           file://module.patch"
+
+SRC_URI[sha256sum] = "11a2fbf0e42f46089f406b8b0dca7fef04aec2f21600b70e402c5db3661305d7"
+UPSTREAM_CHECK_URI = "https://github.com/libcgroup/libcgroup/releases/"
+
+DEPENDS:append:libc-musl = " fts "
+EXTRA_OEMAKE:append:libc-musl = " LIBS=-lfts"
+
+PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
+PACKAGECONFIG[pam] = "--enable-pam-module-dir=${base_libdir}/security --enable-pam=yes,--enable-pam=no,libpam"
+
+PACKAGES =+ "cgroups-pam-plugin"
+FILES:cgroups-pam-plugin = "${base_libdir}/security/pam_cgroup.so*"
+FILES:${PN}-dev += "${base_libdir}/security/*.la"
+
+do_install:append() {
+	# Until we ship the test suite, this library isn't useful
+	rm -f ${D}${libdir}/libcgroupfortesting.*
+}
Signature · 1 line
2.25.1