From: Demi Marie Obenour <demiobenour@gmail.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: Ensuring that mount(8) will always interpret a filesystem correctly
Date: Tue, 10 Dec 2024 18:28:28 -0500 [thread overview]
Message-ID: <155cef10-48b4-42f0-bacf-b9e1d7394206@gmail.com> (raw)
In-Reply-To: <y7tl6b7pviy7ubstwprmw57ubquf777orkp56h45r7ab3xjfek@t3qjqzehfwnp>
On 12/10/24 6:16 AM, Karel Zak wrote:
> On Tue, Dec 10, 2024 at 12:11:49AM GMT, Demi Marie Obenour wrote:
>> On 12/9/24 5:26 AM, Karel Zak wrote:
>>>
>>> Hi Demi,
>>>
>>> On Sat, Dec 07, 2024 at 08:45:32PM GMT, Demi Marie Obenour wrote:
>>>> Is there a guarantee that if all data before the filesystem superblock is
>>>> zero, and that the filesystem never writes to this region, libblkid (and
>>>> thus, presumably, mount(8)) will always mount the filesystem with the
>>>> correct filesystem type, even if e.g. someone writes a file containing
>>>> a superblock of a different filesystem and the filesystem happens to put
>>>> it where that superblock is valid?
>>>
>>> the libblkid library offers multiple modes, with "safe mode" being the
>>> default for detecting filesystems. In this mode, the library checks
>>> for any additional valid superblocks on the device. There are
>>> exceptions for certain filesystems on CD/DVD media (such as udf and
>>> iso), but for regular filesystems, sharing the same device is not
>>> allowed.
>>>
>>> There is also an option to specify that a superblock is only valid if
>>> no other area is using it (using blkid_probe_set_wiper() and
>>> blkid_probe_use_wiper()). However, this is only used for LVM and
>>> bcache.
>>>
>>> The library does not require that there are zeros before the
>>> superblock, as not all mkfs-like programs zero out all areas.
>>>
>>> In recent years, there have been no reports of collisions. In the
>>> entire history of the library, the only collisions I can recall are
>>> with swap areas and luks, and occasionally with poorly detected FAT
>>> filesystems (due to the messy design of FAT).
>>
>> Was https://github.com/util-linux/util-linux/issues/1305 a
>> collision between ZFS and ext4?
>
> Yes, but in this case, ZFS was incorrectly detected. As you can see
> from the bug report, blkid ended with an "ambiguous result" error.
Should blkid instead stop at the first valid superblock when probing
filesystems for mounting?
>>> I believe the situation would be the same even without the
>>> Discoverable Partition Specification. The kernel always divides the
>>> whole disk into partitions, and libblkid/mount utilizes these
>>> partitions. Therefore, the filesystems are automatically separated by
>>> the partition table.
>>
>> /etc/fstab provides an explicit filesystem type. The Discoverable
>> Partition Specification doesn't.
>
> You can use the "auto" file system type in fstab. It is also common
> for people to not use the "-t <type>" option on the mount(8) command
> line.
>
> However, if you are paranoid, then specifying the file system type in
> fstab and avoiding Discoverable Partitions is a good choice.
Does that mean that Discoverable Partitions are a bad idea for any
filesystem that is not read-only? Can you explain “if you are
paranoid”?
--
Sincerely,
Demi Marie Obenour (she/her/hers)
next prev parent reply other threads:[~2024-12-10 23:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-08 1:45 Ensuring that mount(8) will always interpret a filesystem correctly Demi Marie Obenour
2024-12-09 10:26 ` Karel Zak
2024-12-10 5:11 ` Demi Marie Obenour
2024-12-10 11:16 ` Karel Zak
2024-12-10 23:28 ` Demi Marie Obenour [this message]
2024-12-11 13:38 ` Theodore Ts'o
2024-12-14 22:08 ` Demi Marie Obenour
2024-12-15 3:20 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=155cef10-48b4-42f0-bacf-b9e1d7394206@gmail.com \
--to=demiobenour@gmail.com \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox