Re: [PATCH -rt] race condition in fs/compat.c with compat_sys_ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2005-11-16 at 09:32 +0100, Ingo Molnar wrote:
> * Steven Rostedt <[email protected]> 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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux