Repository navigation
cgroup: fix path buffer overflows for long cgroup names - #2085
Merged
Merged
Conversation
linuxholic
force-pushed
the
codex/cgroup-path-overflows
branch
from
April 29, 2026 12:01
5988940 to
3cb2e1b
Compare
Owner
|
Fix looks good to me, but commit message is missing a |
Owner
|
And a some unittest build failures you will want to address. |
cgroup path construction uses fixed-size buffers in a few places. get_cgroup_root() allocates 64 bytes and then uses sprintf() to construct the cgroup directory path. write_int_to_file() similarly uses a fixed 256-byte stack buffer for the target file path. Long cgroup paths can therefore overflow these buffers and cause fio to abort. Replace the fixed-size buffers with dynamically sized allocation based on the actual path length. Keep the existing cgroup semantics and let normal filesystem errors such as ENOENT or ENAMETOOLONG flow through the existing error handling. Add unit tests covering long cgroup root paths and long control file paths. Without the fix, the long-path test aborts with a buffer overflow. With the fix, both new tests pass. Closes axboe#2084 Signed-off-by: yangpeng <yangpengxdu@gmail.com>
linuxholic
force-pushed
the
codex/cgroup-path-overflows
branch
from
April 30, 2026 02:34
3cb2e1b to
6292179
Compare
Contributor
Author
|
I force-pushed an update.
I also revalidated the Linux build and the unit tests in an Ubuntu container. |
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 fixes the long-path buffer overflows reported in #2084.
Problem
cgroup.cuses fixed-size buffers when constructing:With sufficiently long
cgroup=values, these buffers can overflow andfioaborts instead of failing cleanly.Fix
cgroup=behavior and error handling semanticsTest
Added unit tests for:
Validated in an Ubuntu container:
cgroup/get-root-long-pathaborts with*** buffer overflow detected ***