<feed xmlns='http://www.w3.org/2005/Atom'>
<title>fscrypt.git/filesystem, branch v0.2.6</title>
<subtitle>Go tool for managing Linux filesystem encryption
</subtitle>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/'/>
<entry>
<title>filesystem: don't overwrite existing protector links</title>
<updated>2020-01-28T18:45:52+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2020-01-28T04:16:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=07d744068d437b09d7a07975e88e18440f5db2f3'/>
<id>07d744068d437b09d7a07975e88e18440f5db2f3</id>
<content type='text'>
When adding a protector to a policy, don't unconditionally overwrite the
protector link, because it may already exist.  Instead, if it already
exists and points to the mount, just use it.  If it already exists and
points to the wrong place, return an error.

Also add a bool to the return value of AddLinkedProtector() so that
callers can check whether the link was newly created or not.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When adding a protector to a policy, don't unconditionally overwrite the
protector link, because it may already exist.  Instead, if it already
exists and points to the mount, just use it.  If it already exists and
points to the wrong place, return an error.

Also add a bool to the return value of AddLinkedProtector() so that
callers can check whether the link was newly created or not.
</pre>
</div>
</content>
</entry>
<entry>
<title>filesystem: remove canonicalizePath() (#185)</title>
<updated>2020-01-23T21:41:42+00:00</updated>
<author>
<name>ebiggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2020-01-23T21:41:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=f2eb79fb5fb10275c014b55c13e28ff02d3b70a8'/>
<id>f2eb79fb5fb10275c014b55c13e28ff02d3b70a8</id>
<content type='text'>
canonicalizePath() is now only used by an error path in
getMountFromLink(), which we can make use getDeviceName() instead.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
canonicalizePath() is now only used by an error path in
getMountFromLink(), which we can make use getDeviceName() instead.</pre>
</div>
</content>
</entry>
<entry>
<title>Allow filesystem links to contain leading/trailing whitespace</title>
<updated>2019-11-27T19:07:38+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-11-27T19:07:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=2a45549820a4e364d000ac62362d2feafbb0b3c1'/>
<id>2a45549820a4e364d000ac62362d2feafbb0b3c1</id>
<content type='text'>
To make manually editing linked protectors slightly more user-friendly,
automatically strip any leading or trailing whitespace.  E.g. treat
"UUID=3a6d9a76-47f0-4f13-81bf-3332fbe984fb\n" the same as
"UUID=3a6d9a76-47f0-4f13-81bf-3332fbe984fb".

Update https://github.com/google/fscrypt/issues/115
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To make manually editing linked protectors slightly more user-friendly,
automatically strip any leading or trailing whitespace.  E.g. treat
"UUID=3a6d9a76-47f0-4f13-81bf-3332fbe984fb\n" the same as
"UUID=3a6d9a76-47f0-4f13-81bf-3332fbe984fb".

Update https://github.com/google/fscrypt/issues/115
</pre>
</div>
</content>
</entry>
<entry>
<title>filesystem: add unit tests for loadMountInfo()</title>
<updated>2019-10-30T16:25:38+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-29T07:33:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=e71c5e4f70632b99a08d127b35e80a9e291e1938'/>
<id>e71c5e4f70632b99a08d127b35e80a9e291e1938</id>
<content type='text'>
Add a version of loadMountInfo() that takes an io.Reader parameter to
allow injecting a custom mountinfo file, then add some unit tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a version of loadMountInfo() that takes an io.Reader parameter to
allow injecting a custom mountinfo file, then add some unit tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>filesystem: handle bind mounts properly</title>
<updated>2019-10-30T16:21:59+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-29T07:33:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=dbafdbaa9b0767f71affaf15fb8c626f64e27122'/>
<id>dbafdbaa9b0767f71affaf15fb8c626f64e27122</id>
<content type='text'>
Currently, fscrypt treats bind mounts as separate filesystems.  This is
broken because fscrypt will look for a directory's encryption policy in
different places depending on which mount it's accessed through.  This
forces users to create an fscrypt metadata directory at every bind
mount, and to copy fscrypt metadata around between mounts.

Fix this by storing fscrypt metadata only at the root of the filesystem.

To accomplish this:

- Make mountsByDevice store only a single Mount per filesystem, rather
  than multiple.  For this Mount, choose a mount of the full filesystem
  if available, preferably a read-write mount.  If the filesystem has
  only bind mounts, store a nil entry in mountsByDevice so we can show a
  proper error message later.

- Change FindMount() and GetMount() to look up the Mount by device
  number rather than by path, so that they don't return different Mounts
  depending on which path is used.

- Change AllFilesystems() to not return bind mounts.

- Due to the above changes, the mountsByPath map is no longer needed
  outside of loadMountInfo().  So make it a local variable there.

Resolves https://github.com/google/fscrypt/issues/59
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, fscrypt treats bind mounts as separate filesystems.  This is
broken because fscrypt will look for a directory's encryption policy in
different places depending on which mount it's accessed through.  This
forces users to create an fscrypt metadata directory at every bind
mount, and to copy fscrypt metadata around between mounts.

Fix this by storing fscrypt metadata only at the root of the filesystem.

To accomplish this:

- Make mountsByDevice store only a single Mount per filesystem, rather
  than multiple.  For this Mount, choose a mount of the full filesystem
  if available, preferably a read-write mount.  If the filesystem has
  only bind mounts, store a nil entry in mountsByDevice so we can show a
  proper error message later.

- Change FindMount() and GetMount() to look up the Mount by device
  number rather than by path, so that they don't return different Mounts
  depending on which path is used.

- Change AllFilesystems() to not return bind mounts.

- Due to the above changes, the mountsByPath map is no longer needed
  outside of loadMountInfo().  So make it a local variable there.

Resolves https://github.com/google/fscrypt/issues/59
</pre>
</div>
</content>
</entry>
<entry>
<title>filesystem: make link handling more robust</title>
<updated>2019-10-30T16:11:29+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-29T07:04:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=fe58e7236a3285e172733aeab0b136bec968ac4d'/>
<id>fe58e7236a3285e172733aeab0b136bec968ac4d</id>
<content type='text'>
The previous patch fixed making linked protectors to /dev/root, by
setting Mount.Device to the real device node rather than /dev/root.

That's good, but it also hints that the linked protector handling is
unnecessarily fragile, as it relies on the device node name matching
exactly.  The Linux kernel allows the same device to have multiple
device nodes, and path comparisons are slow and error-prone in general.

Change it to compare the device number instead.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous patch fixed making linked protectors to /dev/root, by
setting Mount.Device to the real device node rather than /dev/root.

That's good, but it also hints that the linked protector handling is
unnecessarily fragile, as it relies on the device node name matching
exactly.  The Linux kernel allows the same device to have multiple
device nodes, and path comparisons are slow and error-prone in general.

Change it to compare the device number instead.
</pre>
</div>
</content>
</entry>
<entry>
<title>filesystem: get correct device for kernel-mounted rootfs</title>
<updated>2019-10-30T16:11:29+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-29T07:04:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=c7da2443d6ffa51727db09f8ef1df6aea8c7612c'/>
<id>c7da2443d6ffa51727db09f8ef1df6aea8c7612c</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>filesystem: add device number utilities</title>
<updated>2019-10-30T16:11:29+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-29T07:04:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=d9d2b32f9fa9e39b154b71b2abc9eda43d5aaa3c'/>
<id>d9d2b32f9fa9e39b154b71b2abc9eda43d5aaa3c</id>
<content type='text'>
Add a utility type and functions for handling device numbers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a utility type and functions for handling device numbers.
</pre>
</div>
</content>
</entry>
<entry>
<title>filesystem: skip unnecessary mountpoint canonicalization</title>
<updated>2019-10-30T16:11:29+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-29T07:04:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=c7b963bfa76b9541e01493d21fef3e3596ef9904'/>
<id>c7b963bfa76b9541e01493d21fef3e3596ef9904</id>
<content type='text'>
The kernel always shows mountpoints as absolute paths without symlinks,
so there's no need to canonicalize them in userspace.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The kernel always shows mountpoints as absolute paths without symlinks,
so there's no need to canonicalize them in userspace.
</pre>
</div>
</content>
</entry>
<entry>
<title>filesystem: switch to using /proc/self/mountinfo</title>
<updated>2019-10-30T16:11:29+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-29T07:04:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=4eb1ea869703873f6f4192dcec5262f33a497fcb'/>
<id>4eb1ea869703873f6f4192dcec5262f33a497fcb</id>
<content type='text'>
Change loadMountInfo() to load the mounts directly from
/proc/self/mountinfo, rather than use the mntent.h C library calls.

This is needed for correct handling of bind mounts and of "/dev/root",
since /proc/self/mountinfo has extra fields which show the mounted
subtree and the filesystem's device number.  /proc/mounts lacks these
fields, and the C library calls can't provide them.

To start, this patch just switches to using /proc/self/mountinfo,
without doing anything with the extra fields yet.

As a bonus, this eliminates all C code in mountpoint.go.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change loadMountInfo() to load the mounts directly from
/proc/self/mountinfo, rather than use the mntent.h C library calls.

This is needed for correct handling of bind mounts and of "/dev/root",
since /proc/self/mountinfo has extra fields which show the mounted
subtree and the filesystem's device number.  /proc/mounts lacks these
fields, and the C library calls can't provide them.

To start, this patch just switches to using /proc/self/mountinfo,
without doing anything with the extra fields yet.

As a bonus, this eliminates all C code in mountpoint.go.
</pre>
</div>
</content>
</entry>
</feed>
