[pve-devel] [PATCH lxcfs] Update to latest upstream 2.0.0.beta1

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Feb 17 11:01:04 CET 2016


Commit 551c58dd1a7fbaebe92dd0f1f80f1789faa3a2eb

Drop patches applied upstream:
- 0001-fix-missing-dereferencing-in-must_strcat_pid.patch
- 0001-uptime-fix-pid1-and-reaper_busy-times.patch
- 0003-fix-leak-in-realloc-loop-in-must_strcat_pid.patch
- 0004-cgfs-fix-dorealloc-s-batch-allocation.patch

Update systemd unit to reflect options dropped upstream.
---
 debian/lxcfs.service                               |  2 +-
 ...-missing-dereferencing-in-must_strcat_pid.patch | 29 --------------
 ...001-uptime-fix-pid1-and-reaper_busy-times.patch | 45 ----------------------
 ...x-leak-in-realloc-loop-in-must_strcat_pid.patch | 34 ----------------
 ...004-cgfs-fix-dorealloc-s-batch-allocation.patch | 38 ------------------
 debian/patches/series                              |  4 --
 6 files changed, 1 insertion(+), 151 deletions(-)
 delete mode 100644 debian/patches/0001-fix-missing-dereferencing-in-must_strcat_pid.patch
 delete mode 100644 debian/patches/0001-uptime-fix-pid1-and-reaper_busy-times.patch
 delete mode 100644 debian/patches/0003-fix-leak-in-realloc-loop-in-must_strcat_pid.patch
 delete mode 100644 debian/patches/0004-cgfs-fix-dorealloc-s-batch-allocation.patch

diff --git a/debian/lxcfs.service b/debian/lxcfs.service
index 395842c..c0f2998 100644
--- a/debian/lxcfs.service
+++ b/debian/lxcfs.service
@@ -4,7 +4,7 @@ ConditionVirtualization=!container
 Before=lxc.service
 
 [Service]
-ExecStart=/usr/bin/lxcfs -f -s -o allow_other /var/lib/lxcfs/
+ExecStart=/usr/bin/lxcfs /var/lib/lxcfs/
 KillMode=none
 Restart=on-failure
 ExecStop=/bin/fusermount -u /var/lib/lxcfs
diff --git a/debian/patches/0001-fix-missing-dereferencing-in-must_strcat_pid.patch b/debian/patches/0001-fix-missing-dereferencing-in-must_strcat_pid.patch
deleted file mode 100644
index 06fe5ce..0000000
--- a/debian/patches/0001-fix-missing-dereferencing-in-must_strcat_pid.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From ab9a41700a2b9d422ab0fda1fe3873b4ae70b47b Mon Sep 17 00:00:00 2001
-From: Wolfgang Bumiller <w.bumiller at proxmox.com>
-Date: Thu, 7 Jan 2016 11:23:24 +0100
-Subject: [PATCH lxcfs 1/5] fix missing dereferencing in must_strcat_pid
-
-Fixes a segfault when reading a /tasks file of a cgroup
-containing a large number of pids.
-
-Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
----
- lxcfs.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lxcfs.c b/lxcfs.c
-index fe5ac3e..767a344 100644
---- a/lxcfs.c
-+++ b/lxcfs.c
-@@ -85,7 +85,7 @@ static void must_strcat_pid(char **src, size_t *sz, size_t *asz, pid_t pid)
- 		} while (!d);
- 		*src = d;
- 		*asz = BUF_RESERVE_SIZE;
--	} else if (strlen(tmp) + sz + 1 >= asz) {
-+	} else if (strlen(tmp) + *sz + 1 >= *asz) {
- 		do {
- 			d = realloc(d, *asz + BUF_RESERVE_SIZE);
- 		} while (!d);
--- 
-2.1.4
-
diff --git a/debian/patches/0001-uptime-fix-pid1-and-reaper_busy-times.patch b/debian/patches/0001-uptime-fix-pid1-and-reaper_busy-times.patch
deleted file mode 100644
index d4c24c9..0000000
--- a/debian/patches/0001-uptime-fix-pid1-and-reaper_busy-times.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From bb3f1796d71b17a2dd0502b2c43a38d6d07efb46 Mon Sep 17 00:00:00 2001
-From: Wolfgang Bumiller <w.bumiller at proxmox.com>
-Date: Mon, 14 Dec 2015 08:57:12 +0100
-Subject: [PATCH lxcfs] uptime: fix pid1 and reaper_busy times
-
-- reaper_busy was off by a factor of 10 (possibly originally
-for precision?)
-- get_pid1_time was expecting a '1' byte like in
-the pid_to/from_ns_wrapper functions instead of reading its
-value which is what is actually written
-
-Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
----
- lxcfs.c | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/lxcfs.c b/lxcfs.c
-index 90a0b7f..fe5ac3e 100644
---- a/lxcfs.c
-+++ b/lxcfs.c
-@@ -2449,10 +2449,9 @@ static long int get_pid1_time(pid_t pid)
- 	ret = select(cpipe[0]+1, &s, NULL, NULL, &tv);
- 	if (ret <= 0)
- 		goto fail;
--	ret = read(cpipe[0], &v, 1);
--	if (ret != sizeof(char) || v != '1') {
-+	ret = read(cpipe[0], &v, sizeof(v));
-+	if (ret != sizeof(v))
- 		goto fail;
--	}
- 
- 	wait_for_pid(cpid);
- 
-@@ -2607,7 +2606,7 @@ static unsigned long get_reaper_busy(pid_t task)
- 	if (!cgfs_get_value("cpuacct", cgroup, "cpuacct.usage", &usage_str))
- 		goto out;
- 	usage = strtoul(usage_str, NULL, 10);
--	usage /= 100000000;
-+	usage /= 1000000000;
- 
- out:
- 	free(cgroup);
--- 
-2.1.4
-
diff --git a/debian/patches/0003-fix-leak-in-realloc-loop-in-must_strcat_pid.patch b/debian/patches/0003-fix-leak-in-realloc-loop-in-must_strcat_pid.patch
deleted file mode 100644
index bfe6239..0000000
--- a/debian/patches/0003-fix-leak-in-realloc-loop-in-must_strcat_pid.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From cc1d9baadd760a3e6fc757d31569fbf46ad37dbd Mon Sep 17 00:00:00 2001
-From: Wolfgang Bumiller <w.bumiller at proxmox.com>
-Date: Thu, 7 Jan 2016 11:32:59 +0100
-Subject: [PATCH lxcfs 3/5] fix leak in realloc loop in must_strcat_pid
-
-If the first realloc() call fails then 'd' becomes NULL,
-subsequent realloc() retries will behave like malloc() and
-the the original src pointer is never freed. Further more
-the newly allocated data then contains uninitialized data
-where the previous pids had been stored.
-Avoid this by passing the the original pointer from '*src'
-to realloc().
-
-Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
----
- lxcfs.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lxcfs.c b/lxcfs.c
-index 8605000..d738e79 100644
---- a/lxcfs.c
-+++ b/lxcfs.c
-@@ -87,7 +87,7 @@ static void must_strcat_pid(char **src, size_t *sz, size_t *asz, pid_t pid)
- 		*asz = BUF_RESERVE_SIZE;
- 	} else if (tmplen + *sz + 1 >= *asz) {
- 		do {
--			d = realloc(d, *asz + BUF_RESERVE_SIZE);
-+			d = realloc(*src, *asz + BUF_RESERVE_SIZE);
- 		} while (!d);
- 		*src = d;
- 		*asz += BUF_RESERVE_SIZE;
--- 
-2.1.4
-
diff --git a/debian/patches/0004-cgfs-fix-dorealloc-s-batch-allocation.patch b/debian/patches/0004-cgfs-fix-dorealloc-s-batch-allocation.patch
deleted file mode 100644
index d4db54b..0000000
--- a/debian/patches/0004-cgfs-fix-dorealloc-s-batch-allocation.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 4d373ffcfee6853662421370fad3df3701573712 Mon Sep 17 00:00:00 2001
-From: Wolfgang Bumiller <w.bumiller at proxmox.com>
-Date: Thu, 7 Jan 2016 12:49:51 +0100
-Subject: [PATCH lxcfs 4/5] cgfs: fix dorealloc's batch allocation
-
-The initial check should use real lengths as with modulo a
-new required length of eg. 52 would be considered smaller
-than an old length of 48 (2 < 48).
-
-To get the 'batches' count 'newlen' must be divided and not
-taken modulo BATCH_SIZE. Otherwise '101', which would need a
-3rd batch to reach 150, would end up with two (2*50 = 100
-bytes) and thereby be truncated instead.
-
-Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
----
- cgfs.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/cgfs.c b/cgfs.c
-index 0659e9e..681a478 100644
---- a/cgfs.c
-+++ b/cgfs.c
-@@ -75,9 +75,9 @@ static inline void drop_trailing_newlines(char *s)
- static void dorealloc(char **mem, size_t oldlen, size_t newlen)
- {
- 	int batches;
--	if (newlen % BATCH_SIZE <= oldlen % BATCH_SIZE)
-+	if (newlen <= oldlen)
- 		return;
--	batches = (newlen % BATCH_SIZE) + 1;
-+	batches = (newlen / BATCH_SIZE) + 1;
- 	if (!*mem) {
- 		do {
- 			*mem = malloc(batches * BATCH_SIZE);
--- 
-2.1.4
-
diff --git a/debian/patches/series b/debian/patches/series
index 345ea63..bf650b4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1 @@
 do-not-start-without-lxcfs.patch
-0001-uptime-fix-pid1-and-reaper_busy-times.patch
-0001-fix-missing-dereferencing-in-must_strcat_pid.patch
-0003-fix-leak-in-realloc-loop-in-must_strcat_pid.patch
-0004-cgfs-fix-dorealloc-s-batch-allocation.patch
-- 
2.1.4





More information about the pve-devel mailing list