public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: taoyue <yue.tao@windriver.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: linux-kernel@vger.kernel.org,
	Mark Zhan <rongkai.zhan@windriver.com>,
	Bruce Ashfield <bruce.ashfield@windriver.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [BUG]: posix timer: slab error 'double free'
Date: Fri, 24 Aug 2007 10:01:38 -0400	[thread overview]
Message-ID: <46CEE4C2.9010600@windriver.com> (raw)
In-Reply-To: <20070821184516.GA139@tv-sign.ru>

Oleg Nesterov wrote:
> (maintainers cc'ed)
>
> On 08/21, taoyue wrote:
>   
>> I write a simple stress test program for posix timer subsystem, to 
>> reproduce the problem in the lastest mainline kernel.
>> My test program creates 200 threads, and each thread does the following job:
>>
>> Please see my test program in the attachemnt "posix_timer_test.c". You 
>> can compile my test program via the following command line:
>>     
>
> Now we have a testcase. Great, thanks a lot!
>
> Unfortunately, I can't use it because my /lib/libc-2.3.3.so doesn't implement
> SIGEV_THREAD (this is a user-space thing).
>
> However,
>
>   
>> [<c0103941>] show_trace_log_lvl+0x1a/0x30
>> [<c0104593>] show_trace+0x12/0x14
>> [<c01045ab>] dump_stack+0x16/0x18
>> [<c015637b>] __slab_error+0x26/0x28
>> [<c0156bbf>] cache_free_debugcheck+0x1d9/0x298
>> [<c0156eaa>] kmem_cache_free+0x66/0xb5
>> [<c0122f4d>] __sigqueue_free+0x2f/0x32
>> [<c0123147>] __dequeue_signal+0xdc/0x174
>> [<c0124960>] dequeue_signal+0xbb/0x149
>> [<c012569e>] sys_rt_sigtimedwait+0x7f/0x240
>> [<c01029e6>] syscall_call+0x7/0xb
>>     
>
> This is very nice trace, which says loudly that sigqueue_free() is racy
> wrt collect_signal(). Very old bug, very small window.
>
> I'll try to send the "right" fix tomorrow after sleep, but in the meanwhile,
> could you please try the patch at the end?
>
> (I am _not_ sure this can explain all problems you were seeing, though).
>
>   
>> And I also apply the four patches from Oleg Nesterov from lkml:
>>
>> http://lkm.org/lkml/2007/8/12/193
>> http://lkm.org/lkml/2007/8/12/194
>> http://lkm.org/lkml/2007/8/12/195
>> http://lkm.org/lkml/2007/8/12/196
>>     
>          ^^^
>         (should be lkml)
>
> Please drop them, except the first one. They have nothing to do with
> these problems, and in fact you apllied the wrong versions.
>
> Thanks!
>
> Oleg.
>
> --- t/kernel/signal.c~	2007-08-21 22:29:25.000000000 +0400
> +++ t/kernel/signal.c	2007-08-21 22:30:05.000000000 +0400
> @@ -1305,7 +1305,7 @@ void sigqueue_free(struct sigqueue *q)
>  	 * If the signal is still pending remove it from the
>  	 * pending queue.
>  	 */
> -	if (unlikely(!list_empty(&q->list))) {
> +	if (1) {
>  		spinlock_t *lock = &current->sighand->siglock;
>  		read_lock(&tasklist_lock);
>  		spin_lock_irqsave(lock, flags);
>
>
>   
Think you for your help. I reserved the first patch:

http://lkm.org/lkml/2007/8/12/193

and applied the previous patch, running the test program again.
Up to now, the test program has been running for more than one
day. It seems likely that the patches avoid the race condition.

yue.tao

      reply	other threads:[~2007-08-24  2:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 15:59 [BUG]: posix timer: slab error 'double free' taoyue
2007-08-21 18:45 ` Oleg Nesterov
2007-08-24 14:01   ` taoyue [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=46CEE4C2.9010600@windriver.com \
    --to=yue.tao@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=bruce.ashfield@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=rongkai.zhan@windriver.com \
    --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