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: <991b5090-adf7-78e1-ae19-0df94566c212@huawei.com>
Date:   Thu, 10 Jan 2019 09:54:59 +0800
From:   Yao HongBo <yaohongbo@...wei.com>
To:     Christoph Hellwig <hch@....de>
CC:     <wangxiongfeng2@...wei.com>, <guohanjun@...wei.com>,
        <huawei.libin@...wei.com>, <thunder.leizhen@...wei.com>,
        <tanxiaojun@...wei.com>, <xiexiuqi@...wei.com>,
        <yangyingliang@...wei.com>, <cj.chengjian@...wei.com>,
        <wxf.wang@...ilicon.com>, <keith.busch@...el.com>, <axboe@...com>,
        <sagi@...mberg.me>, <linux-nvme@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] nvme: fix out of bounds access in nvme_cqe_pending



On 1/10/2019 2:39 AM, Christoph Hellwig wrote:
> On Mon, Jan 07, 2019 at 10:22:07AM +0800, Hongbo Yao wrote:
>> There is an out of bounds array access in nvme_cqe_peding().
>>
>> When enable irq_thread for nvme interrupt, there is racing between the
>> nvmeq->cq_head updating and reading.
> 
> Just curious: why did you enable this option?  Do you have a workload
> where it matters?

Yes, there were a lot of hard interrupts reported when reading the nvme disk,
the OS can not schedule and result in the soft lockup.so i enabled the irq_thread.

>> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
>> index d668682..68375d4 100644
>> --- a/drivers/nvme/host/pci.c
>> +++ b/drivers/nvme/host/pci.c
>> @@ -908,9 +908,11 @@ static void nvme_complete_cqes(struct nvme_queue *nvmeq, u16 start, u16 end)
>>  
>>  static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
>>  {
>> -	if (++nvmeq->cq_head == nvmeq->q_depth) {
>> +	if (nvmeq->cq_head == (nvmeq->q_depth - 1)) {
>>  		nvmeq->cq_head = 0;
>>  		nvmeq->cq_phase = !nvmeq->cq_phase;
>> +	} else {
>> +		++nvmeq->cq_head;
> 
> No need for the braces above, but otherwise this looks fine.  I'll apply
> it to nvme-4.21.
> 
> .
> 
 Need i send a v2 version?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ