The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@iitbombay.org>
To: John Gilmore <gnu@toad.com>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] FreeBSD behind the times? (was: Favorite unix design principles?)
Date: Fri, 5 Feb 2021 17:55:38 -0800	[thread overview]
Message-ID: <E04B933C-1297-4B29-84D4-66F756B37CE9@iitbombay.org> (raw)
In-Reply-To: <31039.1612574314@hop.toad.com>

Please see my followup message. My fault for mixing two separate things
(what a user should not do vs how the kernel can still provide coherence).

> On Feb 5, 2021, at 5:18 PM, John Gilmore <gnu@toad.com> wrote:
> 
> On Thu, Feb 04, 2021 at 09:17:54PM -0800, Bakul Shah wrote:
>> Write(2)ing to a mapped page sounds pretty dodgy. Likely to get you
>> in trouble in any case. Similarly read(2)ing. 
> 
> Uh, no.  You misunderstand completely.
> 
> The purpose of the kernel is to provide a reliable interface to system
> facilities, that lets processes NOT DEPEND on what other processes are
> doing.
> 
> The decision about whether Tool X uses mmap() versus read() to access a
> file, or mmap() versus write() to change one, is a decision that DOES
> NOT DEPEND on what Tool Y is doing.  Tools X and Y may have been written
> by different groups in different decades.  Tool X may have been written
> to use stdio, which used read().  Three years later, stdio got rewritten
> to use mmap() for speed, but that's invisible to the author of Tool X.
> And maybe an end user in 2025 decides to use both Tool X and Tool Y on
> the same file.  So only much later will any malign interactions between
> read/write and mmap actually be noticed by end users.  And the fix is
> not to create new dependencies between Tool X, stdio, and Tool Y.  It is
> to fix the kernel so they do not depend on each other!
> 
> Here is a real-life example from my own experience.
> 
> There is a long-standing bug in the Linux kernel, in which the inotify()
> system call simply didn't work on nested file systems.  This caused a
> long-standing bug in Ubuntu, which I reported in 2012 here:
> 
>  https://bugs.launchpad.net/ubuntu/+source/rpcbind/+bug/977847
> 
> The symptom was that after booting from a LiveCD image, "apt-get
> install" for system services (in my case an NFS client package) wouldn't
> work.  Turned out the system startup scripts used inotify() to notice
> and start newly installed system services.  The root cause was that
> inotify failed because the root file system was an "overlayfs" that
> overlaid a RAMdisk on top of the read-only LiveCD file system.  The
> people who implemented "overlayfs" didn't think inotify() was important,
> or they thought it would be too much work to make it actually meet its
> specs, so they just made it ignore changes to the files in the overlaid
> file system.  So the startup daemon's inotify() would never report the
> creation of new files about the new services, because those files were
> in the overlaying RAM disk, and so it would not start them and the user
> would notice the error.
> 
> The underlying overlayfs bug was reported in 2011 here:
> 
>  https://bugs.launchpad.net/ubuntu/+source/linux/+bug/882147
> 
> As far as I know it has never been fixed.  (The bug report was
> closed in 2019 for one of the usual bogus reasons.)
> 
> The problem came because real tools (like systemd, or the tail command)
> actually started using inotify, assuming that as a well documented
> kernel interface, it would actually meet its specs.  And because a
> completely unrelated other real tool (like the LiveCD installer)
> actually started using overlayfs, assuming that as a well documented
> kernel interface, it too would actually meet its specs.  And then one
> day somebody tried to use both those tools together and they failed.
> 
> That's why telling people "Don't use mmap() on the same file that you
> use read() on" is an invalid attitude for a Real Kernel Maintainer.
> Props to Larry McVoy for caring about this.  Boos to the Linux
> maintainers of overlayfs who didn't give a shit.
> 
> 	John
> 	


  parent reply	other threads:[~2021-02-06  1:56 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 11:10 [TUHS] Favorite unix design principles? Tyler Adams
2021-01-25 12:32 ` Steve Nickolas
2021-01-26  2:06   ` M Douglas McIlroy
2021-01-26  2:53     ` Steve Nickolas
2021-01-26 10:22     ` Tyler Adams
2021-01-26 12:26       ` John P. Linderman
2021-01-26 15:23       ` Clem Cole
2021-01-26 16:00         ` Niklas Karlsson
2021-01-26 16:13           ` Adam Thornton
     [not found]       ` <CAKH6PiXKjksEpQOMMMQTbcsMvX2thz3WzqjoRWJAsXnZ4Eq_iQ@mail.gmail.com>
2021-01-30 19:01         ` Tyler Adams
2021-01-30 19:50           ` Jon Steinhart
2021-01-30 20:06             ` Tyler Adams
2021-01-30 21:28               ` Clem Cole
2021-01-30 21:42                 ` Dave Horsfall
2021-01-30 21:45                 ` Tyler Adams
2021-01-30 22:31                   ` Larry McVoy
2021-01-30 22:28                 ` Larry McVoy
2021-01-30 23:11                   ` [TUHS] FreeBSD behind the times? (was: Favorite unix design principles?) Greg 'groggy' Lehey
2021-01-30 23:17                     ` Larry McVoy
2021-01-30 23:22                       ` Warner Losh
2021-01-30 23:31                         ` [TUHS] [SPAM] " Larry McVoy
2021-01-30 23:37                           ` Jon Steinhart
2021-01-30 23:54                             ` Larry McVoy
2021-01-31 12:23                               ` [TUHS] [SPAM] Re: FreeBSD behind the times? Dermot Tynan
2021-01-31  0:00                             ` [TUHS] [SPAM] Re: FreeBSD behind the times? (was: Favorite unix design principles?) Bakul Shah
2021-02-09  2:15                         ` [TUHS] " Will Senn
2021-02-09  2:16                           ` Will Senn
2021-02-09  2:30                             ` Greg 'groggy' Lehey
2021-01-31  0:39                     ` Steve Nickolas
2021-01-31  1:47                     ` Will Senn
2021-01-31  2:25                       ` Larry McVoy
2021-01-31  2:52                         ` Will Senn
2021-01-31  3:00                           ` Larry McVoy
2021-01-31  3:06                             ` Will Senn
2021-01-31  3:32                               ` John Cowan
2021-02-04  5:43                         ` Dave Horsfall
2021-02-04  6:10                           ` Angus Robinson
2021-02-04  7:46                             ` Andy Kosela
2021-02-04 22:25                             ` Dave Horsfall
2021-02-04 15:45                           ` Will Senn
2021-02-04 16:03                             ` Henry Bent
2021-02-04 16:32                             ` Dan Cross
2021-02-04 16:49                               ` Will Senn
2021-02-04 17:46                               ` Larry McVoy
2021-02-04 18:41                               ` Bakul Shah
2021-02-04 22:28                                 ` George Michaelson
2021-02-04 22:41                                   ` Bakul Shah
2021-02-05  0:33                                   ` Larry McVoy
2021-02-05  5:17                                     ` Bakul Shah
2021-02-05 14:18                                       ` Larry McVoy
2021-02-05 18:16                                         ` Warner Losh
2021-02-05 18:21                                         ` ron minnich
2021-02-06  0:03                                         ` Bakul Shah
2021-02-06  2:06                                           ` Dan Cross
2021-02-06  3:01                                             ` Bakul Shah
2021-02-06  1:18                                         ` John Gilmore
2021-02-06  1:43                                           ` joe mcguckin
2021-02-06  1:55                                           ` Bakul Shah [this message]
2021-02-05 20:50                             ` Dave Horsfall
2021-02-06  0:21                               ` Brad Spencer
2021-02-06  2:22                               ` Rico Pajarola
2021-02-06  2:55                                 ` Larry McVoy
2021-02-06  3:07                                   ` Will Senn
2021-02-27  8:54                                   ` Stuart Remphrey
2021-02-06  4:55                               ` John Cowan
2021-02-04  7:46                         ` Chris Torek
2021-02-04 15:47                           ` Will Senn
2021-02-11 21:01                         ` Angel M Alganza
2021-01-30 23:09                 ` [TUHS] Favorite unix design principles? John Cowan
2021-01-30 23:22                   ` Jon Steinhart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E04B933C-1297-4B29-84D4-66F756B37CE9@iitbombay.org \
    --to=bakul@iitbombay.org \
    --cc=gnu@toad.com \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).