# DF-0865 — hpfs_validateparent dep-walk OOB read

**Status: REPRODUCED (kernel panic / local DoS) → FIXED (validated single-module patch).**

`hpfs_validateparent()` (`sys/vfs/hpfs/hpfs_subr.c`) walks directory entries
inside a 2 KB `bread` buffer advancing a `dep` pointer by the on-disk
`de_reclen` (`u_int16_t`, attacker-controlled) with no bound check, so a
crafted HPFS image makes `dep` walk past the buffer → page-fault panic on
the next `dep->de_flag` read. Triggered by an unprivileged `stat()` on a
mounted malicious HPFS image. Same root cause as DF-0830 (duplicate on the
`hpfs_validateparent` path). Read-only primitive → Medium (local DoS / heap
info-leak ceiling), no escalation.

## Reproduce

```sh
# 1. craft the image (host, needs python3)
python3 mk_hpfs.py evil.hpfs

# 2. on the guest, build the trigger (unprivileged user)
cc -O2 -o poc poc.c

# 3. root mounts the crafted image (realistic "admin mounts attacker image")
kldload hpfs                      # if not already loaded
vnconfig -c vn0 /path/to/evil.hpfs
mkdir -p /mnt/hpfs
mount -t hpfs -o ro /dev/vn0 /mnt/hpfs
chmod 755 /mnt/hpfs

# 4. unprivileged user triggers the bug
./poc /mnt/hpfs        # on unpatched kernel: guest panics (check boot.log)
                        # on patched kernel: stat returns EINVAL, no panic
```

## Expected

- **Unpatched `#0` kernel:** `stat()` does not return; guest wedges in DDB.
  Serial `boot.log` shows `Fatal trap 12: page fault … Stopped at
  hpfs_validateparent+0x146: movzwl 0x2(%r15),%edx`.
- **Patched kernel (this `fix.diff`):** `stat()` returns `EINVAL`,
  `hpfs_validateparent: dep out of bounds` appears in `dmesg`, guest stays up.

## Files

- `mk_hpfs.py` — image crafter (root dir block dep0 `de_reclen=0x0900`).
- `poc.c` — `stat()` trigger for `getattr → hpfs_validateparent`.
- `build.sh` / `run.sh` — exact build/run commands.
- `fix.diff` — `HPFS_DE_INBOUNDS` macro + bounds on both validateparent
  while-loops + post-loop guards (`git apply`-able).
- `VERDICT.md` — full narrative + mechanism + fix validation.
- `manifest.json` — machine-readable artifact catalog.
- Logs: `build.log`, `run.log` (baseline panic), `fix_build.log`,
  `fix_run.log` (patched clean return), `panic.txt`, `env.txt`.
