Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752665AbdGMXYm (ORCPT ); Thu, 13 Jul 2017 19:24:42 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:46117 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751198AbdGMXYk (ORCPT ); Thu, 13 Jul 2017 19:24:40 -0400 X-IronPort-AV: E=Sophos;i="5.40,356,1496073600"; d="scan'208";a="135826235" From: Bart Van Assche To: "nab@linux-iscsi.org" CC: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "mchristi@redhat.com" , "roland@purestorage.com" , "target-devel@vger.kernel.org" , "martin.petersen@oracle.com" , "hare@suse.de" Subject: Re: [PATCH] iscsi-target: Reject immediate data underflow larger than SCSI transfer length Thread-Topic: [PATCH] iscsi-target: Reject immediate data underflow larger than SCSI transfer length Thread-Index: AQHS4A5DNXdpZ4WaCUuW3rpeuY6x8KIbGi6AgAEAVwCAMlJUgIAAlU4AgANZz4CAAEJQgA== Date: Thu, 13 Jul 2017 23:24:38 +0000 Message-ID: <1499988277.2740.28.camel@wdc.com> References: <1496895685-18464-1-git-send-email-nab@linux-iscsi.org> <1496936253.3028.1.camel@wdc.com> <1496991302.28997.66.camel@haakon3.risingtidesystems.com> <1499757761.28145.45.camel@haakon3.daterainc.com> <1499789824.2586.16.camel@wdc.com> <1499974037.7987.24.camel@haakon3.daterainc.com> In-Reply-To: <1499974037.7987.24.camel@haakon3.daterainc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linux-iscsi.org; dkim=none (message not signed) header.d=none;linux-iscsi.org; dmarc=none action=none header.from=wdc.com; x-originating-ip: [63.163.107.100] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY1PR0401MB1536;20:2O/HwonvoJr9Lp39eFnZfX6b9uE1LThWeAhJYqeF1RY6Jk4N4vyDgp78zCml8x83GMr+ocBMMTlKGjG90Pfw376W0HWynGQKZTmGXYiM12zwz5NPjX9dLSZ/GJt4JEycfiD0vTJ21gGfeFronf7KwotW/bYA93FbqvATJ1Wa/L8= x-ms-office365-filtering-correlation-id: 73e068ae-fc29-4936-7eed-08d4ca46549e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254075)(48565401081)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY1PR0401MB1536; x-ms-traffictypediagnostic: CY1PR0401MB1536: wdcipoutbound: EOP-TRUE x-exchange-antispam-report-test: UriScan:(236129657087228)(247924648384137); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(2017060910075)(93006095)(93001095)(10201501046)(3002001)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR0401MB1536;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR0401MB1536; x-forefront-prvs: 0367A50BB1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39850400002)(39450400003)(39400400002)(39860400002)(39410400002)(39840400002)(24454002)(377424004)(66066001)(7736002)(2900100001)(6436002)(6916009)(2950100002)(6246003)(3280700002)(4326008)(8936002)(25786009)(53936002)(2501003)(86362001)(229853002)(77096006)(6486002)(2351001)(33646002)(1730700003)(8676002)(81166006)(3660700001)(38730400002)(217423001)(50986999)(2906002)(76176999)(478600001)(189998001)(110136004)(99286003)(93886004)(103116003)(72206003)(14454004)(54356999)(6512007)(5640700003)(54906002)(102836003)(6116002)(3846002)(6506006)(305945005)(36756003)(5660300001)(14773001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0401MB1536;H:CY1PR0401MB1536.namprd04.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-ID: MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jul 2017 23:24:38.1216 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB1536 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v6DNPb02026445 Content-Length: 1390 Lines: 28 On Thu, 2017-07-13 at 12:27 -0700, Nicholas A. Bellinger wrote: > For the former, I've still never seen a host environment in the wild > over the last 15 years that generates underflow/overflow for DATA CDBs > with an LBA. So I'm reluctant to randomly allow this for all cases and > fabrics, considering no host environment actually requires it. > > That said, I do understand libiscsi generates this for WRITE_VERIFY, but > I'm still undecided if that's a good enough a reason to enable it for > all cases in upstream. > > For the latter item, it's fine to drop the legacy block_size != 512 > check, and I'll take a patch for that separate from the other bit. Hello Nic, Thanks for considering to drop the block_size != 512 check. There is one side effect of the current code for handling WRITE underflows that has not yet been mentioned in this e-mail thread. The current implementation of the iSCSI target driver does not discard the entire immediate data buffer if the size of that buffer is larger than the data buffer size derived from the SCSI CDB (EDTL). Because of this the iSCSI target driver will attempt to parse some of the immediate data as an iSCSI PDU. This can cause very weird failures and error messages. I think we should address this and also that we should make sure that any iSCSI PDUs that follow a too large immediate data buffer are parsed correctly. Bart.