From: Rik van Riel <riel@redhat.com>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Davidlohr Bueso <dave.bueso@gmail.com>,
Sedat Dilek <sedat.dilek@gmail.com>,
Davidlohr Bueso <davidlohr.bueso@hp.com>,
linux-next <linux-next@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
linux-mm <linux-mm@kvack.org>, Andi Kleen <andi@firstfloor.org>,
Jonathan Gonzalez <jgonzalez@linets.cl>,
Vineet Gupta <Vineet.Gupta1@synopsys.com>
Subject: Re: [PATCH] ipc/msg.c: Fix lost wakeup in msgsnd().
Date: Tue, 03 Sep 2013 11:08:26 -0400 [thread overview]
Message-ID: <5225FB6A.7020507@redhat.com> (raw)
In-Reply-To: <1378216808-2564-1-git-send-email-manfred@colorfullife.com>
On 09/03/2013 10:00 AM, Manfred Spraul wrote:
> The check if the queue is full and adding current to the wait queue of pending
> msgsnd() operations (ss_add()) must be atomic.
>
> Otherwise:
> - the thread that performs msgsnd() finds a full queue and decides to sleep.
> - the thread that performs msgrcv() calls first reads all messages from the
> queue and then sleep, because the queue is empty.
> - the msgrcv() calls do not perform any wakeups, because the msgsnd() task
> has not yet called ss_add().
> - then the msgsnd()-thread first calls ss_add() and then sleeps.
> Net result: msgsnd() and msgrcv() both sleep forever.
>
> Observed with msgctl08 from ltp with a preemptible kernel.
>
> Fix: Call ipc_lock_object() before performing the check.
>
> The patch also moves security_msg_queue_msgsnd() under ipc_lock_object:
> - msgctl(IPC_SET) explicitely mentions that it tries to expunge any pending
> operations that are not allowed anymore with the new permissions.
> If security_msg_queue_msgsnd() is called without locks, then there might be
> races.
> - it makes the patch much simpler.
>
> Reported-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
> Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Acked-by: Rik van Riel <riel@redhat.com>
--
All rights reversed
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-09-03 15:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 14:00 [PATCH] ipc/msg.c: Fix lost wakeup in msgsnd() Manfred Spraul
2013-09-03 15:08 ` Rik van Riel [this message]
2013-09-03 16:13 ` Sedat Dilek
2013-09-03 16:33 ` Manfred Spraul
2013-09-03 21:56 ` Sedat Dilek
2013-09-03 18:07 ` Davidlohr Bueso
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=5225FB6A.7020507@redhat.com \
--to=riel@redhat.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=dave.bueso@gmail.com \
--cc=davidlohr.bueso@hp.com \
--cc=jgonzalez@linets.cl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=sedat.dilek@gmail.com \
--cc=sfr@canb.auug.org.au \
--cc=torvalds@linux-foundation.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).