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 2CFEF43C2C; Wed, 28 Feb 2024 18:12:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 192BF40E4A; Wed, 28 Feb 2024 18:12:25 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mails.dpdk.org (Postfix) with ESMTP id 7015940E0F for ; Wed, 28 Feb 2024 18:12:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709140344; x=1740676344; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=CSrJuXtfdVQxbVyL8/z8ygSr+71HsvdK1clEgI0l20k=; b=MzPuUWN2YP8Ubwr5ZdFlt2IiZS7YP1gBRbx+yMcsN/N8pssGcKUaXUkk 3AvOvXEkL6tmrnAGDQ3gBFEwxWBrSsVXMTHwzYLRmYAcy+Is6GHPhwUKN lu5Znh4G/tJF0M51xd48zEB8O0bsYO7tR+iCHuk2wQe3DuyDvhn+77JPJ yRJ5GS8pQUVVSUrB6RfEOj2ecPADgUu4UiHrmgwpzs6mfzggTa2bWrR1L AeQ87etgCk1AkIAXOfI/5ol7xbmQga9OLycIt0mnANYvbSbNSLqS/Ze6g GMph2rEHy+kccndYkqnPikvMZROoNBrKAwVZZvY0rHZfi4lDzfZ1X/ktg Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="3422379" X-IronPort-AV: E=Sophos;i="6.06,190,1705392000"; d="scan'208";a="3422379" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 09:11:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,190,1705392000"; d="scan'208";a="8057345" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 28 Feb 2024 09:11:54 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 28 Feb 2024 09:11:53 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 28 Feb 2024 09:11:53 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 28 Feb 2024 09:11:53 -0800 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 28 Feb 2024 09:11:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PFE/PlZtAC2ujVmwkPZOm5TCOs9cIfvn81OwD3IJRtzmjLr2wc9zuXxyK+Zfucqr1My/0Q1zfpB2UO3hc0piNNMFtd+hYb7JTIepm11d3bb5pc3KIRcXoU4DYwsqzKEcFHJGu77+Uxwh6yte5WNE9YUUVj4eZAceJ5YSAl782NKb7tbb5Pk6Es/sVc9fi7mIFcWwMwugTpF93o3m+hJnc/LDt8+K1uJ0KZg0+0vHY+5VwvN6DMvAAmDo0afWuSlxelLixmdFDA0Pxnz0KyOEiTDnrsEPNlgS0zJILS8WISwxc6d4BFHTQMZ1IPF08GITYKQhV/fzFfG9Phz6JBkh1Q== 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=Pk/WTn0auL/0ckFuDrFb2/rUImwCiqBE1PrgY0hqrxo=; b=enGltVKZv5agHZq3qENtwHiidcM9LAXOeNPIsRv/+LkyaE5suw0f4tdDCvRbNMAWSLvVsl5DzB3yd9xFYqO2OSsz6+JFmi0AmH4yfYAmNjhrWysWw+A0/xI16okeschpVeLHTaLXpPoBJUlbpgRsIlTtJUTWjgnnLwS4P37vp1z8o++cjLYavOM6LfMwWyqWq4ZmdqO01NnPNCqvJOBEveayyULmKdCZzjdu8VZaiZEdb19duyyPM3+iMtscUMXU//DX0qXGMFC4HQWxQPdwSMRtDOErSwRBPUhfhlkylprnKTalGoMpgwp0kq8jZdXp05DblKhWoiWJuaYpSXTWDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH0PR11MB5832.namprd11.prod.outlook.com (2603:10b6:510:141::7) by MW3PR11MB4539.namprd11.prod.outlook.com (2603:10b6:303:2f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.25; Wed, 28 Feb 2024 17:11:51 +0000 Received: from PH0PR11MB5832.namprd11.prod.outlook.com ([fe80::2771:e8a9:400c:e466]) by PH0PR11MB5832.namprd11.prod.outlook.com ([fe80::2771:e8a9:400c:e466%5]) with mapi id 15.20.7339.022; Wed, 28 Feb 2024 17:11:51 +0000 From: "Gujjar, Abhinandan S" To: "Kundapura, Ganapati" , "dev@dpdk.org" , "jerinj@marvell.com" , "Jayatheerthan, Jay" CC: "Naga Harish K, S V" Subject: RE: [PATCH v1] eventdev/crypto: fix enqueueing invalid ops Thread-Topic: [PATCH v1] eventdev/crypto: fix enqueueing invalid ops Thread-Index: AQHaajJndbqJfwEBpECSqXri0Alq2rEf/cPQ Date: Wed, 28 Feb 2024 17:11:51 +0000 Message-ID: References: <20240228103919.2018017-1-ganapati.kundapura@intel.com> In-Reply-To: <20240228103919.2018017-1-ganapati.kundapura@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB5832:EE_|MW3PR11MB4539:EE_ x-ms-office365-filtering-correlation-id: ae3af105-fae6-4912-cd47-08dc38805afb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 43NXed5NbrbEOe0PhvUAisL1MtZaY5liA5Akly8elnbxoAninDR1wD6ZxSvg3/PpWABrS/xbj5J6GQTDcMkhr++l8BX4VQOg0ongoS0g1r1y7gGza5nLKVRWml9iA8INN01gLo2jr8SyMHH4teXNloGAICuLMf5hM9muQnMh0rZgus6TftLqbZ5uJzadshn7eNcKOD1wK6b9LAUmhE9xE3WobOF/m15u0Yb3QDSWoY9Wi8qvGuooWuNgOZNNIhPOZIc4NuUKVLy19EG67DNtbx+UlSNobKlVqWovmfjyv0inV54LDt4Hqh2GgjDK1zqVLmPmsIjk62h72HwFWEj0kDw76n4u0dWMKv1FKgzk10NfqPdEW6PorguUrks8+AFafiSRKFp9Dou5oUherMElWv/qUECDRhY1YAXpQ8MHNv8twPv4yAYy5feaEqekyAwyvAfRwZKD5DjhbxxAY3UDrAcnfyr6CC4/OqdGu9NEMcjt29hFXFiG+abTGsmyuYGBtyKfHc2N9SV/57XJgHbyH/1QjP9U8WbwOPfxPiIvzeEx9rRIQAdpCpRDNbrasu80fzp+mRAYZilr5mbrokTT/N1kCCrxRYa8nAyi2O+a7dymYsw5a4FLNkzgJWXJHFH/iT9dn7H/rVIGHjfU+Q7iI1QRBihclv5yFHxQg9yLS0F7NCmjkDWglykxJcXE6s0yTX2kbWbFUVhsG6n8GANYCw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5832.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MBF/XTerSWKgxOHBkfSxUs8gLOpRCa0CsX5QPaIYgnGPoPzSoLsiNWJ3Iump?= =?us-ascii?Q?fY+rFn/6MaG68rAKvRiq53e9hXdIcD4dzfgiG3rB0CYVJAgrDCiYvHWu9bhk?= =?us-ascii?Q?qFfg1heWLCOm5F0R1xo53fhwdPAj7bZ806ZdO4g/oExy68c2s73uzHtIT41O?= =?us-ascii?Q?aywzZiinkbJmMRR5+Ba75FJv5305sm4zf6eGhuA7jPpld3LsBNledPePo5p0?= =?us-ascii?Q?9wSTxuaaK+x2NyNc7zwPTuE+3bwg+S+XtzKVYdiZkqDkztHevVq5gbPHvur/?= =?us-ascii?Q?SgXrbuPS+AAuKE4yVpsS4UChgNZdiJQ2PAdYr1gBXqKxTnoOB+UXQfdOdxb7?= =?us-ascii?Q?wL+xZlf97SeVSulATvqyQxzZGPI7xN2d2VDiAXBTtEjo1T29ZsYKXbcVrBNW?= =?us-ascii?Q?Iif3Df22bDMBmJ+8EahJtoh40JHjzozGKJ22nhrZEfVZHS59UGJ/DdzcInR6?= =?us-ascii?Q?FeylIzpNlutTdoHZBsbWh7SpNz6i5JAWOBewU+tygLV+ufPDniaVM/PmWr++?= =?us-ascii?Q?2fczAtwIkV3Y9ugE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nludT9r+kBscQx4QfjEXv4cdReJgXosIZaiUPtiK1gwsYY/ky3ErmqRrpWt?= =?us-ascii?Q?/zIEMmDSsP4YnDe2WqQ5s/C43Z9hAkpQr/hFLvD6RQNcRuNQZ+TLHdsl53ZC?= =?us-ascii?Q?DVs4TZnzNNMV1PPsoqvyy5ZgrgaKoCTHxsembCNo?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5832.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae3af105-fae6-4912-cd47-08dc38805afb X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Feb 2024 17:11:51.3130 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CA52O7E1SCIA08VY0ayNCdAkL0xmn84AM+hCIYi2BxgfelrAE3YO/Tn2KdhfhrCXKWVtEsE0umQ7sk8Iu6duhiCKAKBZGTTllpIL5ViLCWA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4539 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Kundapura, Ganapati > Sent: Wednesday, February 28, 2024 4:09 PM > To: dev@dpdk.org; jerinj@marvell.com; Jayatheerthan, Jay > > Cc: Naga Harish K, S V ; Gujjar, Abhinandan = S > > Subject: [PATCH v1] eventdev/crypto: fix enqueueing invalid ops >=20 > When tail pointer of Circ buffer rollsover as the Circ buffer becomes ful= l, crypto > adapter is enqueueing ops beyond the size of the Circ buffer leading to s= egfault > due to invalid ops access. >=20 > Fixed by enqueueing ops from head pointer to (size-head) number of ops wh= en > Circ buffer becomes full and the remaining ops will be flushed in next it= eration. >=20 > Fixes: 6c3c888656fc ("eventdev/crypto: fix circular buffer full case") >=20 > Signed-off-by: Ganapati Kundapura >=20 Acked-by: Abhinandan Gujjar > diff --git a/lib/eventdev/rte_event_crypto_adapter.c > b/lib/eventdev/rte_event_crypto_adapter.c > index d46595d..9903f96 100644 > --- a/lib/eventdev/rte_event_crypto_adapter.c > +++ b/lib/eventdev/rte_event_crypto_adapter.c > @@ -245,20 +245,28 @@ eca_circular_buffer_flush_to_cdev(struct > crypto_ops_circular_buffer *bufp, > struct rte_crypto_op **ops =3D bufp->op_buffer; >=20 > if (*tailp > *headp) > + /* Flush ops from head pointer to (tail - head) OPs */ > n =3D *tailp - *headp; > else if (*tailp < *headp) > + /* Circ buffer - Rollover. > + * Flush OPs from head to max size of buffer. > + * Rest of the OPs will be flushed in next iteration. > + */ > n =3D bufp->size - *headp; > else { /* head =3D=3D tail case */ > /* when head =3D=3D tail, > * circ buff is either full(tail pointer roll over) or empty > */ > if (bufp->count !=3D 0) { > - /* circ buffer is full */ > - n =3D bufp->count; > + /* Circ buffer - FULL. > + * Flush OPs from head to max size of buffer. > + * Rest of the OPS will be flushed in next iteration. > + */ > + n =3D bufp->size - *headp; > } else { > - /* circ buffer is empty */ > + /* Circ buffer - Empty */ > *nb_ops_flushed =3D 0; > - return 0; /* buffer empty */ > + return 0; > } > } >=20 > -- > 2.6.4