All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mark Knecht <markknecht@gmail.com>,
	pavel@suse.cz, LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH -rt] race condition in fs/compat.c with compat_sys_ioctl
Date: Wed, 16 Nov 2005 09:32:14 +0100	[thread overview]
Message-ID: <20051116083214.GA14829@elte.hu> (raw)
In-Reply-To: <1132115386.5047.61.camel@localhost.localdomain>


* Steven Rostedt <rostedt@goodmis.org> wrote:

>  	down_read(&ioctl32_sem);
>  	for (t = ioctl32_hash_table[ioctl32_hash(cmd)]; t; t = t->next) {
> -		if (t->cmd == cmd)
> +		if (t->cmd == cmd) {
> +			handler = t->handler;
> +			up_read(&ioctl32_sem);
>  			goto found_handler;
> +		}
>  	}
>  	up_read(&ioctl32_sem);

i think this problem only triggers on RT kernels, because the RT kernel 
only allows a single reader within a read-semaphore. This works well in 
99.9% of the cases. You just found the remaining 0.1% :-| The better 
solution within -rt would be to change ioctl32_sem to a compat 
semaphore, via the patch below. Can you confirm that this solves the 
bootup problem too?

	Ingo

Index: linux/fs/compat.c
===================================================================
--- linux.orig/fs/compat.c
+++ linux/fs/compat.c
@@ -268,7 +268,7 @@ out:
 
 #define IOCTL_HASHSIZE 256
 static struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE];
-static DECLARE_RWSEM(ioctl32_sem);
+static COMPAT_DECLARE_RWSEM(ioctl32_sem);
 
 extern struct ioctl_trans ioctl_start[];
 extern int ioctl_table_size;

  parent reply	other threads:[~2005-11-16  8:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1131821278.5047.8.camel@localhost.localdomain>
     [not found] ` <5bdc1c8b0511121725u6df7ad9csb9cb56777fa6fe64@mail.gmail.com>
     [not found]   ` <Pine.LNX.4.58.0511122149020.25152@localhost.localdomain>
     [not found]     ` <5bdc1c8b0511121914v12dc4402u424fbaf416bf3710@mail.gmail.com>
     [not found]       ` <1131853456.5047.14.camel@localhost.localdomain>
     [not found]         ` <5bdc1c8b0511130634h501fb565v58906bdfae788814@mail.gmail.com>
     [not found]           ` <1131994030.5047.17.camel@localhost.localdomain>
     [not found]             ` <5bdc1c8b0511141057l60a2e778x89155cd5484d532f@mail.gmail.com>
2005-11-16  4:29               ` [PATCH -rt] race condition in fs/compat.c with compat_sys_ioctl Steven Rostedt
2005-11-16  5:55                 ` Andi Kleen
2005-11-16  8:33                   ` Ingo Molnar
2005-11-16  9:46                   ` Steven Rostedt
2005-11-16 10:03                     ` Ingo Molnar
2005-11-16  8:32                 ` Ingo Molnar [this message]
2005-11-16  9:40                   ` Steven Rostedt

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=20051116083214.GA14829@elte.hu \
    --to=mingo@elte.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markknecht@gmail.com \
    --cc=pavel@suse.cz \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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.