lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANejiEU2mDG6rz9YmMY=1o317T+=L7Jx0Dwh981k4yXdRfxuEA@mail.gmail.com>
Date:	Wed, 18 Jan 2012 12:23:24 +0800
From:	Shaohua Li <shaohua.li@...el.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	Vivek Goyal <vgoyal@...hat.com>,
	linux kernel mailing list <linux-kernel@...r.kernel.org>,
	Jens Axboe <axboe@...nel.dk>
Subject: Re: Kernel crash in icq_free_icq_rcu

2012/1/18 Shaohua Li <shaohua.li@...el.com>:
> 2012/1/18 Shaohua Li <shaohua.li@...el.com>:
>> On Tue, 2012-01-17 at 17:11 -0800, Tejun Heo wrote:
>>> On Wed, Jan 18, 2012 at 09:05:26AM +0800, Shaohua Li wrote:
>>> > > Vivek is seeing the problem while switching elevators.  Are you too?
>>> > > Or is it during normal operation?
>>> > same here. I had some problems when I debug my ioscheduler, but
>>> > eventually found even switching cfq and noop can trigger oops.
>>>
>>> Hmmm... maybe quiescing isn't working as expected and kmem cache is
>>> being destroyed with live icq's.  I'll try to reproduce it.
>> this debug patch seems to fix for me.
>>
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index e6c05a9..c6a8ef5 100644
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -872,11 +872,11 @@ retry:
>>        spin_unlock_irq(q->queue_lock);
>>
>>        /* create icq if missing */
>> -       if (unlikely(et->icq_cache && !icq))
>> +       if (unlikely(et->icq_cache && !icq && (rw_flags & REQ_ELVPRIV)))
>>                icq = ioc_create_icq(q, gfp_mask);
>>
>>        /* rqs are guaranteed to have icq on elv_set_request() if requested */
>> -       if (likely(!et->icq_cache || icq))
>> +       if (likely(!et->icq_cache || icq || !(rw_flags & REQ_ELVPRIV)))
>>                rq = blk_alloc_request(q, icq, rw_flags, gfp_mask);
>>
>>        if (unlikely(!rq)) {
> this passed my test, but I didn't get reason why it can help ...
> blk_alloc_request doesn't use icq if REQ_ELVPRIV isn't set, so the code
> has problem for sure.
Ok, I got the reason here:
CPU 0                                                             CPU1
get_request
   ioc_create_icq
       allocate icq with cfq ioscheduler

 switch to noop
       insert icq to ioc

 switch to cfq

         ioc_clear_queue
in ioc_clear_queue, ioc has icq in its list, but current elevator is noop,
so ioc_exit_icq will get a NULL et->icq_cache

I hit a kmem_cache_alloc_node oops too. because the et in ioc_create_icq
might not be the et of get_request (we drop lock before calling ioc_create_icq)

The put_io_context has a workqueue to run ioc_exit_icq, I suspect
there is problem too.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ