From owner-freebsd-current@FreeBSD.ORG Tue Sep 28 15:05:15 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B46516A4CF; Tue, 28 Sep 2004 15:05:15 +0000 (GMT) Received: from mail.dt.e-technik.uni-dortmund.de (mail.dt.E-Technik.Uni-Dortmund.DE [129.217.163.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9913A43D39; Tue, 28 Sep 2004 15:05:12 +0000 (GMT) (envelope-from ma@dt.e-technik.uni-dortmund.de) Received: from localhost (localhost [127.0.0.1])DA8F040DFE; Tue, 28 Sep 2004 17:05:11 +0200 (CEST) Received: from mail.dt.e-technik.uni-dortmund.de ([127.0.0.1]) by localhost (krusty [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03399-01-10; Tue, 28 Sep 2004 17:05:11 +0200 (CEST) Received: from m2a2.dyndns.org (p508EEA9F.dip.t-dialin.net [80.142.234.159]) 87FBF40DFC; Tue, 28 Sep 2004 17:05:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by merlin.emma.line.org (Postfix) with ESMTP id D93AAD6511; Tue, 28 Sep 2004 17:05:10 +0200 (CEST) Received: from merlin.emma.line.org ([127.0.0.1]) by localhost (m2a2.dyndns.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10376-02-3; Tue, 28 Sep 2004 17:05:10 +0200 (CEST) Received: by merlin.emma.line.org (Postfix, from userid 500) id 899AED6510; Tue, 28 Sep 2004 17:05:10 +0200 (CEST) To: Bruce Evans In-Reply-To: <20040929002825.M60452@delplex.bde.org> (Bruce Evans's message of "Wed, 29 Sep 2004 00:37:43 +1000 (EST)") References: <415720FD.8080603@samsco.org> <415812AD.2090901@FreeBSD.org> <20040929002825.M60452@delplex.bde.org> From: Matthias Andree Date: Tue, 28 Sep 2004 17:05:10 +0200 Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at dt.e-technik.uni-dortmund.de cc: Scott Long cc: standards@FreeBSD.org cc: Matthias Andree cc: current@FreeBSD.org cc: re@FreeBSD.org Subject: Re: FreeBSD 5.3-BETA6 available X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2004 15:05:15 -0000 Bruce Evans 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)