snap-update-ns incorrectly sorts mount profile entries

Bug #1828357 reported by Zygmunt Krynicki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Triaged
High
Samuele Pedroni

Bug Description

When snap-update-ns processes a pair of mount profiles, current and desired, to determine what needs to be done to transform the current mount profile into the desired mount profile.

The diff-like algorithm works on an array of structures that describe a fstab-like mount entry. Each entry has a destination, or mount location, a mount source and some mount options. The structures are sorted by mount destination, with some quirks, like always doing "over mount" type operations ahead of all other operations.

I believe this algorithm is incorrect because of the following observations:

- a layout creating a tmpfs in $SNAP/foo is sorted AFTER a content bind mount creating a file in $SNAP/foo/a
- the algorithm does not understand bind mounts, where both the mount destination and a mount source is a path, considering only the destination path.

I believe the algorithm should be changed to topological sorting where bind mounts are represented by nodes with two outgoing edges and regular mounts are represented by nodes with only one edge.

Zygmunt Krynicki (zyga)
description: updated
Changed in snapd:
assignee: nobody → Zygmunt Krynicki (zyga)
importance: Undecided → High
Zygmunt Krynicki (zyga)
Changed in snapd:
status: New → Triaged
Revision history for this message
Ian Johnson (anonymouse67) wrote :

Zygmunt was this work ever done?

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I think Maciek figured out a bug in sorting but we didn’t do the kind of sorting described here.

Changed in snapd:
assignee: Zygmunt Krynicki (zyga) → Samuele Pedroni (pedronis)
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.