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] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR11MB4202561CE9ECD5B7F8DD74AFFF259@DM6PR11MB4202.namprd11.prod.outlook.com>
Date:   Tue, 25 May 2021 02:01:17 +0000
From:   "Zhang, Qiang" <Qiang.Zhang@...driver.com>
To:     Pavel Begunkov <asml.silence@...il.com>,
        Hillf Danton <hdanton@...a.com>,
        "axboe@...nel.dk" <axboe@...nel.dk>
CC:     "syzbot+6cb11ade52aa17095297@...kaller.appspotmail.com" 
        <syzbot+6cb11ade52aa17095297@...kaller.appspotmail.com>,
        "io-uring@...r.kernel.org" <io-uring@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: 回复: 回复: [PATCH] io-wq: Fix UAF when wakeup wqe in hash waitqueue



________________________________________
发件人: Pavel Begunkov <asml.silence@...il.com>
发送时间: 2021年5月24日 18:16
收件人: Zhang, Qiang; Hillf Danton; axboe@...nel.dk
抄送: syzbot+6cb11ade52aa17095297@...kaller.appspotmail.com; io-uring@...r.kernel.org; linux-kernel@...r.kernel.org
主题: Re: 回复: [PATCH] io-wq: Fix UAF when wakeup wqe in hash waitqueue

[Please note: This e-mail is from an EXTERNAL e-mail address]

On 5/24/21 10:19 AM, Zhang, Qiang wrote:
[...]
>> Scratch scalp one inch off to work out how this is a cure given a) uaf makes
>> no sense without free and b) how io workers could survive
>> wait_for_completion(&wq->worker_done).
>>
>> If they could OTOH then this is not the pill for the leak in worker_refs.
>
> Hello Pavel Begunkov, Hillf Danton
>
> Sorry there is a problem with the calltrace described in my message. Please ignore this modification
>
>Haven't looked at the trace and description, but I do think
>there is a problem it solves.
>
>1) io_wait_on_hash() -> __add_wait_queue(&hash->wait, &wqe->wait);
>2) (note: wqe is a worker) wqe's workers exit dropping refs
>3) refs are zero, free io-wq
>4) @hash is shared, so other task/wq does wake_up(&wq->hash->wait);
>5) it wakes freed wqe
>
>step 4) is a bit more trickier than that, tl;dr;
>wq3:worker1     | locks bit1
>wq1:worker2     | waits bit1
>wq2:worker1     | waits bit1
>wq1:worker3     | waits bit1
>
>wq3:worker1     | drop  bit1
>wq1:worker2     | locks bit1
>wq1:worker2     | completes all wq1 bit1 work items
>wq1:worker2     | drop  bit1, exit and free io-wq
>
>wq2:worker1     | locks bit1
>wq1             | free complete
>wq2:worker1     | drops bit1
>wq1:worker3     | waked up, even though freed
>
>Can be simplified, don't want to waste time on that

Thanks Pavel

Your description is better.  I have another question: under what circumstances will three io-wq(wq1, wq2, wq3) be created to share this @hash?

This kind of problem also occurs between two io-wq(wq1, wq2). Is the following description OK?

wq1:worker2     | locks bit1
wq2:worker1     | waits bit1
wq1:worker3     | waits bit1

wq1:worker2     | completes all wq1 bit1 work items
wq1:worker2     | drop  bit1, exit and free io-wq

wq2:worker1     | locks bit1
wq1                       | free complete
wq2:worker1     | drops bit1
wq1:worker3     | waked up, even though freed

Zhang
>
>--
>Pavel Begunkov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ