From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CC363A034F; Tue, 23 Feb 2021 09:05:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 628F41CC505; Tue, 23 Feb 2021 09:05:18 +0100 (CET) Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by mails.dpdk.org (Postfix) with ESMTP id 6E61040041 for ; Tue, 23 Feb 2021 01:34:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1614040464; x=1645576464; h=from:to:cc:subject:date:message-id:mime-version; bh=O57NEXJ6NdKKwlSvkXmysAVmhYpdu8rnZ76wegsxunY=; b=HU9KpgIOJKXz2WYqpF+S8JQCThqLYAw/I1JxwElhP891HIhdMDdrT1eX mwIqwSpxuX4sMwfZ8rtpDgwmb48AcFH+fcdFBwytEJoaiq4RIJcYKTx1M 3eAfA5wGFx8Bl002iGt4uaOYuu7nWas65M/dPyMQwnYlc+CiSJl+kP/Mk 0=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 22 Feb 2021 16:34:23 -0800 X-QCInternal: smtphost Received: from nasanexm03c.na.qualcomm.com ([10.85.0.106]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/AES256-SHA; 22 Feb 2021 16:34:23 -0800 Received: from nasanexm03e.na.qualcomm.com (10.85.0.48) by nasanexm03c.na.qualcomm.com (10.85.0.106) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 22 Feb 2021 16:34:22 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (199.106.107.6) by nasanexm03e.na.qualcomm.com (10.85.0.48) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 22 Feb 2021 16:34:22 -0800 Received: from CY4PR0201MB3508.namprd02.prod.outlook.com (2603:10b6:910:8a::15) by CY4PR02MB2597.namprd02.prod.outlook.com (2603:10b6:903:75::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.30; Tue, 23 Feb 2021 00:34:21 +0000 Received: from CY4PR0201MB3508.namprd02.prod.outlook.com ([fe80::694c:462d:82b:c198]) by CY4PR0201MB3508.namprd02.prod.outlook.com ([fe80::694c:462d:82b:c198%6]) with mapi id 15.20.3868.032; Tue, 23 Feb 2021 00:34:21 +0000 From: Linfeng Li To: "dev@dpdk.org" CC: "john.griffin@intel.com" , "fiona.trahe@intel.com" , "deepak.k.jain@intel.com" , Steve Rizor , Emil Meng Thread-Topic: Potential bug in QAT PMD code Thread-Index: AdcJe599AI3ulV8lTIKBAMc6rneJYw== Date: Tue, 23 Feb 2021 00:34:20 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=qti.qualcomm.com; x-originating-ip: [2601:281:8580:7070:35a5:e65b:61ae:5cf] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a39fee70-a074-4ebf-a44a-08d8d792c319 x-ms-traffictypediagnostic: CY4PR02MB2597: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: G6IluWqHd1Hix0QHfaBwffqC2HxCOSK/76s5tK6cq38TaFx0vntMmVQwgsx/8YxqyHcEyuSlveXboHW1zcCM0M/nufyHrf0hUu5tX6caWKT+yeU6u0m7ZoCkqT87wdtIGdHTbqWp4KdCn1G3/M2sQoKdya3P1/OYPmV+YzL5/jvMICPd7k0CrNWlrg6KUYBWQ8Ql3ojMQ6ypd4HjiZ42aoy+nK6bM4DQqqDnC4bsuLxKWFlT8KTNAeAcwNXszH6XQuEIVP2f8Lo6wYYLEIMS9gU1S4JLrXV6ZBwDCxApcykAxnvUsx7pFVoWDg4OG78fvtZUE5HhPefjzi8iqPV85YwHgCpTQCkO2e5Bkci3AfZXz8lkDeHXMfGJx2ZSEv62nIBq+MNfYDNT/h+XMRmTVmHqD/K9mFI+I/CKjhI75KxGed7koloIDxCuNX/1WrEQf9M+hvjHRq6IBmJ3ep81WZeq2oUuTs5MBM92ibUDHAZYajyvYIqni7eFoPHwJlfsi33enH8dy2PJieY7sQz0kJKeCakXQqyFcdeU5PYVcpXeaPaTXhVGSUUp6yJbUTz5K4x+E2Cx8xWSsUJqLnbDgB+0KyuaQ1VO8a/ZRWqIun4= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR0201MB3508.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(366004)(346002)(396003)(376002)(186003)(6916009)(52536014)(55016002)(478600001)(76116006)(6506007)(316002)(8936002)(9686003)(5660300002)(33656002)(54906003)(2906002)(66476007)(66556008)(66446008)(64756008)(66946007)(107886003)(86362001)(8676002)(4326008)(71200400001)(966005)(166002)(9326002)(7696005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?x32w7D6NI8d9BvvPcoIeAQ/Bx9882FE5N0+2IrBmanojsjrr7AqKYPEcdrBD?= =?us-ascii?Q?yRdS/kLiWostZXlkwkOl+L6CwKEWRqqC9dc7D1Bv1Fn+PrF/QyvBs0RlFBl6?= =?us-ascii?Q?oAfytD20zH6AS2eletaJHUahJMd32GW7ocMKN66USui2MWg5iyP73ZsLISHy?= =?us-ascii?Q?L+tfhhvtzhl8BiFubYfvqKZ6wnb+oTcL+hoBhSVtDe9tOMOVcoDcsZO27T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xF9l4F10ROc8QZzzYjZoSh13PxjuVn2R0cNl?= =?us-ascii?Q?eLJVRyuq4xxO0SdYx100ULB13kOzsbkoYnlt8oEQWq251GMzyUyIQs3CgKRz?= =?us-ascii?Q?oEvnQNGd+NhbAyzQpYqIiCkNEvj9Q0OgUoU+EgTViiq6l/rh7O65i4fOrGhu?= =?us-ascii?Q?5NQwwl959JLg0N8Auw8eMwYfFIK9PrxeiBRZ7RD8LtvsNpuh95mwK4Yi8Bfa?= =?us-ascii?Q?toEsWwxFfDOsSBJ4LFFfYAHw9xF70A1Ly776bONCcDgqkTZEXQ/lYLZlbkgx?= =?us-ascii?Q?fRhM+SGzFpMuaeQxHgUP04NrcvMa?= arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QX6NA7hXD7HBjZCZACfSVs5r3G7czNsRJYz/RmPHawVMmq9OHBbkvkGjdY/cT2W6F8V3zCLerTMxa8i6IBQxTjwAThbCnlyPS1ZK6t/Ix9wqo7J22j2rlh2zxMRLWVPVEnYprFVAYgmxfbRIMYFU8gLs5LYpNCIHZ385ksQYvuHl0b92xE22ZdyKwJbD+pNUQaSAeidcx5h9lF3lNpOpIqUTP67PptP3ZkPMWv5DM7Cxq0ckKFEOfP0KK1gq70UAhBHJWIrtvT0Ub+Qbkqpj8rQrpSWITSMEbaMfDSP72azkvcSEEW/K2IWly7tCmuDtZGHBhHMSDLpXC8k0Jp7jLg== 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-SenderADCheck; bh=Yz8rdCm5Ijxo/gj5x8Tq2PqXQAdGo4MWkcsvqMycKaM=; b=ORDifWsdtuwGUWbc4sOWY9hVrTQKfcCYCFVlPA8r9zwsckyf/VWFce77GsfXfBSgUbXHNRhPJY9mouAMyKjt/weVQYDLXWciOgOgEvIAC4WUjzDJOvuz+ljBscsGQxBlT4C8DOmJJBCOjCpaZ6BzqdLLQHNfnEME/yToJckMtypMylmvZZEsFfQltGTi0agU1hwGOcOv6c7uze7bGDXX5i5EMVjQ3IMnbB3qViap3SbBoNBWW8Ety+a1gU2Hb9/jrnFc6+Uj0kqLdh6oZFH72ufa2sG6baZte+iHOe3ytElFHzanJRRJBbHYcellDJ6+oNc+BBq5imuTgVGysYRVJQ== arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=qti.qualcomm.com; dmarc=pass action=none header.from=qti.qualcomm.com; dkim=pass header.d=qti.qualcomm.com; arc=none dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.onmicrosoft.com; s=selector1-qualcomm-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Yz8rdCm5Ijxo/gj5x8Tq2PqXQAdGo4MWkcsvqMycKaM=; b=h+SZw02zwlPmRKWzT/b8vbPIhFwXA1m6WGwj5zZeDj+uXJXWnbH9l2hKdWQjsdM9FmmdAOrXAF0y/VyMupolcPPfX+AIRhz41JxonV924EJqDCUtypDzp/CjN9DtmgB2C3nnqAhvTo/XWnLGNS9hdfVOa0mmsbQueWv4DUyagTU= x-ms-exchange-crosstenant-authas: Internal x-ms-exchange-crosstenant-authsource: CY4PR0201MB3508.namprd02.prod.outlook.com x-ms-exchange-crosstenant-network-message-id: a39fee70-a074-4ebf-a44a-08d8d792c319 x-ms-exchange-crosstenant-originalarrivaltime: 23 Feb 2021 00:34:20.9653 (UTC) x-ms-exchange-crosstenant-fromentityheader: Hosted x-ms-exchange-crosstenant-id: 98e9ba89-e1a1-4e38-9007-8bdabc25de1d x-ms-exchange-crosstenant-mailboxtype: HOSTED x-ms-exchange-crosstenant-userprincipalname: NTKSjeewflPC+O1gvFUaLUpN4s0suDsTThy4EZ99fyCleRNgtcX55kPvEE6md0EWOd5GZtctAZ6X1DCzqrGrMQ== x-ms-exchange-transport-crosstenantheadersstamped: CY4PR02MB2597 x-originatororg: qti.qualcomm.com MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 23 Feb 2021 09:05:16 +0100 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] Potential bug in QAT PMD code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, We believe we found a potential bug in the QAT PMD code. file link: https://github.com/DPDK/dpdk/blob/main/drivers/crypto/qat/qat_sy= m.c The undesired behavior happens when: * symmetric operation * out-of-place operation * encryption * do cipher + do hash * SGL enabled on either src/dst mbuf chain * min_ofs is smaller than the length of the first segment of the sr= c mbuf chain behavior: In dst mbuf, payload is ciphered as expected, but mac-i remains p= lain text where it's expected to be ciphered as well. potential cause: * When min_ofs is smaller than the length of the first segment of t= he src mbuf chain with the foregoing scenario , auth_param->auth_off is cal= culated by auth_ofs-min_ofs(line 512 in qat_sym.c). * When SGL enabled + do auth + do cipher, the remaining_off is calc= ulated by auth_param->auth_off + auth_param->auth_len + alignment_adjustmen= t(line 534 in qat_sym.c). so remaining_off doesn't include the offset appli= ed on auth_param->auth_off in this scenario. * The auth_data_end(line 546 in qat_sym.c) found doesn't seem prope= r since the while loop (line 540 in qat_sym.c) iterates from the very begin= ning of the dst mbuf. Proposal fix: add min_ofs in the calculation of remaining_off(line 534 in qat_sym.c) Please let us know what your thoughts are about this issue and feel free to= contact us if there are any questions. Linfeng