vmd(8): Actually check alignment
The alignment check tested offset and xfer_sz with &&, so it only
rejected a request when both were misaligned. offset is now always a
multiple of VIRTIO_BLK_SECTOR_SIZE, so that half is dead code; check
xfer_sz alone and fail when it is not a multiple of the sector size.
Also report the correct direction in the warning.
ok dv@
vmd(8): Reject vioblk requests beyond the disk capacity
vioblk_io() converted the guest-controlled sector to a byte offset and
passed it to the backend without comparing it against the disk capacity.
With a raw image on a regular file, pwritev() extends the file, so a
privileged guest could write past the configured size and exhaust the
host filesystem.
Pass the sector number to vioblk_io() as an unsigned value and defer the
conversion to a byte offset until after the bounds check. Once the full
transfer length is known, reject a start beyond capacity or a transfer
that crosses the end, then convert to off_t. The check is done in
unsigned arithmetic; the subtraction order avoids underflow and it never
multiplies the attacker-controlled sector.
From Acts1631, thanks!
ok dv@
Convert checkdisklabel() into a wrapper around a call to the
new checklabel() with a partition limit of MAXPARTITIONS16.
No functional change.
Prodded by deraadt@
iked(8): Implement IKEv1 prototype
This change brings the IKEv1 protocol stack to iked -- by running
isakmpd(8) as unprivileged IKEv1 subprocess.
This is experimental and still limited:
- The main and quick mode suites are fixed to aes128cbc, hmac2-256,
modp3072 and ESP aes128cbc, hmac2-256 and PFS modp3072
- Only PSK authentication for now.
Nonetheless, tunnels are established and work . And iked(8) is
able to interop with both isakmpd(8) and iked(8) IKEv1.
If this works out good enough, isakmpd(8) will be retired. One
day.
ok deraadt@