Fix byte order while parsing cpuset range to bits

Bug #1993221 reported by Chengen Du
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
runc (Ubuntu)
Fix Released
Undecided
Chengen Du
Focal
Fix Released
Undecided
Chengen Du
Jammy
Fix Released
Undecided
Chengen Du
Kinetic
Fix Released
Undecided
Chengen Du

Bug Description

[Impact]
Runc parses cpuset range to bits in the case of cgroup v2 + systemd as cgroup driver.
The byte order representation differs from systemd expectation,
which will set different cpuset range in systemd transient unit if the length of parsed byte array exceeds one.
The cpuset.cpus in cgroup will also be set to wrong value after reloading systemd manager configuration.

[Test Plan]
# cat config.json
...
"resources": {
 ...
 "cpu": {
  "cpus": "10-23"
 }
},
...
# runc --systemd-cgroup run test
# cat /run/systemd/transient/runc-test.scope.d/50-AllowedCPUs.conf
# This is a drop-in unit file extension, created via "systemctl set-property"
# or an equivalent operation. Do not edit.
[Scope]
AllowedCPUs=0-7 10-15
# systemctl daemon-reload
# cat /sys/fs/cgroup/system.slice/runc-test.scope/cpuset.cpus
0-7,10-15

[Where problems could occur]
Using the same byte order with systemd makes the parser be endian free.
The regression can be considered as low.

[Other Info]

Chengen Du (chengendu)
Changed in runc (Ubuntu Focal):
assignee: nobody → ChengEn, Du (chengendu)
Changed in runc (Ubuntu Jammy):
assignee: nobody → ChengEn, Du (chengendu)
Changed in runc (Ubuntu Kinetic):
assignee: nobody → ChengEn, Du (chengendu)
Revision history for this message
Chengen Du (chengendu) wrote :

The issue will happen only if the environment uses cgroupv2 and has systemd version >= 244.
The version of systemd on bionic is 237, which will not encounter the issue,
so this bug may not need to be fixed on bionic.
The only concern is that systemd will be upgraded to new version on bionic in the future.

Revision history for this message
Chengen Du (chengendu) wrote :
Revision history for this message
Chengen Du (chengendu) wrote :
Revision history for this message
Chengen Du (chengendu) wrote :
Changed in runc (Ubuntu Focal):
status: New → In Progress
Changed in runc (Ubuntu Jammy):
status: New → In Progress
Changed in runc (Ubuntu Kinetic):
status: New → In Progress
tags: added: sts
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "focal_fix_cpuset_range_byte_order.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks for identifying the issue and working with upstream to get the needed changes merged.

I took a look at the debdiffs and I'd like to ask if you could submit those changes as PRs in the GitHub repo we do maintain the runc package:

https://github.com/tianon/debian-runc

We have branches for each Ubuntu series you are proposing changes: focal, jammy and ubuntu (kinetic - current development release). You can add myself there as a reviewer.

However, before you submit those PRs I already have some review points for you:

- The version string used in those updates are wrong.
  + In Focal, you used 1.1.0-0ubuntu1~20.04.1ubuntu1 and it should be 1.1.0-0ubuntu1~20.04.2
  + In Jammy, you used 1.1.0-0ubuntu2 but it should be 1.1.0-0ubuntu1.1
  + In Kinetic, at this point, it will likely be a SRU as well, so it should be 1.1.2-0ubuntu1.1 instead of 1.1.2-0ubuntu2
  + See this wiki page for more info about versioning: https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Update_the_packaging

- In the changelog entry, I'd prefer if you mention the patch filename in the subitem. This makes easier to associate the mentioned change and the patch which introduced that change. This is a personal preference, this is not mandatory. Also, please try to avoid lines with more than 80 characters, break the line if that happens.

- In the DEP-3 headers in the patch: I believe it would be better to add a link to the merged commit in the Origin field. This one: https://github.com/opencontainers/runc/commit/70e3b757c0eb39221aa5a4dbeb723c88f348f5cd. And if you think it is good to keep the link of the PR because of the discussion there, you can add the Bug field and add it (yes, this is not a bug itself, but we can use it in this case).

Revision history for this message
Chengen Du (chengendu) wrote :

Thanks for your patient on pointing out my mistakes.
I have fixed all your comments and requested PRs.
Please help to verify PRs.
Any comments and suggestions are welcome!

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Changes merged on GitHub and packages were uploaded to the unapproved queue. I already subscribed ubuntu-sru, so they can review the proposed changes.

Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello ChengEn, or anyone else affected,

Accepted runc into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/runc/1.1.0-0ubuntu1~20.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in runc (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Chris Halse Rogers (raof) wrote :

Hello ChengEn, or anyone else affected,

Accepted runc into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/runc/1.1.0-0ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in runc (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed-jammy
Revision history for this message
Chris Halse Rogers (raof) wrote :

Hello ChengEn, or anyone else affected,

Accepted runc into kinetic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/runc/1.1.2-0ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-kinetic to verification-done-kinetic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-kinetic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in runc (Ubuntu Kinetic):
status: In Progress → Fix Committed
tags: added: verification-needed-kinetic
Revision history for this message
Chengen Du (chengendu) wrote :

I have performed the following tests:
  1.1.0-0ubuntu1~20.04.2 / focal-proposed
  1.1.0-0ubuntu1.1 / jammy-proposed
  1.1.2-0ubuntu1.1 / kinetic-proposed
The issue no longer exists by testing with the same test plan.

tags: added: verification-done verification-done-focal verification-done-jammy verification-done-kinetic
removed: verification-needed verification-needed-focal verification-needed-jammy verification-needed-kinetic
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package runc - 1.1.2-0ubuntu1.1

---------------
runc (1.1.2-0ubuntu1.1) kinetic; urgency=medium

  * d/p/fix_cpuset_range_byte_order.patch: fix byte order while parsing cpuset
    range to bits (LP: #1993221)

 -- Chengen Du <email address hidden> Mon, 17 Oct 2022 15:59:43 +0800

Changed in runc (Ubuntu):
status: Fix Committed → Fix Released
Changed in runc (Ubuntu Kinetic):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for runc has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package runc - 1.1.0-0ubuntu1.1

---------------
runc (1.1.0-0ubuntu1.1) jammy; urgency=medium

  * d/p/fix_cpuset_range_byte_order.patch: fix byte order while parsing cpuset
    range to bits (LP: #1993221)

 -- Chengen Du <email address hidden> Mon, 17 Oct 2022 15:48:16 +0800

Changed in runc (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package runc - 1.1.0-0ubuntu1~20.04.2

---------------
runc (1.1.0-0ubuntu1~20.04.2) focal; urgency=medium

  * d/p/fix_cpuset_range_byte_order.patch: fix byte order while parsing cpuset
    range to bits (LP: #1993221)

 -- Chengen Du <email address hidden> Mon, 17 Oct 2022 08:59:54 +0000

Changed in runc (Ubuntu Focal):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.