]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
Fix padding for Slab entry in /proc/meminfo
authorMatthew Stickney <fiendishlinux@gmail.com>
Sat, 9 Oct 2021 04:14:27 +0000 (00:14 -0400)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Oct 2021 14:53:11 +0000 (16:53 +0200)
The padding used for the 'Slab' entry of /proc/meminfo is three bytes
shorter than the padding used by the kernel. Since we report the host's
file size as the size of the lxcfs file, this means reads would be three
bytes short of the reported file length. In some cases this causes the
client to receive three additional NUL bytes at the end of the file,
which can cause various problems.

Signed-off-by: Matthew Stickney <fiendishlinux@gmail.com>
src/proc_fuse.c

index 290903a026a086619fa28d740f209a447d956560..3432c7540e999aeed20e65db18e4e1be0dd6386e 100644 (file)
@@ -1277,7 +1277,7 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
                        snprintf(lbuf, 100, "SwapFree:       %8" PRIu64 " kB\n", swfree);
                        printme = lbuf;
                } else if (startswith(line, "Slab:")) {
-                       snprintf(lbuf, 100, "Slab:        %8" PRIu64 " kB\n", (uint64_t)0);
+                       snprintf(lbuf, 100, "Slab:           %8" PRIu64 " kB\n", (uint64_t)0);
                        printme = lbuf;
                } else if (startswith(line, "Buffers:")) {
                        snprintf(lbuf, 100, "Buffers:        %8" PRIu64 " kB\n", (uint64_t)0);