Skip to content
This repository was archived by the owner on Sep 24, 2020. It is now read-only.

core: always read /proc/self/mountinfo, never /etc/mtab - #48

Merged
marineam merged 1 commit into
coreos:v229-coreosfrom
marineam:v229-coreos
Apr 7, 2016
Merged

marineam merged 1 commit into
coreos:v229-coreosfrom
marineam:v229-coreos

Conversation

@marineam

@marineam marineam commented Apr 7, 2016

Copy link
Copy Markdown

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. :)

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. :)
@marineam

marineam commented Apr 7, 2016

Copy link
Copy Markdown
Author

Upstream PR: systemd#2978

@crawford

crawford commented Apr 7, 2016

Copy link
Copy Markdown

LGTM

@marineam
marineam merged commit e812c3c into coreos:v229-coreos Apr 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants