public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
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 04:40:46 -0500	[thread overview]
Message-ID: <1132134046.5047.68.camel@localhost.localdomain> (raw)
In-Reply-To: <20051116083214.GA14829@elte.hu>

On Wed, 2005-11-16 at 09:32 +0100, Ingo Molnar wrote:
> * 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?
> 

ACK:

Well duh!  OK, I blame lack of sleep on missing the obvious (and getting
up at 4am to go to the bathroom, and then responding to this doesn't
help ;)

I just applied this patch and it works.  I didn't even notice the word
"read" in down_read and up_read, otherwise I would have sent you this
patch.  I was just so frustrated at getting this to work that I just
assumed that this was a normal down and up. Oh well. At least now I
don't have to see why this works in the non-rt case.

Thanks Ingo, yes go ahead and apply your patch. That is definitely a
better solution.

-- Steve



      reply	other threads:[~2005-11-16  9:41 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
2005-11-16  9:40                   ` Steven Rostedt [this message]

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=1132134046.5047.68.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markknecht@gmail.com \
    --cc=mingo@elte.hu \
    --cc=pavel@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox