-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Critical Bug in Unfreeze Propagation #6631
Comments
Your detailed report should be helpful to the maintainers. See: https://docs.kernel.org/admin-guide/reporting-issues.html |
Yes - see dialog at #6632. |
lfd-lists
pushed a commit
to linux-mailinglist-archives/cgroups.vger.kernel.org.0
that referenced
this issue
Feb 1, 2025
lfd-lists
pushed a commit
to linux-mailinglist-archives/cgroups.vger.kernel.org.0
that referenced
this issue
Feb 1, 2025
lfd-lists
pushed a commit
to linux-mailinglist-archives/cgroups.vger.kernel.org.0
that referenced
this issue
Feb 11, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
In the
cgroup_propagate_frozen
function, during unfreezing (whenfrozen
is false), the code subtractsdesc
(which increments for each unfrozen parent) from each ancestor'snr_frozen_descendants
. This results in over-subtraction, leading to negative counts and incorrect frozen states.kernel/cgroup/freezer.c
Example Scenario:
desc=1
from B's count (correctly setting it to 0). Then subtractsdesc=2
from A's count, reducing it from 2 to 0. If A has another frozen child D, this incorrectly sets A's count to 0 instead of 1 (since D is still frozen).Additional Considerations
WARN_ON_ONCE
to catch underflows, though proper decrement by 1 should prevent negatives.The identified bug leads to incorrect frozen state propagation, particularly in hierarchical cgroups. The proposed fix corrects the decrement logic during unfreezing, ensuring accurate
nr_frozen_descendants
counts and proper state transitions. This issue warrants a kernel patch to prevent system instability from incorrect cgroup freezing.Steps to reproduce the behaviour
Test Case: Incorrect unfreezing of parent cgroup when one of multiple frozen descendants is unfrozen.
# Create cgroups mkdir /sys/fs/cgroup/A mkdir /sys/fs/cgroup/A/B mkdir /sys/fs/cgroup/A/D mkdir /sys/fs/cgroup/A/B/C
Expected Behavior:
A
should remain frozen because its descendantD
is still frozen.B
should unfreeze (correctly) because its only descendantC
was unfrozen.Actual Behavior (with Bug):
A
incorrectly unfreezes due to over-decrement innr_frozen_descendants
.Debugging Tips:
ftrace
to monitorcgroup_propagate_frozen
calls:Device (s)
Other
System
rpi-6.6.y
Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: