public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org,
	linux-hotplug-devel@lists.sourceforge.net,
	message-bus-list@redhat.com,
	Daniel Stekloff <dsteklof@us.ibm.com>
Subject: Re: [ANNOUNCE] udev 0.1 release
Date: Fri, 11 Apr 2003 21:31:56 +0200	[thread overview]
Message-ID: <200304112131.56457.oliver@neukum.org> (raw)
In-Reply-To: <20030411185245.GF1821@kroah.com>


> You are talking about the "issue" of /dev/foo going away because that
> device was removed, and then another device added which creates /dev/foo
> just as the user starts to open /dev/foo?  Or something else?

The name is not important. The numbers matter.
A device goes away. It has major:minor x:y. Say it has the name /dev/foo. 
A new device is added and reuses x:y, name /dev/foo2. During the window
while /dev/foo isn't unlinked, you have access to /dev/foo2 with possibly
wrong permissions. It's worse, if you miss a 'remove' event. In that case
you are potentially permanently screwed.

You can avoid that if you never reuse device numbers. But in that case
you'd better think about a 16:48 major:minor split.

> > > > - Error handling. What do you do if the invocation ends in EIO ?
> > >
> > > Which invocation?  From /sbin/hotplug?
> >
> > Yes.
> > This is a serious problem. Your scheme has very nasty failure modes.
> > By implementing this in user space you are introducing additional
> > failure modes.
> > - You need disk access -> EIO
>
> If udev becomes a deamon, disk access isn't needed.  Actually the
> current version of udev doesn't require any disk access, other than
> loading it into memory.

Not true. You might need to swap out memory it uses.

> > - You have no control over memory allocation -> ENOMEM, EIO in swap space
> > Usually I'd not care about EIO, but here security is threatened. EIO
> > crashing the system under some circumstances is inevitable, EIO opening a
> > security hole is not acceptable however.
>
> So yes, doing this in userspace causes a number of these kinds of
> "problems".  The same kinds of "problems" that all other user programs
> have to deal with, right?

They don't and don't have to. Everything else fails securely. If a PAM
module fails, you get no access.

And yes, any scheme that handles device removal in user space has this
problem.

> So, if udev can't be read from the disk, the machine isn't in a very
> workable state, creating that new device node is going to be the least
> of your worries.

Why? You need just a single sector to fail. Murphy will always strike.

> If udev can't get access to memory (actually it does no malloc calls, so
> it would have to run out of stack space), or there is no memory to load
> udev into memory, then again, you have a unstable machine, and there's
> not much else we can do about it.

By this logic you should remove the checks for kmalloc failing.
Running a box into OOM happens. Worse, it can be triggered intentionally.

> > 4000 spawnings is 32MB for kernel stacks alone.
> > You cannot assume that resources will be sufficient for that.
>
> If you have 4000 disks, you have to have a _lot_ of memory just to deal
> with it.  See the other 4000 disk threads for more discussions about
> this issue.
>
> If we fix up the kernel to handle that many different disks, then
> userspace can surely handle 4000 tasks (it can handle that today,
> right?)

Nevertheless, kmalloc can fail and you need to allocate a kernel stack and
page tables to spawn a task. Security must not suffer from that.

> Anyway, it will be quite difficult to plug 4000 disks in "all at once".
> There is a time delay inbetween discovering each of those disks from
> within the kernel, not to mention the physical issues of spinning them
> all up.

Spinning them up? Plug in a cable to a FibreChannel fabric and you get
exactly that situation.

> > That again is a serious problem, because you cannot resync.
> > If you lose a 'remove' event you're screwed.
>
> Yes, if you lose a remove, things can get out of whack.  My goal is to
> not lose any.

How? Or precisely, how can you guarantee it?

	Regards
		Oliver


  reply	other threads:[~2003-04-11 19:20 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-11  3:24 [ANNOUNCE] udev 0.1 release Greg KH
2003-04-11  6:37 ` Oliver Neukum
2003-04-11 17:20   ` Greg KH
2003-04-11 17:46     ` John Bradford
2003-04-11 18:03       ` Michael Buesch
2003-04-11 18:12         ` Nicholas Berry
2003-04-11 18:41           ` Eric Weigle
2003-04-11 21:54           ` Alex Bligh - linux-kernel
2003-04-11 18:23       ` Antonio Vargas
2003-04-11 18:31         ` Kevin P. Fleming
2003-04-11 19:07           ` Greg KH
2003-04-11 19:29             ` Havoc Pennington
2003-04-12  8:07               ` Greg KH
2003-04-12 23:27                 ` Havoc Pennington
2003-04-11 23:39             ` Miquel van Smoorenburg
2003-04-12  0:08               ` Greg KH
2003-04-12  0:21                 ` Miquel van Smoorenburg
2003-04-12  8:40                   ` Oliver Neukum
2003-04-12  8:52                     ` Andrew Morton
2003-04-11 19:28           ` Joel Becker
2003-04-11 19:38             ` Kevin P. Fleming
2003-04-11 23:26               ` Joel Becker
2003-04-11 19:58             ` Greg KH
2003-04-11 23:25               ` Joel Becker
2003-04-11 23:37                 ` Greg KH
2003-04-12  0:19                   ` Joel Becker
2003-04-12  1:06                     ` H. Peter Anvin
2003-04-12  4:43                       ` Greg KH
2003-04-12 12:56                       ` Roman Zippel
2003-04-12  4:20                     ` Greg KH
2003-04-11 20:29           ` Steven Dake
2003-04-11 20:43             ` Greg KH
2003-04-11 22:30               ` Steven Dake
2003-04-11 22:38                 ` Lars Marowsky-Bree
2003-04-11 22:43                   ` Steven Dake
2003-04-11 22:58                     ` Greg KH
2003-04-11 23:32                       ` Steven Dake
2003-04-11 23:45                         ` Greg KH
2003-04-11 22:56                 ` Greg KH
2003-04-11 23:31                   ` Steven Dake
2003-04-12  6:45                     ` Lars Marowsky-Bree
2003-04-12 14:45                 ` Alan Cox
2003-04-11 22:09             ` Andrew Morton
2003-04-11 22:19               ` Tim Hockin
2003-04-11 22:47                 ` Andrew Morton
2003-04-11 23:03                   ` Greg KH
2003-04-12  8:04                   ` Oliver Neukum
2003-04-11 23:01               ` Greg KH
2003-04-11 23:23                 ` Andrew Morton
2003-04-11 23:35                   ` Greg KH
2003-04-11 23:37                 ` Steven Dake
2003-04-12  7:49                 ` Oliver Neukum
2003-04-19  4:39               ` David Brownell
2003-04-19  4:16           ` David Brownell
2003-04-11 18:30       ` Oliver Neukum
2003-04-11 19:00         ` Oliver Neukum
2003-04-11 19:09       ` Mike Dresser
2003-04-11 19:54         ` Richard B. Johnson
2003-04-11 19:59           ` Mike Dresser
2003-04-11 20:16             ` John Bradford
2003-04-11 20:16               ` Mike Dresser
2003-04-11 20:23                 ` Chris Hanson
2003-04-11 20:32                   ` Mike Dresser
2003-04-11 20:47                     ` Richard B. Johnson
2003-04-11 20:39               ` Richard B. Johnson
2003-04-11 22:03                 ` Alex Bligh - linux-kernel
2003-04-11 22:00             ` Alex Bligh - linux-kernel
2003-04-11 21:28         ` Martin Mares
2003-04-11 18:12     ` Oliver Neukum
2003-04-11 18:52       ` Greg KH
2003-04-11 19:31         ` Oliver Neukum [this message]
2003-04-11 20:10           ` Greg KH
2003-04-11 20:56             ` Oliver Neukum
2003-04-11 21:03             ` Oliver Neukum
2003-04-11 22:27             ` Perez-Gonzalez, Inaky
2003-04-11 22:53               ` Greg KH
2003-04-11 17:10 ` Jeremy Jackson
2003-04-11 17:18   ` Justin Cormack
2003-04-11 17:21   ` Greg KH
2003-04-11 18:02 ` Roman Zippel
2003-04-11 18:12   ` Greg KH
2003-04-11 20:09     ` Nick Craig-Wood
     [not found] <200304112018.11931.freesoftwaredeveloper@web.de>
2003-04-11 18:50 ` Steve Lee
2003-04-11 19:09   ` Michael Buesch
  -- strict thread matches above, loose matches on Subject: below --
2003-04-11 20:42 Perez-Gonzalez, Inaky
2003-04-11 20:48 ` David Lang
2003-04-11 20:59   ` Greg KH
2003-04-11 22:32     ` Steven Dake
2003-04-11 22:41       ` David Lang
2003-04-11 22:51       ` Greg KH
2003-04-11 23:27         ` Steven Dake
2003-04-11 23:32           ` Greg KH
2003-04-11 23:39             ` Steven Dake
2003-04-12  0:04     ` Joel Becker
     [not found] <20030411173018$2695@gated-at.bofh.it>
     [not found] ` <20030411175011$3d7e@gated-at.bofh.it>
     [not found]   ` <20030411182022$7f7a@gated-at.bofh.it>
     [not found]     ` <20030411184016$1180@gated-at.bofh.it>
     [not found]       ` <20030411204006$0496@gated-at.bofh.it>
     [not found]         ` <20030411205018$7440@gated-at.bofh.it>
2003-04-11 21:09           ` Arnd Bergmann
2003-04-11 21:57             ` Greg KH
2003-04-11 22:12               ` Arnd Bergmann
2003-04-12  7:39               ` John Bradford
2003-04-11 22:35             ` Steven Dake
2003-04-11 23:05               ` Greg KH
2003-04-11 23:30                 ` Arnd Bergmann
2003-04-11 22:36 Perez-Gonzalez, Inaky
2003-04-12  7:53 ` Oliver Neukum
2003-04-11 22:42 Perez-Gonzalez, Inaky
2003-04-11 22:59 Perez-Gonzalez, Inaky
2003-04-12  4:22 Perez-Gonzalez, Inaky
2003-04-12 12:18 Arnd Bergmann

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=200304112131.56457.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=dsteklof@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=linux-hotplug-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=message-bus-list@redhat.com \
    --cc=oliver@neukum.name \
    /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