lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 8 Apr 2011 10:56:02 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Steve Rago <sar@...-labs.com>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] Allow O_SYNC to be set by fcntl(F_SETFL)

On Fri, 08 Apr 2011 13:39:16 -0400
Steve Rago <sar@...-labs.com> wrote:

> > I wonder if we should sync the file when someone sets O_SYNC this way.
> > If we don't then there is a period during which we have an fd which has
> > O_SYNC set, but it has pending unwritten data.  An O_SYNC fd should
> > never be in such a state!
> 
> Why not?

Because it's inconsistent.  An O_SYNC fd never has outstanding writeout. 
Except for in this one new and special time window between a setfl()
and the next write().

It's not a big deal, but it's somewhat ugly and merits thinking about.

>  If I write something in non-synchronous mode, then change the file descriptor to synchronous mode, I should 
> not make any assumptions about what was written prior to this point.  If I care that much, I'll call fsync.

Well.  You can call fsync() after every write() too.

>  All that 
> matters is that the operating system honors the contract as specified by the system call API.

There's a lot more to it than that.  Things like
quality-of-implementation and principle-of-least-surprise.  We used to
have a particular relationship between an O_SYNC fd and the state of
the inode which it represents.  With this patch, that relationship no
longer holds.

As I say: not a big deal IMO, but it should be aired and thought about.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ