From: Amos Waterland <apw@us.ibm.com>
To: pwaechtler@mac.com
Cc: golbi@mat.uni.torun.pl, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] POSIX message queues
Date: Sun, 1 Sep 2002 01:50:25 +0000 [thread overview]
Message-ID: <20020901015025.A10102@kvasir.austin.ibm.com> (raw)
In-Reply-To: <20020830094803.A8283@kvasir.austin.ibm.com>; from apw@us.ibm.com on Fri, Aug 30, 2002 at 09:48:03AM +0000
On Sat, Aug 31, 2002 at 01:43:56PM +0200, pwaechtler@mac.com wrote:
> Am Freitag den, 30. August 2002, um 11:48, schrieb Amos Waterland:
>
> > On Thu, Aug 29, 2002 at 11:53:50PM +0200, pwaechtler@mac.com wrote:
> >> some comments as asked for:
> >>
> >> I know that it's nowhere stated, but POSIX mqueues are perfectly
> >> designed to be implemented in userspace with locking facilities
> >> provided by the system.
> >
> > I am not sure if this is correct. You can achieve proper locking in
> > userspace, but I do not think you achieve proper security.
>
> Well, I can't think of efficient inter process locks without
> kernel/scheduler help.
> Do you want to use a spinlock, with lowering priority or even sleep, use
> a pipe/fifo/flock or waiting in sigsuspend? This all is implemented in
> kernel space.
> How would you implement entirely userspace locking?
> With futexes (fast "userspace" locks) only the uncontented case is
> handled
> in userspace - if there's contention the process waits inside the
> kernel - or
> does get a notification from the kernel (AWAIT or FD)
I think we are agreeing: POSIX mqueues are not perfectly designed to be
implemented in userspace.
> > I assume you are proposing an implementation based on shared memory:
> > which means that at least some pages of the shared memory must be
> > writable. If the processes cooperate and only write to the shared pages
> > through library routines which use sychronization, things are ok, but a
> > malicious process could forge messages or perform DOS attacks etc. by
> > bypassing the mq_*() functions and using write().
>
> yes, of course that could be compromised by a process with the same uid.
> This process could simply kill the other process too.
> The shm_open() employs proper file system permission on the object.
No, it is more complicated than that. They can be compromised by an
arbitrary process if the permissions on the mq include S_IWOTH.
That is the fundamental problem with a userspace shared memory
implementation: write permissions on a message queue should grant
mq_send(), but write permissions on shared memory grant a lot more than
just that.
Amos Waterland
next prev parent reply other threads:[~2002-09-01 6:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-29 21:53 pwaechtler
2002-08-30 9:48 ` Amos Waterland
2002-08-31 11:43 ` pwaechtler
2002-08-31 13:14 ` Krzysztof Benedyczak
2002-09-01 0:22 ` Amos Waterland
2002-09-01 1:50 ` Amos Waterland [this message]
2002-09-04 11:13 ` Ingo Molnar
2002-09-06 10:04 ` Pavel Machek
2002-09-07 14:16 ` pwaechtler
2002-09-06 22:48 ` Amos Waterland
2002-09-07 14:11 ` pwaechtler
2002-09-07 15:17 ` Ingo Molnar
2002-09-08 22:00 ` Amos Waterland
2002-08-31 12:53 ` Krzysztof Benedyczak
2002-09-07 14:39 ` pwaechtler
-- strict thread matches above, loose matches on Subject: below --
2002-09-04 16:03 Manfred Spraul
2002-08-27 21:48 Krzysztof Benedyczak
2002-08-27 22:16 ` Christoph Hellwig
2002-08-31 13:28 ` Krzysztof Benedyczak
2002-09-01 7:24 ` Jakub Jelinek
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=20020901015025.A10102@kvasir.austin.ibm.com \
--to=apw@us.ibm.com \
--cc=golbi@mat.uni.torun.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=pwaechtler@mac.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
all inboxes | Powered by JetHome®