# repo22 non-LZ4 leading-zero verification

- Date: 2026-08-08 UTC
- Source baseline: `7cba92c0ec434b96180200b09e5dddfa213e67f5`
- FreeBSD guest: 15.0-RELEASE-p8 amd64, QEMU TCG
- Image tool: erofs-utils 1.8.6
- Scope: MicroLZMA, DEFLATE, and ZSTD leading-zero handling only

## Code change

Linux 7.1-rc1 calls `z_erofs_fixup_insize()` for every MicroLZMA, DEFLATE,
and ZSTD stream, while LZ4 only requires it when the `LZ4_0PADDING` feature is
enabled.  The FreeBSD dispatcher now applies the same predicate.  Existing
first-block limits, empty-input rejection, and input-length subtraction remain
unchanged.

## Build and module lifecycle

`./build.sh` completed successfully and produced `build/erofs.ko` with SHA256:

```text
4b3459a02da29642cb8e61f58e34ff5266e668e86256937c91b8af7e0e31fdcb
```

FreeBSD 15 results:

```text
lifecycle_kldload_rc=0
lifecycle_kldunload_rc=0
dmesg_delta_lines=0
dmesg_error_grep_rc=1
```

The last two lines mean the isolated lifecycle and read pass added no kernel
messages, so no decompression, linker, panic, or integrity error was present.

## Deterministic images

The source file was 1 MiB and had SHA256:

```text
370eb0a8df86868c4842ca535ed64670f0277ea2ed47a703f089bbb13ee4ac52
```

The images were regenerated with erofs-utils 1.8.6:

```sh
mkfs.erofs -T0 --all-root --ignore-mtime -x-1 -Uclear \
  -zlzma,level=6 -C4096 lzma-root.erofs src-root
mkfs.erofs -T0 --all-root --ignore-mtime -x-1 -Uclear \
  -zdeflate,level=6 -C4096 deflate-root.erofs src-root
mkfs.erofs -T0 --all-root --ignore-mtime -x-1 -Uclear \
  -zzstd,level=3 -C4096 zstd-root.erofs src-root
```

`dump.erofs` reported layout 3 for `/test-lz4.txt` in all images.  MicroLZMA
and ZSTD used one 4096-byte physical extent; DEFLATE used two 4096-byte
physical extents.

## FreeBSD read results

Each image was attached with `mdconfig`, mounted read-only, read completely by
`sha256`, unmounted, and detached before testing the next image.

```text
lzma mount_rc=0 read_rc=0 sha256=370eb0a8df86868c4842ca535ed64670f0277ea2ed47a703f089bbb13ee4ac52
lzma umount_rc=0 detach_rc=0
deflate mount_rc=0 read_rc=0 sha256=370eb0a8df86868c4842ca535ed64670f0277ea2ed47a703f089bbb13ee4ac52
deflate umount_rc=0 detach_rc=0
zstd mount_rc=0 read_rc=0 sha256=370eb0a8df86868c4842ca535ed64670f0277ea2ed47a703f089bbb13ee4ac52
zstd umount_rc=0 detach_rc=0
```

Result: MicroLZMA, DEFLATE, and ZSTD all pass real-image full-file integrity
verification on this FreeBSD 15 kernel configuration.

## Notes and limits

An exploratory image with the file below a `/files` directory mounted, but the
target lookup failed.  Root-level fixtures were used to isolate decompression
from the separately tracked directory lookup work.  This does not change the
three successful compressed read results above.

This batch does not claim coverage for other compression levels, large files,
random access, corrupt streams, alternative FreeBSD kernel configurations, or
other compression mapping features.  DEFLATE and ZSTD kernel symbols were
available on the tested FreeBSD 15 GENERIC kernel; no unsupported algorithm or
kernel-symbol limitation was encountered.
