fs: fix/improve cpuacct.usage_all parsing#50
Merged
AkihiroSuda merged 1 commit intoopencontainers:mainfrom Oct 31, 2025
Merged
Conversation
Contributor
Author
|
@lifubang PTAL |
14192a4 to
4bc37fa
Compare
AkihiroSuda
reviewed
Oct 30, 2025
cyphar
approved these changes
Oct 30, 2025
Member
There was a problem hiding this comment.
As @AkihiroSuda said, it would be nice if the commit message and/or test mentioned that this is necessary because of out-of-tree patches in Tencent's kernels, but otherwise LGTM.
First, we can reasonably expect the first three fields of
cpuacct.usage_all to be "cpu user system", even for future kernels,
and if we see something different, it doesn't make sense to continue.
So check that the header is as expected, and error out otherwise.
Second, if we have more than 3 values, and we've checked that the first
3 are as expected ("cpu user system"), we can safely ignore extra
columns. This fixes an issue on a custom kernel from Tencent, which
adds a few extra columns (see [1]), as reported in issue 46.
Add tests for both cases.
Fixes issue 46.
[1]: OpenCloudOS/TencentOS-kernel-0@0b66781
Reported-by: vimiix <i@vimiix.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
4bc37fa to
5777053
Compare
Contributor
Author
|
@lifubang PTAL 🙏🏻 |
AkihiroSuda
approved these changes
Oct 31, 2025
smallprogram
added a commit
to smallprogram/openwrt_packages
that referenced
this pull request
Jan 29, 2026
cgroups: provide iocost statistics for cgroupv2. (opencontainers/cgroups#43) cgroups: retry DBus connection when it fails with EAGAIN.(opencontainers/cgroups#45) cgroups: improve cpuacct.usage_all resilience when parsing data from patched kernels (such as the Tencent kernels). (opencontainers/cgroups#46,opencontainers/cgroups#50) libct: close child fds on prepareCgroupFD error. (openwrt#4936) libct: fix mips compilation. (openwrt#4962, openwrt#4967) When configuring a tmpfs mount, only set the mode= argument if the target path already existed. This fixes a regression introduced in our CVE-2025-52881 mitigation patches. (openwrt#4971, openwrt#4976) Fix various file descriptor leaks and add additional tests to detect them as comprehensively as possible. (openwrt#5007, openwrt#5021, openwrt#5034) The "hallucination" helpers added as part of the CVE-2025-52881 mitigation have been made more generic and now apply to all of our pathrs helper functions, which should ensure we will not regress dangling symlink users. (openwrt#4985) Signed-off-by: David Mandy <smallprogramzhusir@gmail.com> Signed-off-by: David Mandy <smallprogramzhusir@gmail.com>
1 task
smallprogram
added a commit
to smallprogram/openwrt_packages
that referenced
this pull request
Jan 29, 2026
cgroups: provide iocost statistics for cgroupv2. (opencontainers/cgroups#43) cgroups: retry DBus connection when it fails with EAGAIN.(opencontainers/cgroups#45) cgroups: improve cpuacct.usage_all resilience when parsing data from patched kernels (such as the Tencent kernels). (opencontainers/cgroups#46,opencontainers/cgroups#50) libct: close child fds on prepareCgroupFD error. (openwrt#4936) libct: fix mips compilation. (openwrt#4962, openwrt#4967) When configuring a tmpfs mount, only set the mode= argument if the target path already existed. This fixes a regression introduced in our CVE-2025-52881 mitigation patches. (openwrt#4971, openwrt#4976) Fix various file descriptor leaks and add additional tests to detect them as comprehensively as possible. (openwrt#5007, openwrt#5021, openwrt#5034) The "hallucination" helpers added as part of the CVE-2025-52881 mitigation have been made more generic and now apply to all of our pathrs helper functions, which should ensure we will not regress dangling symlink users. (openwrt#4985) Signed-off-by: David Mandy <smallprogramzhusir@gmail.com>
smallprogram
added a commit
to smallprogram/openwrt_packages
that referenced
this pull request
Jan 29, 2026
cgroups: provide iocost statistics for cgroupv2. (opencontainers/cgroups#43) cgroups: retry DBus connection when it fails with EAGAIN.(opencontainers/cgroups#45) cgroups: improve cpuacct.usage_all resilience when parsing data from patched kernels (such as the Tencent kernels). (opencontainers/cgroups#46,opencontainers/cgroups#50) libct: close child fds on prepareCgroupFD error. (opencontainers/runc#4936) libct: fix mips compilation. (opencontainers/runc#4962, opencontainers/runc#4967) When configuring a tmpfs mount, only set the mode= argument if the target path already existed. This fixes a regression introduced in our CVE-2025-52881 mitigation patches. (opencontainers/runc#4971, opencontainers/runc#4976) Fix various file descriptor leaks and add additional tests to detect them as comprehensively as possible. (opencontainers/runc#5007, opencontainers/runc#5021, opencontainers/runc#5034) The "hallucination" helpers added as part of the CVE-2025-52881 mitigation have been made more generic and now apply to all of our pathrs helper functions, which should ensure we will not regress dangling symlink users. (opencontainers/runc#4985) Signed-off-by: David Mandy <smallprogramzhusir@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an alternative to #47, implementing ideas I left as review comments in there.
First, we can reasonably expect the first three fields of
cpuacct.usage_allto becpu user system, even for future kernels, and if we see something different, it doesn't make sense to continue. So check that the header is as expected, and error out otherwise.Second, if we have more than 3 values, and we've checked that the first 3 are as expected (
cpu user system), we can safely ignore extra columns. This fixes an issue on a custom kernel from Tencent, whichadds a few extra columns (see 1), as reported in #46.
Add tests for both cases.
Fixes: #46.