This repository was archived by the owner on Sep 24, 2020. It is now read-only.
Repository navigation
core: always read /proc/self/mountinfo, never /etc/mtab - #48
Merged
Merged
Conversation
Passing NULL for the filename to mnt_table_parse_mtab allows libmount to pick either /etc/mtab or /proc/self/mountinfo depending on whether /etc/mtab is a regular file or not. Normally it is a symlink but when booting with an empty /etc the symlink won't be created until tmpfiles runs. Combined with 6f20f85 which re-enables writing to /etc/mtab we now have systemd reading an incomplete mount table until tmpfiles runs. Whether or not this is a problem is inherently racy but can cause mount units to be marked as dead. Later if the unit is activated it may fail. CoreOS has hit this bug a couple times over with usr.mount. Relatedly, util-linux introduced the --enable-libmount-force-mountinfo configure option as an alternative work-around for this sort of situation. Considering that option is not enabled by default and systemd should never read /etc/mtab regardless of util-linux's build config we may as well fix the bug here too. :)
Author
|
Upstream PR: systemd#2978 |
|
LGTM |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Passing NULL for the filename to mnt_table_parse_mtab allows libmount to
pick either /etc/mtab or /proc/self/mountinfo depending on whether
/etc/mtab is a regular file or not. Normally it is a symlink but when
booting with an empty /etc the symlink won't be created until tmpfiles
runs. Combined with 6f20f85 which re-enables writing to /etc/mtab we
now have systemd reading an incomplete mount table until tmpfiles runs.
Whether or not this is a problem is inherently racy but can cause mount
units to be marked as dead. Later if the unit is activated it may fail.
CoreOS has hit this bug a couple times over with usr.mount.
Relatedly, util-linux introduced the --enable-libmount-force-mountinfo
configure option as an alternative work-around for this sort of
situation. Considering that option is not enabled by default and systemd
should never read /etc/mtab regardless of util-linux's build config we
may as well fix the bug here too. :)