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: <CAA5qM4CctYiBe766-OnxAPHJWByyOo1rE7FzW-75ZcOib6niCA@mail.gmail.com>
Date:   Fri, 14 Aug 2020 11:37:20 -0400
From:   Tong Zhang <ztong0001@...il.com>
To:     Keith Busch <kbusch@...nel.org>
Cc:     linux-kernel@...r.kernel.org, linux-nvme@...ts.infradead.org,
        axboe@...com, Christoph Hellwig <hch@....de>, sagi@...mberg.me
Subject: Re: [PATCH] nvme-pci: cancel nvme device request before disabling

Hi Keith,

On Fri, Aug 14, 2020 at 11:04 AM Keith Busch <kbusch@...nel.org> wrote:
>
> On Fri, Aug 14, 2020 at 03:14:31AM -0400, Tong Zhang wrote:
> > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> > index ba725ae47305..c4f1ce0ee1e3 100644
> > --- a/drivers/nvme/host/pci.c
> > +++ b/drivers/nvme/host/pci.c
> > @@ -1249,8 +1249,8 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
> >               dev_warn_ratelimited(dev->ctrl.device,
> >                        "I/O %d QID %d timeout, disable controller\n",
> >                        req->tag, nvmeq->qid);
> > -             nvme_dev_disable(dev, true);
> >               nvme_req(req)->flags |= NVME_REQ_CANCELLED;
> > +             nvme_dev_disable(dev, true);
> >               return BLK_EH_DONE;
>
> Shouldn't this flag have been set in nvme_cancel_request()?

nvme_cancel_request() is not setting this flag to cancelled and this is causing
__nvme_submit_sync_cmd() to return a positive number and eventually
this will allow nvme_init_identify() proceed with a timeout error where the
problematic nvme device has already been disabled by nvme_dev_disable(dev,true).
The reset of the logic in nvme_init_identify() is not going to check
those already
released resources. -- in fact this is UAF --

> like the timeout out command is the only command to have been cancelled
> by this action, nor is it guaranteed that getting here will mean the
> request was in fact cancelled. The controller could still provide a real
> completion.

what would you like to suggest here?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ