public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: yodaiken@fsmlabs.com
To: Linus Torvalds <torvalds@transmeta.com>
Cc: yodaiken@fsmlabs.com,
	David Howells <dhowells@cambridge.redhat.com>,
	Andrew Morton <andrewm@uow.edu.au>, Ben LaHaise <bcrl@redhat.com>,
	David Howells <dhowells@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: rw_semaphores
Date: Mon, 16 Apr 2001 11:34:44 -0600	[thread overview]
Message-ID: <20010416113444.A5700@hq.fsmlabs.com> (raw)
In-Reply-To: <20010416083912.C4036@hq.fsmlabs.com> <Pine.LNX.4.31.0104160957340.32030-100000@cesium.transmeta.com>
In-Reply-To: <Pine.LNX.4.31.0104160957340.32030-100000@cesium.transmeta.com>; from torvalds@transmeta.com on Mon, Apr 16, 2001 at 10:05:57AM -0700

On Mon, Apr 16, 2001 at 10:05:57AM -0700, Linus Torvalds wrote:
> 
> 
> On Mon, 16 Apr 2001 yodaiken@fsmlabs.com wrote:
> >
> > I'm trying to imagine a case where 32,000 sharing a semaphore was anything but a
> > major failure and I can't. To me: the result of an attempt by the 32,768th locker
> > should be a kernel panic. Is there a reasonable scenario where this is wrong?
> 
> Hint: "I'm trying to imagine a case when writing all zeroes to /etc/passwd
> is anything but a major failure, but I can't. So why don't we make
> /etc/passwd world-writable?"
> 
> Right. Security.

The analogy is too subtle for  me,
but my question was not whether the correct error
response should be to panic, but whether there was a good reason for allowing
such a huge number of users of a lock.

> There is _never_ any excuse for panic'ing because of some inherent
> limitation of the data structures. You can return -ENOMEM, -EAGAIN or
> somehting like that, but you must _not_ allow a panic (or a roll-over,
> which would just result in corrupted kernel data structures).

There's a difference between a completely reasonable situation in which 
all of some resource has been committed
 and a situation which in itself indicates some sort of fundamental error. 
If  32K+ users of a lock is an  errror, then returning -ENOMEM may be
inadequate.

> 
> Note that the limit is probably really easy to work around even without
> extending the number of bits: a sleeper that notices that the count is
> even _halfway_ to rolling around could easily do something like:
> 
>  - undo "this process" action
>  - sleep for 1 second
>  - try again from the beginning.
> 
> I certainly agree that no _reasonable_ pattern can cause the failure, but
> we need to worry about people who are malicious. The above trivial
> approach would take care of that, while not penalizing any non-malicious
> users.

Ok. I'm  too nice a guy to think about malicious users so I simply considered
the kernel error  case.
You probably want a diagnostic so people who get mysterious slowdowns can
report:
	/var/log/messages included the message "Too many users on lock 0x..."


> 
> So I'm not worried about this at all. I just want people _always_ to think
> about "how could I mis-use this if I was _truly_ evil", and making sure it
> doesn't cause problems for others on the system.
> 
> (NOTE: This does not mean that the kernel has to do anything _reasonable_
> under all circumstances. There are cases where Linux has decided that
> "this is not something a reasonable program can do, and if you try to do
> it, we'll give you random results back - but they will not be _security_
> holes". We don't need to be _nice_ to unreasonable requests. We just must
> never panic, otherwise crash or allow unreasonable requests to mess up
> _other_ people)
> 
> 		Linus

-- 
---------------------------------------------------------
Victor Yodaiken 
Finite State Machine Labs: The RTLinux Company.
 www.fsmlabs.com  www.rtlinux.com


  reply	other threads:[~2001-04-16 17:32 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3AD0FD0F.9B0C47FD@uow.edu.au>
2001-04-09  3:08 ` rw_semaphores Linus Torvalds
2001-04-09  4:18   ` rw_semaphores Linus Torvalds
2001-04-09 13:55     ` rw_semaphores Ben LaHaise
2001-04-10  2:41   ` rw_semaphores Tachino Nobuhiro
2001-04-10  5:43     ` rw_semaphores Linus Torvalds
2001-04-10  6:33       ` rw_semaphores Tachino Nobuhiro
2001-04-10  7:47       ` rw_semaphores David Howells
2001-04-10 18:02         ` [PATCH] i386 rw_semaphores fix David Howells
2001-04-10 19:42           ` Linus Torvalds
2001-04-10 19:56             ` x86 cpu configuration (was: Re: [PATCH] i386 rw_semaphores fix) Jeff Garzik
2001-04-10 21:58               ` Alan Cox
2001-04-10 20:05             ` [PATCH] i386 rw_semaphores fix Andi Kleen
2001-04-10 20:16               ` Linus Torvalds
2001-04-10 22:00               ` Alan Cox
2001-04-11  0:00                 ` Andi Kleen
2001-04-11  0:13                   ` David Weinehall
2001-04-11  0:20                     ` Andi Kleen
2001-04-11  0:56                       ` David Weinehall
2001-04-11  1:04                         ` Andi Kleen
2001-04-11 12:32                       ` Alan Cox
2001-04-11  0:55                     ` Linus Torvalds
2001-04-11  1:07                       ` Andi Kleen
2001-04-11  1:12                         ` Linus Torvalds
2001-04-11  1:23                           ` Andi Kleen
2001-04-11 12:36                             ` Alan Cox
2001-04-11 18:05                       ` H. Peter Anvin
2001-04-11 12:28                   ` Alan Cox
2001-04-11 18:06                     ` H. Peter Anvin
2001-04-11 22:06                       ` Alan Cox
2001-04-11 22:42                         ` H. Peter Anvin
2001-04-11 22:55                           ` Alan Cox
2001-04-10 21:57             ` Alan Cox
2001-04-11  0:40               ` Tim Wright
2001-04-11  7:38             ` David Howells
2001-04-11 12:24               ` Maciej W. Rozycki
2001-04-11 12:57             ` [PATCH] 2nd try: " David Howells
2001-04-11 16:37               ` [PATCH] 3rd " David Howells
2001-04-11 21:41                 ` [PATCH] 4th " David Howells
2001-04-12 18:16                   ` Andrew Morton
2001-04-11 23:00                 ` [PATCH] 3rd " Anton Blanchard
2001-04-12 15:06                   ` [PATCH] i386 rw_semaphores, general abstraction patch David Howells
2001-04-11 16:56           ` [PATCH] i386 rw_semaphores fix Andrew Morton
2001-04-11 17:36             ` David Howells
2001-04-11 18:41               ` Linus Torvalds
2001-04-11 21:27             ` David Howells
2001-04-16 14:39         ` rw_semaphores yodaiken
2001-04-16 14:56           ` rw_semaphores Alan Cox
2001-04-16 17:05           ` rw_semaphores Linus Torvalds
2001-04-16 17:34             ` yodaiken [this message]
2001-04-16 17:26           ` rw_semaphores Andrew Morton

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=20010416113444.A5700@hq.fsmlabs.com \
    --to=yodaiken@fsmlabs.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andrewm@uow.edu.au \
    --cc=bcrl@redhat.com \
    --cc=dhowells@cambridge.redhat.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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