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]
Date:	Thu, 9 Sep 2010 01:35:02 -0700 (PDT)
From:	Anil kumar <anils_r@...oo.com>
To:	Christof Schmitt <christof.schmitt@...ibm.com>
Cc:	linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: Re: scsi_cmnd data_buffer checksum

Hi Christof,

Thanks for the response.

I am running mkfs.ext3 command.

I am doing the following in the driver for write(10):

Queuecommand:

sg = scsi_sglist(cmd->scsi_cmd);
cmd->write_buf = (u8 *)(kmap_atomic(sg->page, KM_IRQ0) + sg->offset);
Calculate checksum for write_buf

Write Done:
Calculate checksum for cmd->write_buf

and checksums don't match. I am wondering how come OS changed the cmd->write_buf when I have not even unmapped the buffer. Is filesystem changing this cmd->write_buf pages when driver/HW is working on it?

Is there anyway I can avoid this. How about if we allocate a local buffer(kmalloc/pci_alloc_consistent) and memcpy kmap_atomic to that local buffer and then calculate checksum on that local buffer. Will this help?

--Anil

--- On Thu, 9/9/10, Christof Schmitt <christof.schmitt@...ibm.com> wrote:

> From: Christof Schmitt <christof.schmitt@...ibm.com>
> Subject: Re: scsi_cmnd data_buffer checksum
> To: "Anil kumar" <anils_r@...oo.com>
> Cc: linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org
> Date: Thursday, September 9, 2010, 4:00 AM
> On Wed, Sep 08, 2010 at 08:36:32PM
> -0700, Anil kumar wrote:
> > 
> > I am writing a checksum calculation of scsi_cmnd data
> buffer in the driver. 
> > 
> > I calculate the checksum of the scsi_cmd data
> buffer(request_buffer) in driver queuecommand.
> > 
> > Now when the command is completed from the hardware
> and before driver sends it back to mid-layer, I calculate
> the checksum again of the same scsi_cmd data_buffer again.
> > 
> > Sometimes the checksums don't match. I mean somehow
> looks like OS changed the scsi_cmd
> data_buffer(request_buffer) in the meantime when driver is
> working on the command.
> > I print the address of the scsi_cmd data_buffer
> (virtual address) and its same and the contents of the
> buffer is also same during both the calculations.
> > 
> > Can this happen?
> 
> Yes. While a write I/O is being processed in Linux or in
> flight, the
> data buffers can change. This causes problems for other
> checksums as
> well; i ran into this when looking at the DIF/DIX checksums
> for SCSI
> commands.
> 
> At the moment, this problem can be avoided e.g. by running
> only direct
> I/O on the xfs filesystem. There have been discussions
> about this, a
> short summary is here, look for "stable pages":
> http://lwn.net/Articles/399148/
> 
> Christof
> 


      
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists