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 22331A0C47; Sun, 18 Jul 2021 11:05:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0E2E406A3; Sun, 18 Jul 2021 11:05:36 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 2BDAB4069D for ; Sun, 18 Jul 2021 11:05:34 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10048"; a="210659379" X-IronPort-AV: E=Sophos;i="5.84,249,1620716400"; d="scan'208";a="210659379" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2021 02:05:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,249,1620716400"; d="scan'208";a="429884773" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga007.fm.intel.com with ESMTP; 18 Jul 2021 02:05:33 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Sun, 18 Jul 2021 02:05:33 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Sun, 18 Jul 2021 02:05:33 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Sun, 18 Jul 2021 02:05:32 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.46) 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.2242.10; Sun, 18 Jul 2021 02:05:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G1yk86Umv2C4OUW/UprjUXk18EcvTP5n6K/VpDMrj6PXWTwYEPEO99Nv/+pUh0AKQq82cwfC7pW0j8MJcv5T3TOnKNYUi1p+d2384qNpF7YW5nMVPQWXAM9oG9hRr3lbuVsK38CsBe7T11lUvzeTWy6RFs5dQt/uRpuTKKMSm81i96EC4I1HFWCIM8aMyFFeooJjYZZb/sg1HRbKhjfWY9gKdUQ4CepRnkjAgMNUuRZ53TI6+Sqp5b8HCdijn01PRfHoQs19j8AjB5srN07iwwnhyq0PzR0kg/tXxpLX/Dwt+JtHTodfo2pbGw3WelSaePqYNXLuU2x0D6IGymlSmw== 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=dK1Csr6BoqtnQlXFa1z83A+RvLsom3cQnr5NnIawEGg=; b=Ywk/fM3OBb9eQe6HmJTvQFBM386i65FEcku9w86QYzHP6t8yK6XGGnhs4/5j8nDlTwQzg7Q1fAFvUfpXUR1/gEZDh4noDf/P03oN7Rm3mVHuF4YMoycIESlR3ekpYs7HAeGbAbkhLQvJpMFS0RTHcfGNACFsbl8dlLYKk3KgwqtKUh7sHFoXWI/PXfFMl8+0vjxh9hgOSSXHymDlzU9c/H+gbPkTZKewCGh4u8WEFQODsA0Lz87Z7HtaMV98p+naTQWFQOtGhvkN8QzJCXChDFsExedwETvlVo0OdA56uRB1HF8jO3CX0snvzJk97+xRzmMlQCa8fOTXmz7ImjnEGA== 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=dK1Csr6BoqtnQlXFa1z83A+RvLsom3cQnr5NnIawEGg=; b=fZG5Q8P8A3QGsHw+UW0ERsPkpj0MUNnqi3/+3wPjXyYwM1tzeQ2mmAYeCuujrrXsqI7EI2LlygAxIPbyM04s8ICrcolOSDsDbXfnQB5urXixayltbRqoystlBKBEKZ+PwZQakSWQJTCslnWzC7inZY7p6iRHb2M+j6Vi8Yre6go= Received: from PH0PR11MB4824.namprd11.prod.outlook.com (2603:10b6:510:38::13) by PH0PR11MB4997.namprd11.prod.outlook.com (2603:10b6:510:31::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Sun, 18 Jul 2021 09:05:31 +0000 Received: from PH0PR11MB4824.namprd11.prod.outlook.com ([fe80::71d4:246:91ea:4df5]) by PH0PR11MB4824.namprd11.prod.outlook.com ([fe80::71d4:246:91ea:4df5%3]) with mapi id 15.20.4331.032; Sun, 18 Jul 2021 09:05:31 +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+7tkfuTf5as3l4eAgAGMzdCAB46GgIAH2aCQ Date: Sun, 18 Jul 2021 09:05:30 +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: 67a58ad4-526b-4721-ac2a-08d949cb31d1 x-ms-traffictypediagnostic: PH0PR11MB4997: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: c5bdrCayO6WZTk7L3Z33iqrRG6sRHrr4NhEwFBJIDRzceyv3o0WTGqNeFNI41zGDP3XwrHeWYoHhRcAf4OWza9VH1cyKr0FnefM+A12mKCfVLSseDBRH/U+KIFvGEIVQj8nvjKKajDLtB3ZFaAtdppcsyD1qeKUlsM8M8qIwi+yoP4TEWD5VzZX2VV5oMqolub8pyCN3HRgFmBvog8/6HG7YoIHMIcVMTcoy7ZIJMsbeH/++1qGDWxWfSnUM3TtX+MZRMPUGwJ52Y6SuEpuAI3ry2nBv/+2Gq2NUTQ6xYxvVx/xgIl01gGgA9+xgMngpGdYifHEucuv/wwVS/IuoWzFcs8ucrgonv/7rO9MdOokfyPPxYUbeEquPIh3M28GTwDDGzXIdRKWngYX3tV3dJrjZwRHY0QXz9O9v+7fUmUY5rAQE3aC7eyaN/bysglnPMLLHUrMrnq9ha7IkQJvJppq7DO12Hy913W5HHS/parxvTpufRqLGTsVMd7r7Xas3KOMfvmy2GtNqAbxV+Bn83Pb7DksxATSANK3UBnx+kj84qfYppdu8kwAwrwcdg4Jzgi6hoI0y4zxHyn6SK7QnQtzADIAcaEHNS6mtFXBvSSaO7MSTYii6n9iz0ow3W2By/JJqxiD8CkxkPvMMYL/dhfUXZ6GjGJ7hLy69X8Eie3k+GO763wz8f587OnSqoEx4ZriUoyUUU8BGOdTVLvprUQ== 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:(4636009)(136003)(366004)(39860400002)(376002)(346002)(396003)(107886003)(9686003)(38100700002)(52536014)(86362001)(122000001)(478600001)(71200400001)(76116006)(55016002)(8676002)(186003)(26005)(7696005)(33656002)(2906002)(64756008)(66446008)(5660300002)(66946007)(55236004)(66476007)(66556008)(53546011)(316002)(110136005)(8936002)(6506007)(83380400001)(4326008)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ssIUydQZuFzNNbaXPcJ5qH4rkKtiIvtw+oYeYnaplxyJYz6BbGhL7bHdJy2m?= =?us-ascii?Q?zcsMKjOd+xMHxxpupy6fM0pNkYOztz7OkCfZmHnM9eWkMqVIRoIzUhzFwBZ5?= =?us-ascii?Q?oRXzL6x2y79BJEQyZ7QEOemJDB93rCGvw392bxuqHa/FGg5xYz7NYq0iPv93?= =?us-ascii?Q?kpx9HFXUts+OPeaOhu7Tu6XhtDzau/Im+hTYs58SD5l4pxWXYNyVv3nCqKot?= =?us-ascii?Q?ZkFO0YSyHeoGuegb3/DlTUgBv2Gx7DDAm9ZsxKE23r37mNA/h7APWPGplOmR?= =?us-ascii?Q?l/Rjc8ecNbjyxXZiL+BcLXGaGA41GCNhoGxVBhneKtNq4AQ9JLU5Ma/VNLcS?= =?us-ascii?Q?MjJT8W3WWO6bjCuRLA4gnT6ssyzjdinI3uAH6AERPpEEvBsxkyxPHY85sLiJ?= =?us-ascii?Q?+kJK/7qwx+sIpUnrbjg3mXwsTImuYCZ20MSfu2eIkOVeLXkWJJplrVnk3Rl9?= =?us-ascii?Q?eum8Skl+xj5lzTP4lr9RHTNeJi2r2390l1E4vPcuiVX7kouI8RTfOsUgjD/x?= =?us-ascii?Q?mgiZcxZ1IgMk9DNc5a/QrZ2sUczWnPDv96fB3+tfhPqZJkBpKbCA2X58gk72?= =?us-ascii?Q?JUtmDiBHUz0Jg/gH6sUjDEzSVZAom86HZk8oQ/8rgA2NuQEVFvdr/4hKwe3s?= =?us-ascii?Q?dRDxYS/pM05qg0qJogoDDsuBg4/glRp1RP/RE1TtefXDJutCQqBWNEHssteh?= =?us-ascii?Q?GHcJPBTCeiHP8F4Vg0ozMaBFJ6Hehwa5/UrVCDJOMaRZiVs/5Lck5F/TTIia?= =?us-ascii?Q?P8RctOQaJ/d1Z8qj3lqpRx7KfHEEAf0x1W558F7CErUetV+b24Pc6wQPkL5I?= =?us-ascii?Q?WPH8vdR7e6amcBtBEeWs8mvaF6bXjfzpPghiUntSUi1MAjeXo4XoodjR5Tqa?= =?us-ascii?Q?/zmBLVzO6yaTPIehxG1I9Qw85az79cOCxR6WYrDCTM/bKd+NCQMAzBdGfFNX?= =?us-ascii?Q?jNRIpcKdhn9Io4r/st0Vff8JvVistO57d58Cj72MQnmtm0hZ2ypqYCkZWm62?= =?us-ascii?Q?sPu6DTIYjoI4tRbL9MDGrHy6Ey/kfUjn8PEtS1vWnBW0EM+dlG2Qn2tLeXht?= =?us-ascii?Q?ssLzA+sGjasJYFU9yftfz6wH9svghYDOKbOZFshdHGuuXOQFwouG3IczIft6?= =?us-ascii?Q?yIMjOaTmjWESbZUtWRGDjZEfW4BGEgaL8sB4X1nJML8LsPJ+zKXz1ta16QOy?= =?us-ascii?Q?XKF2SHfmHUeGF3ql+0bhfSYvnGKMXyb1n1hifD2qshSRYOJtObG7BLu/7tAR?= =?us-ascii?Q?pnVmSexoJSediQ5MPwxicmjy/8jX+1XYIF13qYC7gunrt5NwNZofhAbLYRZ2?= =?us-ascii?Q?hmU=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: 67a58ad4-526b-4721-ac2a-08d949cb31d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jul 2021 09:05:31.1902 (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: DItjmVLr+ervjTisLMwpEECtbaZw+TX9bqoTyYZ+UZoKiNVPlJwTuzWx5SA4mWeh9uwLB6JVM6Kgcxi4rGllZK3IEGedALoSzkyMVa45yjc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4997 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: Tuesday, July 13, 2021 2:42 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, > > > > > > > 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_autotest() > > RTE>>event_crypto_adapter_autotest > > + ------------------------------------------------------- + + Test > > Suite : Event crypto adapter test suite > > CRYPTODEV: Creating cryptodev crypto_nullCRYPTODEV: Initialisation > > parameters - 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 > > changing > > > the offset value. > > > > > > 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 > * > > sizeof(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_crypto_sym_op) + DEFAULT_NUM_XFORMS * sizeof(struct > > rte_crypto_sym_xform)). > > > > So substituting IV_OFFSET, len =3D (sizeof(struct rte_crypto_op) + > > sizeof(struct > > rte_crypto_sym_op) + DEFAULT_NUM_XFORMS * sizeof(struct > > rte_crypto_sym_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 > You are setting len =3D sizeof(rte_crypto_op) + sizeof(rte_crypto_sym_op)= + 2 > *(sizeof(xform)) + IV_LEN + m_data_len And then copying mdata at end of > 'len', which is not correct. Here, len already include mdata and you are > copying mdata after its designated space. Right? > IMO, len should be set as IV_OFFSET+IV_LEN only. Agree. I will update the changes in the next patch. >=20 > > > > > > I do not agree with this patch, am I missing something? > > > > > > > /* 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