Re: Linux kernel file offset pointer races

From: Amon Ott
Date: Sat Aug 07 2004 - 11:03:50 EST


On Samstag, 7. August 2004 15:18, viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
wrote:
> On Sat, Aug 07, 2004 at 02:38:12PM +0200, Amon Ott wrote:
> > Would it not be useful to have per-process or per-thread offsets? Do
> > parallel processes really need to share the offset?
> >
> > E.g., the struct file could (optionally) be copied on fork with
> > copy-on-write to avoid extra memory consumption.
>
> (cat a; cat b) > /tmp/foo

Right, the process running (...) would not know what offset to give "cat b"
as a start, because it cannot see "cat a"'s final offset. It could seek to
the end of /tmp/foo before starting "cat b", but this requirement would
break existing shells. Bad luck.

As there are probably more examples why it does not work, there will
probably have to be a macro for all offset changes, which checks for
overruns.

Amon.
--
http://www.rsbac.org - GnuPG: 2048g/5DEAAA30 2002-10-22

Attachment: pgp00000.pgp
Description: signature