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
Attachment:
0001-SBC-LBA-range-check-fix-some-bugs-in-the-LBA-out-of-.patch.gz
Description: GNU Zip compressed data
Attachment:
0001-SBC-LBA-range-check-fix-some-bugs-in-the-LBA-out-of-.patch
Description: Binary data