RE: out of range LBA using sg_raw

From: Kashyap Desai
Date: Wed Mar 08 2017 - 10:59:35 EST

> -----Original Message-----
> From: Christoph Hellwig [mailto:hch@xxxxxxxxxxxxx]
> Sent: Wednesday, March 08, 2017 8:41 PM
> To: Kashyap Desai
> Cc: linux-kernel@xxxxxxxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx
> Subject: Re: out of range LBA using sg_raw
> Hi Kashyap,
> for SG_IO passthrough requests we can't validate command validity for
> commands as the block layer treats them as opaque. The SCSI device
> implementation needs to handle incorrect parameter to be robust.
> For your fast path bypass the megaraid driver assumes part of the SCSI
> implementation, so it will have to check for validity.

Thanks Chris. It is understood to have sanity in driver, but how critical
such checks where SG_IO type interface send pass-through request. ?
Are you suggesting as good to have sanity or very important as there may
be a real-time exposure other than SG_IO interface ? I am confused over
must or good to have check.
Also one more fault I can generate using below sg_raw command -

"sg_raw -r 32k /dev/sdx 28 00 01 4f ff ff 00 00 08 00"

Provide more scsi data length compare to actual SG buffer. Do you suggest
such SG_IO interface vulnerability is good to be captured in driver.

I am just curious to know how badly we have to scrutinize each packet
before sending to Fast Path as we are in IO path and recommend only
important checks to be added.

Thanks, Kashyap