Re: [patch] fs: remove local variable copy of f_pos to enable thread-safe updates - Kernel

This is a discussion on Re: [patch] fs: remove local variable copy of f_pos to enable thread-safe updates - Kernel ; ----- Original Message ---- > From: Al Viro > To: Matti Linnanvuori > Cc: linux-fsdevel@vger.kernel.org ; linux-kernel@vger.kernel.org > Sent: Friday, May 2, 2008 12:33:02 PM > Subject: Re: [patch] fs: remove local variable copy of f_pos to enable thread-safe updates ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: [patch] fs: remove local variable copy of f_pos to enable thread-safe updates

  1. Re: [patch] fs: remove local variable copy of f_pos to enable thread-safe updates



    ----- Original Message ----
    > From: Al Viro
    > To: Matti Linnanvuori
    > Cc: linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org
    > Sent: Friday, May 2, 2008 12:33:02 PM
    > Subject: Re: [patch] fs: remove local variable copy of f_pos to enable thread-safe updates
    >
    > On Fri, May 02, 2008 at 02:14:25AM -0700, Matti Linnanvuori wrote:
    > > From: Matti Linnanvuori
    > >
    > > Remove local variable copy of f_pos to enable thread-safe updates in
    > > implementation functions of system calls read, readv, write and writev.

    >
    > ... and we are back to square one with racy instances of ->read() that
    > will use *pos twice, leaving a window for e.g. lseek() to invalidate
    > e.g. wraparound tests. Not that deciding what to do at the end of
    > e.g. read() with lseek() happening in the middle would be fun anyway -
    > esp. since you don't remember the kind of seek it had been.


    File systems can be written so that implementations of read, lseek etc.
    acquire a lock before using *pos, which precludes races. That was the
    idea behind my patch. So, my patch does not necessarily cause races.
    read instances can be racy in Linux now because there is no lock to
    serialize read etc. system calls.



    __________________________________________________ __________________________________
    Be a better friend, newshound, and
    know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i...Dypao8Wcj9tAcJ
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [patch] fs: remove local variable copy of f_pos to enable thread-safe updates

    On Fri, May 02, 2008 at 08:33:50AM -0700, Matti Linnanvuori wrote:

    > File systems can be written so that implementations of read, lseek etc.
    > acquire a lock before using *pos, which precludes races. That was the
    > idea behind my patch. So, my patch does not necessarily cause races.
    > read instances can be racy in Linux now because there is no lock to
    > serialize read etc. system calls.


    Oh, yes it does - current tree guarantees that variable passed to ->read()
    will not change under it, so any code that relied on that got broken.

    And no, modifying every driver's ->read() is not going to be fun - it's
    not just filesystems.
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread