From patchwork Fri Oct 28 05:47:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Johnson X-Patchwork-Id: 13023094 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9ABEC38A02 for ; Fri, 28 Oct 2022 05:50:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooIDy-0006oR-6R; Fri, 28 Oct 2022 01:48:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooIDw-0006nd-4e for qemu-devel@nongnu.org; Fri, 28 Oct 2022 01:48:08 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooIDf-0006o1-U2 for qemu-devel@nongnu.org; Fri, 28 Oct 2022 01:48:07 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29RMO7tM005927 for ; Fri, 28 Oct 2022 05:47:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : content-type : content-id : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=a9CeHsaEtAOkAhLRdEiw3Q0F/FOB2h81MD/JVlUTLwo=; b=2/femCWxViSNaoAi9DSkuFJHFLvtDed3ZK6wGJRa7hSTf0BL9rHV6nMx1q4stHSzm0/P sYR2lK3E1E5UMcJJOAJdkl8Uadp6ae/O408WO/ERkP1wCxDqgEaGmPjfUpye4F/nAy+2 IV1T3kMtTaSQjnDlHkcVPL192oHISUucumlUTfsmTNQz9B0GFP4YOHFWRLeDtCLxBFcm 7SqE1r4DQlAk8fFP6b86l9jD2jQxTP9iQ7jsehVHPsYqWBlMxH6/zEe8ttM6f+kb4rID /BDNv3Qjj36mJs2zS0wX2itMHN4Deh3OwOCX+VQXE7qxm/E1+CVDr21XOXMMKD5VYxW9 ag== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kfax7uw2d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Oct 2022 05:47:46 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29S24qBp026557 for ; Fri, 28 Oct 2022 05:47:45 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kfagqrdu5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Oct 2022 05:47:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WjcmJmfeRUDHcrIWUtRnnrl8S07bBk4DmGSw9OSFk6Fyoi3hpb76d8yOBMQGIZtGZ0c0+dY+AhhB0FI7MrOqgOwU8QGxbmoaOlV0VJihaMDqzA6uXFbQDSG7cpVm948dgSlDgDt/nr40KqWO7xTFdu2fy6etvIJ/sJJWVJBr6WrKxQbZcmR31WG6TbmWHvsGBz+EZnLL9rS02uONHye/04Lf58hWCTnmiSiqdgfFwU8fWOlBrqBULimR8IPqThILcC4DS2LFSPCSY8XZSHztFsD6KTg78fc1M/xpSTZYn9ZaZHL4bvT7Db9QoiVJOQ6jt1pnq/9GZ2akF/ROiRfzzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a9CeHsaEtAOkAhLRdEiw3Q0F/FOB2h81MD/JVlUTLwo=; b=HuOjFTIRrd4ISBWRKtgvyCfMD1af1rFhIGRWQoYX+F/WVf4Ip1k3NC2xd+4lLeDHzHL9d12d8UYyXQD9SDwYcxK9flRKtfAC1z2xq1YTMYLY0/R9oqnxcvDekoH4OTy72Qjg26jH9DewxFjukpZWnqijpPa3xpFIJYs8aX5KjvqQlfHk+yx33Xvypltz7KpW3WojwsbcvVfqEMU3Y+mh4ADeNMqOu8Pt/B0xg5kGGj5Bl3ws7fYZfTjwnyT3Idq4vdbARNG1Xv+rFak6NeouwEkgo/9oDYG3N/HC+vHbxpsHdIUdSJ+YI3y5gMamFvbsWZ5f593sNcNyWKxUS3BmVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a9CeHsaEtAOkAhLRdEiw3Q0F/FOB2h81MD/JVlUTLwo=; b=IC5cpvgCyukFqtHwb+pHwCFZUXa/gfqscJhvFpB7jg5mvRWNKV+a6LaLPSEQjcYGPh65Fp9UGe9WEmZADwEJ84nW3OFCfAv95QUZmn1DQdexqK+shbmvPkhXFG87Hv4f7JtvAHQZeN7zF4D6MKUpSPzrrF08as86AvTknetfJ8I= Received: from BYAPR10MB3255.namprd10.prod.outlook.com (2603:10b6:a03:156::22) by CY8PR10MB6635.namprd10.prod.outlook.com (2603:10b6:930:55::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Fri, 28 Oct 2022 05:47:43 +0000 Received: from BYAPR10MB3255.namprd10.prod.outlook.com ([fe80::2c4d:7e24:3857:36d6]) by BYAPR10MB3255.namprd10.prod.outlook.com ([fe80::2c4d:7e24:3857:36d6%4]) with mapi id 15.20.5769.015; Fri, 28 Oct 2022 05:47:43 +0000 From: John Johnson To: QEMU Devel Mailing List Subject: megasa regression in 7.1? Thread-Topic: megasa regression in 7.1? Thread-Index: AQHY6pDMdrjfk8egN0aH8V9T88aglw== Date: Fri, 28 Oct 2022 05:47:43 +0000 Message-ID: <4A0D1260-DB8D-47CA-9369-6F3C0B7296C9@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3654.120.0.1.13) x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR10MB3255:EE_|CY8PR10MB6635:EE_ x-ms-office365-filtering-correlation-id: c70d3b5c-dcfa-403e-22f5-08dab8a7ef19 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: I//WWOd8MI8Xh78nzDVZUh4B2nOAEZi1aputct1XpYTETTmAAuscx5PKM4HS+ScpdvK6JvLN8cAWLIxEFSitgwKeYivkBJea+X7k7S5uzv1ChjkZrD+w2LaAuMt28XbqzVzVc52meV58A3Vbx5jEMQ9PkY/erjuV0zuUl5hWGOEWH8jqLEllaPo1lJVbN8FLJ8ZjOtt3NN13OV0B13AodPMJG+vjG778Q4wbJ/h7se/Ubknqff+2cXz9hkgn7H2FeQsPHidJEVqy8j84CDmzmMX8kwtkeK88TaFSCGgNKxUiR7j8GzTPF6b/Fq/OTom1bKoY5z8FxCCOgErwJFME6MIBO6iqGRkXx5vA7XqWJ12UCr3Y8MbUM8y2bLDR2scW46Ve46gRqeAiWhWKwuJp+SLBYbKuukR3YEiUmFzDVT7hjWwRhoupV8B6dqO+cfZ6f6esXw0syvJYvfbSFqy3UvWOaW80OV+imWRPzZqpXx5qfXxjBDnW+qLn2/adW517Peaj9O0fGBUzPOYotuK9ATTPHBxgsfPZlYXILh4SqlTD4iNeunbi6wlDbLXvGhcEFNAIUxNbIU+UzXAvjrpZsYRI+nMQ3BzbmA+TNYi7bO/luYJFJp56WRu/naGvgUFNev0oc1zVB4fzued1567hydkaimqABHFWbdq9DlDQ0EbylEZ1gAYrTFjXoZFBsvh9lCL93ev5Vspzl9tut9tj5DzYeDjhNHLHWArLLeQ6P+5EVIMhupFbEsx5VPKDpQxAXhM+LN8hDG/33Wqpkq5lKxMKn8jIOMpvkQDX8GMi1Ai5hAFa+fE+pOUhVDi+bdRJ x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3255.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(41300700001)(26005)(8676002)(33656002)(38070700005)(64756008)(66446008)(6506007)(7116003)(36756003)(6512007)(2616005)(66476007)(5660300002)(122000001)(8936002)(2906002)(38100700002)(186003)(66556008)(71200400001)(6486002)(478600001)(966005)(316002)(86362001)(6916009)(76116006)(66946007)(45980500001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?r2lygzsXFf+C8wgqQIQmjbFMMehQ?= =?utf-8?q?T7m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NUj7KTiha8W+qn9NltmNpSsag9wkuyjuKqK4DGSgncIvcX07/?= =?utf-8?q?esi/8vIocPb24Am3h9RtLtuDLO2B06OiCWEPDLUjhauESZKw8RhLKaYobMw5+9R/H?= =?utf-8?q?ZTukM0MRTZu1PixENh/DMEPotEVVUwv3IHfTuolHEr8IG0xuBV2SnP8HXFZRbKJfj?= =?utf-8?q?zPA2BqHcJV9iMbFwZG0sMfYmRVFifsy8AmrPUmzwtrfZLvNPVj9zsCthKorNUxyNr?= =?utf-8?q?GQkg+zIf8gRVvXgpKS9CA2Sby3NEykHFdXyZlRE8tiRVidQBX8oED1DWakDYMipL8?= =?utf-8?q?gkAQ/OmDfhwxJbHVydbYL0V2f6Tj7UiMeob2SCHa4Adzr9FX/yFK56/GE9EPRu3bB?= =?utf-8?q?RAoCr1w2s9B3fkxyICqUq+98rM89znbS8JELdQax1h1TfnO6i8OlTrWBX/AavzfsF?= =?utf-8?q?yTC5bFFin70S7UvRppYpIOkeFPUU6d9J2uEfP9xxhuSJCT19ZntE1TjnmS7aGrUj4?= =?utf-8?q?Z+PPXNwCFoQ4jwKOx/8i3l6qQu7u1rtE03nhRIj0otqKXutDWAD1Zi5STrvTxnOzC?= =?utf-8?q?1iCwOg11HJGXplJEvwGv9Yw7uFXn80MT4fQrEGeJiIVkDqW96B5DxbrWWxneP4jk0?= =?utf-8?q?b66HtAzk3efgmca1OLGTYwuHjaCza/N4PQ=3D=3D?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3255.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c70d3b5c-dcfa-403e-22f5-08dab8a7ef19 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Oct 2022 05:47:43.6328 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Bx+D0dmQHx1d4Ds+5jSIxwhhPYF4FN+xCNpEf12NKCBhstvis8WkgaxawVzkKGJs8opj67OGXTnpcEgRdYJWffKRcQ54GcAnZUmNcQtJ6C0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6635 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-28_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210280036 X-Proofpoint-GUID: WP98-Xd8aBz-oPpFwpgWchCBrCzC5rnV X-Proofpoint-ORIG-GUID: WP98-Xd8aBz-oPpFwpgWchCBrCzC5rnV Received-SPF: pass client-ip=205.220.177.32; envelope-from=john.g.johnson@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org I pulled 7.1, and the megasas driver stopped being able to do reads from a disk. It looks to be related to this commit: https://github.com/qemu/qemu/commit/fe9d8927e265fd723a6dc87cd6d220f4677dbe1f#diffe3f5f30efc54747e0624dca63e5f55f0012736c1875b6e85526b3514e6911be3 which added some command buffer bounds checking to the SCSI subsysem. Unfortunately, when the megasas QEMU emulation receives a direct I/O command from the device driver in megasas_handle_io(), it synthesizes a SCSI command from it in megasas_encode_lba(), but passes the command buffer length from the driver frame instead of the length of the buffer it synthesized the SCSI command in. The driver (at least the Linux 4.14 version I’m using) does not fill in the command buffer length in direct I/O frames, so scsi_req_new() sees a 0 length command and fails it. I worked around this issue with: and the driver can read the disk again, but I’m not sure this is the correct fix since cdb_len is used for bounds checking elsewhere in megagsas_handle_io(), although a 0 won’t fail there. Is there anyone with megasas experience who could comment on this? Thanks JJ diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 7082456..6e11607 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -1823,7 +1823,7 @@ static int megasas_handle_io(MegasasState *s, MegasasCmd *cmd, int frame_cmd) megasas_encode_lba(cdb, lba_start, lba_count, is_write); cmd->req = scsi_req_new(sdev, cmd->index, - lun_id, cdb, cdb_len, cmd); + lun_id, cdb, sizeof (cdb), cmd); if (!cmd->req) { trace_megasas_scsi_req_alloc_failed( mfi_frame_desc(frame_cmd), target_id, lun_id);