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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 9 Mar 2019 12:13:30 +0800
From:   Kefeng Wang <wangkefeng.wang@...wei.com>
To:     Bart Van Assche <bvanassche@....org>,
        Ingo Molnar <mingo@...nel.org>, Tejun Heo <tj@...nel.org>,
        <linux-kernel@...r.kernel.org>
CC:     <syzbot+17335689e239ce135d8b@...kaller.appspotmail.com>
Subject: Re: [PATCH] workqueue: unregister wq lockdep on error path in
 alloc_workqueue()


On 2019/3/8 22:45, Bart Van Assche wrote:
> On 3/7/19 11:37 PM, Kefeng Wang wrote:
>> syzkaller report an issue "KASAN: use-after-free Read in alloc_workqueue",
>>
>> alloc_workqueue
>>   - kzalloc wq
>>   - wq_init_lockdep(wq);
>>     - lockdep_register_key(&wq->key);  // add to hlist
>>   - kfree wq
>>
>> But forget to call wq_unregister_lockdep()->lockdep_unregister_key(), it
>> will delete the entry from hlist.
>>
>> Reported-by: syzbot+17335689e239ce135d8b@...kaller.appspotmail.com
>> Fixes: 669de8bda87b ("kernel/workqueue: Use dynamic lockdep keys for workqueues")
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
>> ---
>>   kernel/workqueue.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
>> index 7abbeed13421..9209d25dfade 100644
>> --- a/kernel/workqueue.c
>> +++ b/kernel/workqueue.c
>> @@ -4291,6 +4291,7 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
>>       return wq;
>>     err_free_wq:
>> +    wq_unregister_lockdep(wq);
>>       free_workqueue_attrs(wq->unbound_attrs);
>>       kfree(wq);
>>       return NULL;
>
> Hi Kefeng,
>
> Five days ago I had posted a similar but slightly different patch. Can you have a look at it? See also https://lore.kernel.org/lkml/20190303220046.29448-1-bvanassche@acm.org/  
I don't notice your patch due to no subscribe lkml,  that is better, wq->lock_name should be freed too; )
>
> Thanks,
>
> Bart.
>
>
>
> .
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ