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 93181A0C48; Thu, 8 Jul 2021 16:13:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B60D40696; Thu, 8 Jul 2021 16:13:06 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 613FA4014F for ; Thu, 8 Jul 2021 16:13:04 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10038"; a="209328392" X-IronPort-AV: E=Sophos;i="5.84,222,1620716400"; d="scan'208";a="209328392" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2021 07:13:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,222,1620716400"; d="scan'208";a="498439569" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga002.fm.intel.com with ESMTP; 08 Jul 2021 07:13:04 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 8 Jul 2021 07:13:03 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 8 Jul 2021 07:13:03 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Thu, 8 Jul 2021 07:13:03 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.42) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Thu, 8 Jul 2021 07:12:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QnZRADhdd9oBUqrfAB5e0xdlmTrbnvo6YrcCiq5fcS1JV+LvYYzHgAnzii67VsdWKbH5rUkVLwDEHivEEUfVo1TvPJMwuV33cWnYKKFCNeqJtuDyq8R+G2LI1/z3uT7gyOzKfxurPeiikzoa6+OX/JjDy7eYLahliLvItvECxxmI2F7lAlxZb6Fo6CaxuuG3LrPjsVoigwEKH91azgs8mgIMS1skyLF7wC8e11S4kvP1R6YmV/euHMso8tRR8IVwMBybL671YCTSCf7QnmUL9jCqYQYSvoyF56iTgttrenB/VB/5u5Vy3xEIG+CiUe1rCljFR7Tz3qz9ryYsQ30eQA== 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=3he19umlIK/s5qiZb1R1z+Ncu9iyaVKDxXsqsxCC0G8=; b=RNnKKFPSwFulsMq6xS6FaRNwrtDerREpKm0Tc4Gp46bnicbbHE/vv0oaslAwNurNP2lvU4NSotzJrj/ofJ4l+G8Y9MqQ5TM43b6PF3V8rNrGfu4Rt3fnQuTDmoIe84Heigx/n6fp0+VRPsEsLJcwUUCnbdNxkhvqLhw+zWEm+ID2ihlGBWo6G7kCpV+XjVcPPG5Ya26YAE+XsIonqqcqWjMHgXHOuUMEtoV9aJSS010k0SEvAFWKmQlLYycMgS9AT/Lz27jGEkPfNPLJkG1/20ZsA0Oa+YUgGmwlR2METbS8m7+FJiietqnoBFtHXuREMIF7pnLiNTRlGHWSacIQcg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3he19umlIK/s5qiZb1R1z+Ncu9iyaVKDxXsqsxCC0G8=; b=vZtAeSMJ1O7TcOpl3GhhHE5X4xhJjSUn5+0thWBipn8h1VRlrfBgeAwdA1DuVLig9p7af5KGgjw0jOG0y5qfy76AQUuqhntZkdOFCWDQNuVDcOgCgZrsBfWdQpoFLK7zcL/TPDxGKwXqd8l0FgDCKCTyCdnECLXegSTWNErvg1M= Received: from PH0PR11MB4824.namprd11.prod.outlook.com (2603:10b6:510:38::13) by PH0PR11MB5205.namprd11.prod.outlook.com (2603:10b6:510:3d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Thu, 8 Jul 2021 14:12:52 +0000 Received: from PH0PR11MB4824.namprd11.prod.outlook.com ([fe80::71d4:246:91ea:4df5]) by PH0PR11MB4824.namprd11.prod.outlook.com ([fe80::71d4:246:91ea:4df5%4]) with mapi id 15.20.4308.023; Thu, 8 Jul 2021 14:12:52 +0000 From: "Gujjar, Abhinandan S" To: Akhil Goyal , "dev@dpdk.org" , "Jerin Jacob Kollanukkaran" CC: "Power, Ciara" Thread-Topic: [EXT] [PATCH] test: fix crypto_op length for sessionless case Thread-Index: AQHXba4ehMTU0laelUap+7tkfuTf5as3l4eAgAGMzdA= Date: Thu, 8 Jul 2021 14:12:52 +0000 Message-ID: References: <20210630124637.2987722-1-abhinandan.gujjar@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 67a7041c-1236-426f-b343-08d9421a7954 x-ms-traffictypediagnostic: PH0PR11MB5205: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /bdM6WV3gsDe/W7iYL/vqMTE7tlWIWbjWjh7LvYzLdD8fYRf2Ga3EkvDBYUZNxq4oBDOZc9sflQyxmdZixfprlLECvt7TfPa+cBL1oeS3HGEM1FcVeMkcP3lEuzeWvqqOG7Ow6aZCFIRKuMA3G8jf7z6iOGyp5y/nGSxOti/qobfIVE0a5Ua/a5+a+L4Mtv6OEg/2GzN2/pKGEKb9Tchn9U4l51LUWs8fY3TY7C4zVcQG4TssEEf4A8Rwk/3p6//8HgUMJlH0BAyt/GyeRfco/gxBVFB9LaAxMy7kjv70Vu3GlRzzJ89IRR1qoxSPpsf6iE+6b1lOQyHZ2qxSWQPyeWp0J689dXHPmCePU/Jo13Z5WqHVLeOYtQE8/jrqoVmlWwlrbwSYMtSRgxTIPNu6SlES8GkwPEku2iA8l7jsl0iyzw5xN01kFsmUIGlhthbUI64XXOrwAJ1tzaQ//j3ZjhI6LaPJ/JIqQkNPCM/9LPNA7kHsefFkIMcU3pLGWifyvawHfw52m3G2gPulHa94kLsXxLP7u2HySPIwJmi9DXZBDyL9y54cLglSqZ7GwXmWRZhfza/qROsE3CeNedJ2wmnmoNGJUHSiySy8fGCgJ7nKlHDLAWiLeDOO5hEl1nhjN3EvLWqJSB0PWmxFTuhFQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB4824.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(39860400002)(396003)(136003)(346002)(376002)(4326008)(33656002)(86362001)(122000001)(5660300002)(66446008)(9686003)(66946007)(64756008)(66476007)(66556008)(55016002)(8676002)(76116006)(52536014)(7696005)(38100700002)(316002)(110136005)(83380400001)(55236004)(53546011)(186003)(8936002)(107886003)(478600001)(6506007)(71200400001)(2906002)(26005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?9HmH2DSVDNlS1cJQpejppcFw6386m/+t/Ye5T688UGz82Dq/F0rwIaulDb3J?= =?us-ascii?Q?hs14E/LCdsn2zVhrAAZeeM1ykPZZA9O7GNf4IyGj3HAU7RUUzNM3U/Chq+lg?= =?us-ascii?Q?B3T5GUmqxHLhfHNVuYbOH+OvSnB2LN5fLnTlf5hf3fyUI2gyBdNSshrfzq4Q?= =?us-ascii?Q?U9XYfnS/PRGHO9VBZrE9qBb3A4Wb1pO/Ie5jEWwgJoIvaeOB3p4VXg3UQL/A?= =?us-ascii?Q?s0bQ/rEv7e300vMLqgV06FZ1Tp9qIHbY39ExYdZnkIbQx9UHf9B831SQNnqv?= =?us-ascii?Q?PUrno0jV5btRggxfu0wedHhmPLzDrj85R4NGqfI+JXsSPsngENfncxkX0hve?= =?us-ascii?Q?2bO1jySQH9pD02Lz2Un0HBBQ6/nzAxU3nh1U/3tnhHCkOJ19+OzqPfM9bmyW?= =?us-ascii?Q?bRLiHJVzgQJI+wAYM93mcCjta8yzsVfxbdNmuMJ64l8+8s+fDGasfst1o4vL?= =?us-ascii?Q?NQZRGlwt/MY4FqwsfVXHjfDvlJM28IZK1F4J/j5bQ5JUYuKIVkG9JDLDGqa4?= =?us-ascii?Q?kBWb3v8GjtV5wpcf2f5LRp4m4Anc2jg+MMwv85ryq9G++dcP8XUwbABxSq9q?= =?us-ascii?Q?eM1GJbblbCMSBqeCHBemeHMR60C0K5xZdGBr+UuSP09JBReOkSy5eG3ZHfE9?= =?us-ascii?Q?sXei3Mpo3QPZb63lAlBXZy0YHyOaJzwUiHt2qSRlkpkmqwDkwVwyRM2zaRUg?= =?us-ascii?Q?3Tz4yXhKthKaTeJIxI73XC/+u70I/RqqsOpz+eQh0fNjzUvWyB223JmC89jo?= =?us-ascii?Q?s1Ro9zyt5ZHdMu+xhffMsXO1N4C7S4MDAdmsBOhBliyNN+LJo56CiJC49PwH?= =?us-ascii?Q?X+ErTRtTDnv4Walshx7KNblo5EOUHHd6EI+hvDq3XNc6qavp2ol2+7XENqFv?= =?us-ascii?Q?FJKd+HAQLMJnsUBqFDevDCsYpdDkPGmraxFgD+EEOXPHhjM0BPoWRakuk+I8?= =?us-ascii?Q?rdOigzFIaSqtIsHPB513eBo44/bDMKIbaGh96Eo/YSrUwqg/EPZKVKdqyKYq?= =?us-ascii?Q?PLVMkPVOaSuOoQaYNM8Ikkbs9BF1+6O06YUvctiuLP5WrLr1YuPTgr4EnDMx?= =?us-ascii?Q?0b2W+VfcOD+mrnMSwAeerHDBO3rtstqWnvnyKkmEILmg/GEYMP4HOAUmTEfJ?= =?us-ascii?Q?4t8p4RY8UVSyjUPYAOU5ruGw9J0fvdwfOvmFVflXiJAW1tuulD6DC5vEqRG1?= =?us-ascii?Q?iiO3CFKT+YoQON2RNxcd4ArNXwByO2LxYBdKlKBkQF6JizQ6SgGtneqnw2P4?= =?us-ascii?Q?mRYn5iyknP5F8MWVnLKpXQsvX4dyNHb+sf6mp6LnMgf4pxn9B9wsB/xbKOxt?= =?us-ascii?Q?xKg=3D?= 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: PH0PR11MB4824.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67a7041c-1236-426f-b343-08d9421a7954 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jul 2021 14:12:52.0458 (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: 2PiT8n8nuwkcOzXyyKD2O7AQ634gxRVvfwQXDciF6Gme9oCjr76704zwAzlxlpfCmw4SbVP7yNy91in2fbGRK0efm0J88HE4JiL7YMcHURc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5205 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [EXT] [PATCH] test: fix crypto_op length for sessionless case 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 Akhil, > -----Original Message----- > From: Akhil Goyal > Sent: Wednesday, July 7, 2021 7:38 PM > To: Gujjar, Abhinandan S ; dev@dpdk.org; > Jerin Jacob Kollanukkaran > Cc: Power, Ciara > Subject: RE: [EXT] [PATCH] test: fix crypto_op length for sessionless cas= e >=20 > Hi Abhinandan, >=20 > > Currently, private_data_offset for the sessionless is computed wrongly > > which includes extra bytes added because of using sizeof(struct > > rte_crypto_sym_xform) * 2) instead of (sizeof(union > > rte_event_crypto_metadata)). Due to this buffer overflow, the > > corruption was leading to test application crash while freeing the ops > > mempool. > > > > Fixes: 3c2c535ecfc0 ("test: add event crypto adapter auto-test") > > Reported-by: ciara.power@intel.com > > > > Signed-off-by: Abhinandan Gujjar > > --- > > app/test/test_event_crypto_adapter.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/app/test/test_event_crypto_adapter.c > > b/app/test/test_event_crypto_adapter.c > > index f689bc1f2..688ac0b2f 100644 > > --- a/app/test/test_event_crypto_adapter.c > > +++ b/app/test/test_event_crypto_adapter.c > > @@ -229,7 +229,7 @@ test_op_forward_mode(uint8_t session_less) > > first_xform =3D &cipher_xform; > > sym_op->xform =3D first_xform; > > uint32_t len =3D IV_OFFSET + MAXIMUM_IV_LENGTH + > > - (sizeof(struct rte_crypto_sym_xform) * 2); > > + (sizeof(union rte_event_crypto_metadata)); > > op->private_data_offset =3D len; > I do not understand the need for this patch. This is patch provide fix for segfault at the end of event_crypto_adapter_a= utotest() RTE>>event_crypto_adapter_autotest=20 + ------------------------------------------------------- + + Test Suite : Event crypto adapter test suite CRYPTODEV: Creating cryptodev crypto_nullCRYPTODEV: Initialisation paramete= rs - name: crypto_null,socket id: 0, max queue pairs: 8 CRYPTODEV: elt_size 0 is expanded to 336 + --------------------------------= ----------------------- + + TestCase [ 0] : test_crypto_adapter_create succeeded + TestCase [ 1] : test_crypto_adapter_qp_add_del succeeded +------------------------------------------------------+ + Crypto adapter stats for instance 0: + Event port poll count 0 + Event dequeue count 0 + Cryptodev enqueue count 0 + Cryptodev enqueue failed count 0 + Cryptodev dequeue count 0 + Event enqueue count 0 + Event enqueue retry count 0 + Event enqueue fail count 0 +------------------------------------------------------+ + TestCase [ 2] : test_crypto_adapter_stats succeeded Segmentation fault (core dumped) > Event metadata is copied after private data offset, and this patch is cha= nging > the offset value. >=20 > You changed the value of len =3D iv_off + max_iv_len + metadata_size, but > metadata is copied after this 'len'. See this rte_memcpy((uint8_t *)op + = len, > &m_data, sizeof(m_data)); Op_mpool is created with element of priv_size =3D DEFAULT_NUM_XFORMS * size= of(struct rte_crypto_sym_xform) + MAXIMUM_IV_LENGTH. Whereas for the "sessionless" length is set to " uint32_t len =3D IV_OFFSET= + MAXIMUM_IV_LENGTH + (sizeof(struct rte_crypto_sym_xform) * 2)" Whereas, IV_OFFSET =3D (sizeof(struct rte_crypto_op) + sizeof(struct rte_c= rypto_sym_op) + DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_sym_xform)). So substituting IV_OFFSET, len =3D (sizeof(struct rte_crypto_op) + sizeof(s= truct rte_crypto_sym_op) + DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_sy= m_xform)) + MAXIMUM_IV_LENGTH + (sizeof(struct rte_crypto_sym_xform) * 2). Which is a way ahead of the boundary which causes buffer overflow. When memcpy is executed -> rte_memcpy((uint8_t *)op + len, &m_data, sizeof(= m_data)); The m_data will overwrite the beyond the boundary. Hope this clarifies the = need for fix.=20 >=20 > I do not agree with this patch, am I missing something? >=20 > > /* Fill in private data information */ > > rte_memcpy(&m_data.response_info, &response_info, @@ - > 424,7 +424,7 > > @@ test_op_new_mode(uint8_t session_less) > > first_xform =3D &cipher_xform; > > sym_op->xform =3D first_xform; > > uint32_t len =3D IV_OFFSET + MAXIMUM_IV_LENGTH + > > - (sizeof(struct rte_crypto_sym_xform) * 2); > > + (sizeof(union rte_event_crypto_metadata)); > > op->private_data_offset =3D len; > > /* Fill in private data information */ > > rte_memcpy(&m_data.response_info, &response_info, > > -- > > 2.25.1