[stgt] [PATCH] Another patch to improve the LBA out of range even further
ronnie sahlberg
ronniesahlberg at gmail.com
Mon Jun 4 11:10:12 CEST 2012
List, Tomo
Please find another patch to improve the LBA out of range checks even more.
We shouldnt shift the LBA << 9 and compare with file size since if the
initiator used a HUGE LBA,
(for example 0x8000000000000000ULL) then this shift makes the LBA 0
and the i/o is successful.
Instead we should shift the filesize >> 9 before the compare so that
we dont risk overflowing this 64 bit integer.
We also need to check for if a HUGE LBA and the TL will wrap.
For example if the LBA is 0xffffffffffffffff and the tl is 2, then LBA
+ TL wraps and becomes 1 so the i/o will fail the LBA out of range
check.
To handle this case too I added a check for this explicit wrap lba+tl < lba'
These tests are available in the iscsi/scsi test tool in libiscsi for
those interested.
I have already seen several other targets that also seems to do LBA<<9
for the check and thus fail in the 'read from LBA2^63' test. Fail as
in returning the data from LBA:0 instead of a lba-out-of-range
check-condition.
/bin/iscsi-test --test='*read16_beyond*' iscsi://127.0.0.1/iqn.ronnie.test/1
0204_read16_beyond_eol:
=======================
Reading 1-256 blocks beyond end-of-device ... [OK]
Reading 1-256 blocks at LBA 2^63 ... [OK]
Reading 1-256 blocks at LBA -1 ... [OK]
TEST T0204_read16_beyondeol [OK]
regards
ronnie sahlberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SBC-LBA-range-check-fix-some-bugs-in-the-LBA-out-of-.patch.gz
Type: application/x-gzip
Size: 982 bytes
Desc: not available
URL: <http://lists.wpkg.org/pipermail/stgt/attachments/20120604/50d138c3/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SBC-LBA-range-check-fix-some-bugs-in-the-LBA-out-of-.patch
Type: application/octet-stream
Size: 1975 bytes
Desc: not available
URL: <http://lists.wpkg.org/pipermail/stgt/attachments/20120604/50d138c3/attachment-0001.obj>
More information about the stgt
mailing list