All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: linux-kernel@vger.kernel.org
Cc: bk@suse.de
Subject: [RFC,PATCH] remove lockless receive from ipc/msg.c
Date: Sat, 09 Nov 2002 15:16:52 +0100	[thread overview]
Message-ID: <3DCD18D4.90609@colorfullife.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

Bernhard Kaindl noticed a race in the lockless receive path of msgrcv():
If a signal wakes up the thread that sleeps in msgrcv(), then 
pipelined_send() can access an already invalid structure. This can cause 
oopses during wake_up_process().

http://marc.theaimsgroup.com/?l=linux-kernel&m=103599896511067&w=2

The simplest solution is to remove the lockless receive, and always 
acquire the spinlock during receive.
Unfortunately this would increase the number of spinlock operations for 
ipc/msg.c by up to 50%. (from 2 to 3 spinlock calls for msgrcv()+msgsnd())

Any other ideas? Are there workloads that heavily rely on sysv msg?

Patch against 2.5.46 is attached.
--
    Manfred

[-- Attachment #2: patch-ipc-race --]
[-- Type: text/plain, Size: 358 bytes --]

--- 2.5/ipc/msg.c	2002-11-09 00:45:37.000000000 +0100
+++ build-2.5/ipc/msg.c	2002-11-09 15:01:13.000000000 +0100
@@ -799,10 +799,6 @@
 		schedule();
 		current->state = TASK_RUNNING;
 
-		msg = (struct msg_msg*) msr_d.r_msg;
-		if(!IS_ERR(msg)) 
-			goto out_success;
-
 		msq = msg_lock(msqid);
 		msg = (struct msg_msg*)msr_d.r_msg;
 		if(!IS_ERR(msg)) {

                 reply	other threads:[~2002-11-09 14:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3DCD18D4.90609@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=bk@suse.de \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.