Re: FreeBSD 5.3-BETA6 available

From: Matthias Andree <ma_at_dt.e-technik.uni-dortmund.de>
Date: Tue, 28 Sep 2004 17:05:10 +0200
Bruce Evans <bde_at_zeta.org.au> writes:

> Except EINVAL is an undocumented and unreasonable errno for write(2).
> (It is documented and reasonable for pwrite(2) because it is for
> pwrite()'s offset arg, but even for pwrite(), misaligned offsets are
> not invalid: as specified in POSIX.1 but not in pwrite(4), only
> negative args are invalid for pwrite().)

> The correct errno seems to be EIO (because the device is physically
> incapable of doing misaligned i/o).

Yes indeed, EIO is better.  It is however of paramount importance to
refuse the misaligned write operation on the raw (as in unbuffered)
device rather than round down the offset and write to the wrong offset,
as happens now in FreeBSD 4.

Imagine someone (ported Linux program) trying to write the last 64 bytes
of the MBR (IA32 or AMD64) with a new partition table at offset #448 and
the data ends up at offset #0 -> the system has just become unbootable
with trashed boot code, and the application believing everything is in
order...

-- 
Matthias Andree

Encrypted mail welcome: my GnuPG key ID is 0x052E7D95 (PGP/MIME preferred)
Received on Tue Sep 28 2004 - 13:05:15 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:14 UTC