Refine proc mounts entries traversal

Bug #2054390 reported by Chengen Du
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cryptsetup (Ubuntu)
In Progress
Undecided
Chengen Du
Focal
In Progress
Undecided
Chengen Du
Jammy
In Progress
Undecided
Chengen Du
Mantic
In Progress
Undecided
Chengen Du
Noble
In Progress
Undecided
Chengen Du

Bug Description

[Impact]
The shell's read builtin iterates through /proc/mounts one byte at a time. This becomes problematic when LDAP automount maps generate a large number of entries in /proc/mounts. It can lead to timeout issues, especially when iterating through the entries twice in the cryptroot hook.

[Fix]
Applying the following upstream commit can resolve this issue.

95fd4be9b4c6 d/functions: get_mnt_devno(): Speed up execution time on large /proc/mounts.
    Use awk rather than a `while read; do done` loop here as the /proc/mounts
    pseudo-file can be many thousands lines long and the shell's `read` builtin
    traverses it one read(2) at the time which cruelly slows down execution time.

    See https://salsa.debian.org/cryptsetup-team/cryptsetup/-/merge_requests/36 .

[Test Plan]
Our primary objective is to ensure that the output remains consistent when obtaining devnos through iteration.
1. Execute the /usr/share/initramfs-tools/hooks/cryptroot binary
2. Confirm that the output does not include the following warning message:
cryptsetup: WARNING: Couldn't determine root device

[Where problems could occur]
The patch exclusively modifies the method of extracting information without altering the underlying hook logic.
It's crucial to note that the successful generation of the crypttab is contingent upon the accuracy of the information provided by the patch.
Any inaccuracies may impede the crypttab generation process.

Tags: patch
Chengen Du (chengendu)
description: updated
Revision history for this message
Chengen Du (chengendu) wrote :

Debdiff for Focal

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

Debdiff for Jammy

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

Debdiff for Mantic

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

Debdiff for Noble

Changed in cryptsetup (Ubuntu Focal):
assignee: nobody → Chengen Du (chengendu)
Changed in cryptsetup (Ubuntu Jammy):
assignee: nobody → Chengen Du (chengendu)
Changed in cryptsetup (Ubuntu Mantic):
assignee: nobody → Chengen Du (chengendu)
Changed in cryptsetup (Ubuntu Noble):
assignee: nobody → Chengen Du (chengendu)
Changed in cryptsetup (Ubuntu Focal):
status: New → In Progress
Changed in cryptsetup (Ubuntu Jammy):
status: New → In Progress
Changed in cryptsetup (Ubuntu Mantic):
status: New → In Progress
Changed in cryptsetup (Ubuntu Noble):
status: New → In Progress
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "lp2054390_focal_refine_proc_mounts_entries_traversal.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
Chengen Du (chengendu) wrote :

There is some feedback from upstream regarding this implementation [1]. Before proceeding with the SRU process, I will reach out to them to confirm that the patch won't introduce any regressions. I'll keep the bug updated with their response.

[1] https://salsa.debian.org/cryptsetup-team/cryptsetup/-/merge_requests/36

Revision history for this message
Steve Langasek (vorlon) wrote :

blocked per last comment.

Changed in cryptsetup (Ubuntu Noble):
status: In Progress → Incomplete
Revision history for this message
Benjamin Drung (bdrung) wrote :

Unsubscribing ~ubuntu-sponsors for now. Please re-subscribe once ready.

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

Debdiff for Focal

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

Debdiff for Jammy

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

Debdiff for Mantic

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

Debdiff for Noble

Changed in cryptsetup (Ubuntu Noble):
status: Incomplete → In Progress
Revision history for this message
Chengen Du (chengendu) wrote :

Upstream has merged the patch [1]. I have backported the new patch for SRU.

[1] https://salsa.debian.org/cryptsetup-team/cryptsetup/-/merge_requests/36

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

Following the discussion with the SRU sponsor (i.e., @mfo/@halves), the SRU will be put on hold until the Noble release. The patch is not considered critical for the release, as it focuses on optimization rather than bug fixes. It would be advantageous to opt for a safer approach, allowing for additional time for thorough testing.

To post a comment you must log in.