mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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: Fri, 30 Aug 2002 09:48:03 +0000	[thread overview]
Message-ID: <20020830094803.A8283@kvasir.austin.ibm.com> (raw)
In-Reply-To: <CDB36B91-BB99-11D6-B9F3-00039387C942@mac.com>; from pwaechtler@mac.com on Thu, Aug 29, 2002 at 11:53:50PM +0200

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. 

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().

> With PROCESS_SHARED mutexes and condvars in NGPT we have that - and I
> am in the process in converting the mmap() based implementation of
> Richard Stevens in UNPv2 onto Linux.
> 
> The messages are stored in shmem and the library routines access the
> structures with proper locking. I am not very happy about the fact,
> that with futexes the whole cooperating system get stuck when 1
> process crashes inside a critical region (yes, then your system is
> screwed anyway).  BUT the messages are not copied between user- and
> kernelspace like they are in SysV  msgsnd.
> 
> POSIX mqueues have "kernel persistence", i.e. they live until
> mq_unlink() is called.  They do not vanish with the creator on exit().
> Without rlimits you can easily consume all available kernel memory
> (DoS) by creating a mqueue and filling it with garbage.

The mq_maxmsg and mq_msgsize members of the mq_attr structure required
if O_CREAT is passed to mq_open() ensure that an implementation can
prevent the kernel memory DoS you mention: a malicious application can
only fill up the MQ memory.

> When implemented in kernel space, you have to create a thread with the
> brand new sys_clone_startup (or whatever name it gets) as notification
> (SIGEV_THREAD) - which is SCOPE_SYSTEM, no control about this and not
> always what is desired.

  reply	other threads:[~2002-08-30 14:45 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 [this message]
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
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=20020830094803.A8283@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®