]> git.apps.os.sepia.ceph.com Git - fscrypt.git/commit
filesystem: get correct device for kernel-mounted rootfs
authorEric Biggers <ebiggers@google.com>
Tue, 29 Oct 2019 07:04:39 +0000 (00:04 -0700)
committerEric Biggers <ebiggers@google.com>
Wed, 30 Oct 2019 16:11:29 +0000 (09:11 -0700)
commitc7da2443d6ffa51727db09f8ef1df6aea8c7612c
tree0684f76af89150371c7fc69092b978492d89f5e7
parentd9d2b32f9fa9e39b154b71b2abc9eda43d5aaa3c
filesystem: get correct device for kernel-mounted rootfs

A root filesystem mounted via the kernel command line always has a
source of "/dev/root", which isn't a real device node.  This makes
fscrypt think this filesystem doesn't have a source device, which breaks
creating login passphrase-protected directories on other filesystems:

    fscrypt encrypt: filesystem /: no device for mount "/": system error: cannot create filesystem link

This also makes 'fscrypt status' show a blank source device:

    MOUNTPOINT  DEVICE          FILESYSTEM  ENCRYPTION     FSCRYPT
    /                           ext4        supported      Yes

To fix this case, update loadMountInfo() to map the device number to the
device name via sysfs rather than use the mount source field.
filesystem/filesystem.go
filesystem/mountpoint.go
filesystem/path.go