On Sun, Feb 1, 2026 at 3:41 PM Alyssa Ross via busybox <[email protected]> wrote: > I was working with some very small ext4 filesystems, used for > overlaying on immutable VM/container images. If it's only desired to > overlay a single config file, these filesystems can be very small > indeed, and so ran afoul of this length check. > > Since 4fc5ec56f ("device matching against UUIDs: do not try > floppies") (from 2009), floppy drives are skipped before this function > is even called. Reading from an unused loop device returns 0, so it > should be fine to drop the minimum length, and be happy with any read > as long as it returns at least one byte. > > By initializing read_len to -1, we can handle both lseek() failing and > read_full() failing with the same check. > --- > v2: http://lists.busybox.net/pipermail/busybox/2023-May/090340.html > > Sending again since I see lots of commits recently. Still applies. > > util-linux/volume_id/util.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c > index 061545fde..a5844c673 100644 > --- a/util-linux/volume_id/util.c > +++ b/util-linux/volume_id/util.c > @@ -180,7 +180,7 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t > off, size_t len) > { > uint8_t *dst; > unsigned small_off; > - ssize_t read_len; > + ssize_t read_len = -1; > > dbg("get buffer off 0x%llx(%llu), len 0x%zx", > (unsigned long long) off, (unsigned long long) off, len); > @@ -237,13 +237,7 @@ void *volume_id_get_buffer(struct volume_id *id, > uint64_t off, size_t len) > dbg("requested 0x%x bytes, got 0x%x bytes", > (unsigned) len, (unsigned) read_len); > err: > - /* No filesystem can be this tiny. It's most likely > - * non-associated loop device, empty drive and so on. > - * Flag it, making it possible to short circuit future > - * accesses. Rationale: > - * users complained of slow blkid due to empty floppy drives. > - */ > - if (off < 64*1024) > + if (read_len <= 0) > id->error = 1;
This means that any read error, even one far into a block device - for example, at ISO_SUPERBLOCK_OFFSET of 0x8000 (32k) will flag the device as "errored" and won't probe any other fs's. We even have these: fat.c: buf = volume_id_get_buffer(id, fat_partition_off + root_start_off, buf_size); I'm changing the check to "if (off <= 1024)" for now. Let me know if this is insufficient. How small, exactly, was your tiniest FS? _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
