[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070313.004224.41634994.davem@davemloft.net>
Date: Tue, 13 Mar 2007 00:42:24 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: medwards.linux@...il.com
Cc: alan@...rguk.ukuu.org.uk, 7eggert@....de, dada1@...mosbay.com,
linux-kernel@...r.kernel.org
Subject: Re: sys_write() racy for multi-threaded append?
From: "Michael K. Edwards" <medwards.linux@...il.com>
Date: Mon, 12 Mar 2007 23:25:48 -0800
> Quality means the devices you ship now keep working in the field, and
> the probable cost of later rework if the requirements change does not
> exceed the opportunity cost of over-engineering up front. Economy
> gets a look-in too, and says that it's pointless to delay shipment and
> bloat the application coding for cases that can't happen. If POSIX
> says that any and all writes (except small pipe/FIFO writes, whatever)
> can return a short byte count -- but you know damn well you're writing
> to a device driver that never, ever writes short, and if it did you'd
> miss a timing budget recovering from it anyway -- to hell with POSIX.
You're not even safe over standard output, simply run the program over
ssh and you suddenly have socket semantics to deal with.
In the early days the fun game to play was to run programs over rsh to
see in what amusing way they would explode. ssh has replaced rsh in
this game, but the bugs have largely stayed the same.
Even early versions of tar used to explode on TCP half-closes and
whatnot.
In short, if you don't handle short writes, you're writing a program
for something other than unix.
We're not changing write() to interlock with other parallel callers or
messing with the f_pos semantics in such cases, that's stupid, please
cope, kthx.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists