Package: release.debian.org Severity: normal Tags: bookworm User: release.debian.org@packages.debian.org Usertags: pu X-Debbugs-Cc: pkg-lxc-devel@lists.alioth.debian.org, gibmat@debian.org Control: affects -1 + src:lxcfs [ Reason ] lxcfs 5.0.3-1 has a bug where /proc/cpuinfo is not properly reported within a 32bit arm container when the 64bit host has more than ~13 CPUs. This was initially reported in #1036818 and impacts some autopkgtests run on the ci.debian.net arm hosts. I have uploaded lxcfs 5.0.4-1 to unstable with a fix cherry-picked from the upstream main branch, and would like to include it in bookworm's version of lxcfs so that the CI arm servers can operate properly. [ Impact ] autopkgtests run on the CI infrastructure have been erroneously failing for some packages, requiring workarounds. Fixing this will allow autopkgtests for armel/armhf runs to be useful once again. [ Tests ] I have tested the patch locally in a QEMU VM, both when initially debugging the issue as well as installing the proposed update. The changes have been reviewed and accepted by the upstream developers. [ Risks ] The risk of regression is limited -- the changes have been reviewed and accepted by the upstream developers. The fix is small and targeted. [ Checklist ] [*] *all* changes are documented in the d/changelog [*] I reviewed all changes and I approve them [*] attach debdiff against the package in (old)stable [*] the issue is verified as fixed in unstable [ Changes ] Backport upstream commit fc8f593bda9eb4692daa07512ef6ba60dc39aded, which was merged upstream earlier today and will be included in the next release of lxcfs. There's also a small change to adjust the default branch used by gbp to reflect the new branch for bookworm fixes. [ Other info ] The source debdiff is attached.
diff -Nru lxcfs-5.0.3/debian/changelog lxcfs-5.0.3/debian/changelog
--- lxcfs-5.0.3/debian/changelog 2023-01-17 01:21:28.000000000 +0000
+++ lxcfs-5.0.3/debian/changelog 2023-09-15 21:32:11.000000000 +0000
@@ -1,3 +1,11 @@
+lxcfs (5.0.3-1+deb12u1) bookworm; urgency=medium
+
+ * Cherry-pick upstream fix for /proc/cpuinfo being empty within an arm32
+ container with large numbers of CPUs (See: #1036818)
+ * Adjust branch in d/gbp.conf
+
+ -- Mathias Gibbens <gibmat@debian.org> Fri, 15 Sep 2023 21:32:11 +0000
+
lxcfs (5.0.3-1) unstable; urgency=medium
[ Mathias Gibbens ]
diff -Nru lxcfs-5.0.3/debian/gbp.conf lxcfs-5.0.3/debian/gbp.conf
--- lxcfs-5.0.3/debian/gbp.conf 2023-01-17 01:21:28.000000000 +0000
+++ lxcfs-5.0.3/debian/gbp.conf 2023-09-15 21:32:07.000000000 +0000
@@ -1,3 +1,3 @@
[DEFAULT]
pristine-tar = True
-debian-branch = master
+debian-branch = debian/bookworm
diff -Nru lxcfs-5.0.3/debian/patches/000-fix-arm32-personality.patch lxcfs-5.0.3/debian/patches/000-fix-arm32-personality.patch
--- lxcfs-5.0.3/debian/patches/000-fix-arm32-personality.patch 1970-01-01 00:00:00.000000000 +0000
+++ lxcfs-5.0.3/debian/patches/000-fix-arm32-personality.patch 2023-09-15 21:32:07.000000000 +0000
@@ -0,0 +1,88 @@
+From fc8f593bda9eb4692daa07512ef6ba60dc39aded Mon Sep 17 00:00:00 2001
+From: Mathias Gibbens <gibmat@debian.org>
+Date: Mon, 4 Sep 2023 00:13:57 +0000
+Subject: [PATCH] proc: Fix /proc/cpuinfo not respecting personality
+
+It was found that the personality within the container was not being
+properly respected, which for large numbers of CPUs would break
+reporting of /proc/cpuinfo in arm32 containers running on an arm64 host.
+
+Signed-off-by: Mathias Gibbens <gibmat@debian.org>
+---
+ src/proc_fuse.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 47 insertions(+), 2 deletions(-)
+
+diff --git a/src/proc_fuse.c b/src/proc_fuse.c
+index 25af10a1..40eb2680 100644
+--- a/src/proc_fuse.c
++++ b/src/proc_fuse.c
+@@ -82,6 +82,45 @@ static off_t get_procfile_size(const char *path)
+ return answer;
+ }
+
++static off_t get_procfile_size_with_personality(const char *path)
++{
++ struct fuse_context *fc = fuse_get_context();
++ __u32 host_personality = liblxcfs_personality(), caller_personality;
++ bool change_personality;
++ int ret;
++ off_t procfile_size_ret;
++
++ if (get_task_personality(fc->pid, &caller_personality) < 0)
++ return log_error(0, "Failed to get caller process (pid: %d) personality", fc->pid);
++
++ /* do we need to change thread personality? */
++ change_personality = host_personality != caller_personality;
++
++ if (change_personality) {
++ ret = personality(caller_personality);
++ if (ret == -1)
++ return log_error(0, "Call to personality(%d) failed: %s\n",
++ caller_personality, strerror(errno));
++
++ lxcfs_debug("task (tid: %d) personality was changed %d -> %d\n",
++ (int)syscall(SYS_gettid), ret, caller_personality);
++ }
++
++ procfile_size_ret = get_procfile_size(path);
++
++ if (change_personality) {
++ ret = personality(host_personality);
++ if (ret == -1)
++ return log_error(0, "Call to personality(%d) failed: %s\n",
++ host_personality, strerror(errno));
++
++ lxcfs_debug("task (tid: %d) personality was restored %d -> %d\n",
++ (int)syscall(SYS_gettid), ret, host_personality);
++ }
++
++ return procfile_size_ret;
++}
++
+ __lxcfs_fuse_ops int proc_getattr(const char *path, struct stat *sb)
+ {
+ struct timespec now;
+@@ -106,7 +145,10 @@ __lxcfs_fuse_ops int proc_getattr(const char *path, struct stat *sb)
+ strcmp(path, "/proc/swaps") == 0 ||
+ strcmp(path, "/proc/loadavg") == 0 ||
+ strcmp(path, "/proc/slabinfo") == 0) {
+- sb->st_size = get_procfile_size(path);
++ if (liblxcfs_functional())
++ sb->st_size = get_procfile_size_with_personality(path);
++ else
++ sb->st_size = get_procfile_size(path);
+ sb->st_mode = S_IFREG | 00444;
+ sb->st_nlink = 1;
+ return 0;
+@@ -164,7 +206,10 @@ __lxcfs_fuse_ops int proc_open(const char *path, struct fuse_file_info *fi)
+
+ info->type = type;
+
+- info->buflen = get_procfile_size(path) + BUF_RESERVE_SIZE;
++ if (liblxcfs_functional())
++ info->buflen = get_procfile_size_with_personality(path) + BUF_RESERVE_SIZE;
++ else
++ info->buflen = get_procfile_size(path) + BUF_RESERVE_SIZE;
+
+ info->buf = zalloc(info->buflen);
+ if (!info->buf)
diff -Nru lxcfs-5.0.3/debian/patches/series lxcfs-5.0.3/debian/patches/series
--- lxcfs-5.0.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000
+++ lxcfs-5.0.3/debian/patches/series 2023-09-15 21:32:07.000000000 +0000
@@ -0,0 +1 @@
+000-fix-arm32-personality.patch
Attachment:
signature.asc
Description: This is a digitally signed message part