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: <MWHPR03MB3136DEB8FD09EDDF7CDB8BF5CEE60@MWHPR03MB3136.namprd03.prod.outlook.com>
Date:   Tue, 16 May 2017 17:31:28 +0000
From:   Long Li <longli@...rosoft.com>
To:     Bart Van Assche <Bart.VanAssche@...disk.com>,
        "jejb@...ux.vnet.ibm.com" <jejb@...ux.vnet.ibm.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>
CC:     Stephen Hemminger <sthemmin@...rosoft.com>,
        KY Srinivasan <kys@...rosoft.com>
Subject: RE: [PATCH] scsi: zero per-cmd driver data for each MQ I/O



> -----Original Message-----
> From: Bart Van Assche [mailto:Bart.VanAssche@...disk.com]
> Sent: Monday, May 15, 2017 5:01 PM
> To: jejb@...ux.vnet.ibm.com; linux-scsi@...r.kernel.org; linux-
> kernel@...r.kernel.org; Long Li <longli@...rosoft.com>;
> martin.petersen@...cle.com
> Cc: Stephen Hemminger <sthemmin@...rosoft.com>; KY Srinivasan
> <kys@...rosoft.com>
> Subject: Re: [PATCH] scsi: zero per-cmd driver data for each MQ I/O
> 
> On Mon, 2017-05-15 at 23:32 +0000, Long Li wrote:
> > Thanks for looking! Yes this is for chasing a bug.
> >
> > With the patch, we also zero the private data used by lower layer
> > driver, in addition to the private data in scsi_cmnd.
> 
> Hello Long,
> 
> What bug did you encounter, with which combination of ULP (sd?) and LLD SCSI
> driver(s) and for which request type (REQ_OP_*)? You will have to mention
> that information in the patch description anyway if you want your patch to get
> accepted.
> 
> If the bug that you encountered only occurs with a single LLD, would it be
> possible to implement a fix by modifying the LLD instead of the SCSI core?

The bug I encounter is that in hv_storvsc (a LLD), sometime we are getting stale data in the private driver data memory allocated by SCSI. As a LLD, we expect the memory allocated by SCSI to be zeroed. If not we may send unexpected commands to the device.

A little background on private data: In LLD's scsi_host_template, the driver may optionally ask SCSI to allocate its private driver memory for each command, by specifying cmd_size. This memory is allocated at the end of scsi_cmnd by SCSI. Later when SCSI queues a command, the LLD can use scsi_cmd_priv to get its private data.

hv_storvsc doesn't clear its private data before use. I'm not sure about other LLD drivers. Although it's possible to fix it in LLD not SCSI core, I think that is not the ideal place to do it. Whoever is allocating the SCSI command should also zero it.

There is a similar patch that fixed a similar issue for non-MQ case:
commit ee5242360424b9b967454e9183767323d10cf985

I'm sorry I should have put more details in the patch. 

> 
> Thanks,
> 
> Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ