If a device is used as the root filesystem, it can't be built
off of devices which are within the root filesystem (just like
command line arguments to root=). For this reason, Linux has a
pseudo-filesystem for root= and md initialization based on the
function name_to_dev_t, which handles different ways of specifying
devices including PARTUUID and major:minor.
This patch applies name_to_dev_t to dm initialization. Rather
than assuming that all things which are not major:minor are paths
in an already-mounted filesystem, this patch first attempts
to look up the device in the filesystem, and applies name_to_dev_t
if it is not found there.
In terms of backwards compatibility, there are some cases where
behavior will be different:
- If you have a file in the current working directory named 1:2 and
you initialze DM there, then it will try to use that file rather
than the disk with that major/minor pair as a backing device.
- Similarly for other bdev types which name_to_dev_t knows how to
interpret, the previous behavior was to repeatedly check for the
existence of the file (e.g., while waiting for rootfs to come up)
but the new behavior is to use the name_to_dev_t interpretation.
For example, if you have a file named /dev/ubiblock0_0 which is
a symlink to /dev/sda3, but it is not yet present when dm starts
to initialize, then the name_to_dev_t interpretation will take
precedence.
I believe these incompatibilities would only show up in really
strange setups with bad practices and we don't have to worry about
them.
BUG=chromium:442794
TEST=Boots with verity from Urara
Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
(am from https://www.redhat.com/archives/dm-devel/2015-February/msg00043.html)
Change-Id: Ibf0e53d58f44fefa377fce6e31da8434e9dd9e9d
Reviewed-on: https://chromium-review.googlesource.com/255762
Reviewed-by: Kees Cook <keescook@chromium.org>