From: Daan De Meyer Date: Fri, 3 Apr 2026 10:09:14 +0000 (+0000) Subject: dissect-image: Drop blkid_probe_filter_superblocks_usage() call from probe_blkid_filter() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e33eb053fb;p=thirdparty%2Fsystemd.git dissect-image: Drop blkid_probe_filter_superblocks_usage() call from probe_blkid_filter() probe_blkid_filter() sets up a blkid superblock filter to restrict filesystem detection to a known-safe set of types (btrfs, erofs, ext4, f2fs, squashfs, vfat, xfs). It does so via two consecutive calls: 1. blkid_probe_filter_superblocks_type(BLKID_FLTR_ONLYIN, ...) 2. blkid_probe_filter_superblocks_usage(BLKID_FLTR_NOTIN, BLKID_USAGE_RAID) However, both filter functions share the same internal bitmap in libblkid. Each call goes through blkid_probe_get_filter(), which zeroes the entire bitmap before applying the new filter. This means the second call (usage filter) silently destroys the type filter set by the first call. The result is that only RAID superblocks end up being filtered, while all other filesystem types — including iso9660 — pass through unfiltered. This causes ISO images (e.g. those with El Torito boot catalogs and GPT) to be incorrectly dissected: blkid detects the iso9660 superblock on the whole device (since iso9660 is marked BLKID_IDINFO_TOLERANT and can coexist with partition tables), the code enters the unpartitioned single-filesystem path, and then mounting fails because iso9660 is not in the allowed filesystem list: "File system type 'iso9660' is not allowed to be mounted as result of automatic dissection." Fix this by dropping the blkid_probe_filter_superblocks_usage() call. The BLKID_FLTR_ONLYIN type filter already restricts probing to only the listed types, which implicitly excludes RAID superblocks as well, making the usage filter redundant. Follow-up for 72bf86663c ("dissect: use blkid_probe filters to restrict probing to supported FSes and no raid") --- diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 2bef82dd34b..821227f47a5 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -200,10 +200,11 @@ static int probe_blkid_filter(blkid_probe p) { if (r != 0) return errno_or_else(EINVAL); - errno = 0; - r = sym_blkid_probe_filter_superblocks_usage(p, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID); - if (r != 0) - return errno_or_else(EINVAL); + /* Note: don't call blkid_probe_filter_superblocks_usage() here. Both filter functions share the + * same bitmap internally, and each call resets it before applying its own filter — so a subsequent + * usage filter would wipe the type filter we just set. The ONLYIN type filter above already + * excludes everything not in the allowed list, including RAID superblocks, so a separate usage + * filter is redundant anyway. */ return 0; }