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 5A27AA034F; Tue, 8 Jun 2021 12:27:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DEBA24067A; Tue, 8 Jun 2021 12:27:02 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 8D5024013F; Tue, 8 Jun 2021 12:27:01 +0200 (CEST) IronPort-SDR: gA27ReYcDaXWhlmbLrZsDIa0jkLar89G4SWT0k1vuoGAuYzqvg7lkq9BvnxHcvMN75yJf1c+ol VN5txMqv69Ug== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="290445600" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="290445600" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 03:27:00 -0700 IronPort-SDR: XirCERsPGfzg7ZlYotwFvRMJLOFA8opKXEcnc7ls0DbKIe95Q6rI3cutwHlOIiGw4tkoFSp4MK PmJDGlXZkzXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="402015794" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga003.jf.intel.com with ESMTP; 08 Jun 2021 03:27:00 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 8 Jun 2021 03:26:59 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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.4 via Frontend Transport; Tue, 8 Jun 2021 03:26:59 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.174) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Tue, 8 Jun 2021 03:26:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ir1ODWrNGeB8ZIOhAoTBoy+17RVYcyWk3HzgkF7RJBXjCQYMNggwXjaLSQukg4olneQcTGyxUSNWV7ndTW+8spc/FSFyvpeqjqC9D5ugJh4nC9GrmO9G71fUa7xLktmKZAhWIGKB4SNrrQkYkoIkEZv4JlOajBpkVvsV8uN+pyIJPCCjYu7I9i8S6XdWzfetVgRO9knXkWvK7l26ZVmUitJ7q22O3e2bunkc7TaumbryTgg9jIpY5lpE7Db9TQDQIOWzRUc37aIGflnHwCv9C4cqT/upSVaPsaJtmDxGdVcI0mLZDFL/ZOvcQGJ0JSRGyzaCOujy0lN/QKtLfEgW5A== 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=uGn5ZHdwBJgqFpxCzuTZBz2CPNNG6dZ8V5TnuweOzdE=; b=DEnQJObCOo3ixkCxHeHWFiobCGi9Zi6slBPZiAWs3RHnk96qcK3goCAQdJ6OCM4d6mOpSLR/JHqL25/Tdne8Mby2R4aJJvSsiitzNmhgb2Y5l8gPxyEfjQ0vIWGWTMBlYbYw9XsPh5er1oVmOb+CtpvhmOpEo0lnZ52PGOshnY03dgBtHXuKuNtusUJLfXuXd7bxfc38WLWI6ooSHPK7pj42Pn5LYJ7xvcCYaqhymiz3s05KueUZbJR80YD6Zb78rIMVdjVEJ9hFH+g7UDR6ElxYJfIigwdxQhfM2+1hKX/HkKi4QCIxJQ9tdnOb6zIEjqZmVUYjWkpeGJJEQW9U8A== 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=uGn5ZHdwBJgqFpxCzuTZBz2CPNNG6dZ8V5TnuweOzdE=; b=oxruzSM42gN8EZK0stWRw1cgiRzs4UiljzfsX6nEx60dA+DXMaLu3XTOy7lwx4mmneuIzTlK+D/F2xK6QOToYSvZUEMF9KVeQJ/3jnbm4L1hVO+VMdpyQmAqf0RoX+hj34xxEWpgTBiALTZzvjKSbZb7ooRXXyjIFUf195jGai0= Received: from DM6PR11MB2796.namprd11.prod.outlook.com (2603:10b6:5:c8::23) by DM6PR11MB3435.namprd11.prod.outlook.com (2603:10b6:5:68::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Tue, 8 Jun 2021 10:26:00 +0000 Received: from DM6PR11MB2796.namprd11.prod.outlook.com ([fe80::d099:834d:f5ad:39c9]) by DM6PR11MB2796.namprd11.prod.outlook.com ([fe80::d099:834d:f5ad:39c9%3]) with mapi id 15.20.4173.037; Tue, 8 Jun 2021 10:26:00 +0000 From: "Dumitrescu, Cristian" To: Andrew Rybchenko CC: "dev@dpdk.org" , Ivan Ilchenko , "stable@dpdk.org" , Andy Moreton Thread-Topic: [PATCH v2] bitmap: fix buffer overrun in bitmap init function Thread-Index: AQHXV5Si8cacHgO9SEKz+sN1T5OSgqsJ8fpw Date: Tue, 8 Jun 2021 10:25:59 +0000 Message-ID: References: <20210602090629.3495940-1-andrew.rybchenko@oktetlabs.ru> <20210602094922.3507384-1-andrew.rybchenko@oktetlabs.ru> In-Reply-To: <20210602094922.3507384-1-andrew.rybchenko@oktetlabs.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=none action=none header.from=intel.com; x-originating-ip: [64.43.28.196] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0e445967-4593-4d87-519a-08d92a67cf78 x-ms-traffictypediagnostic: DM6PR11MB3435: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:660; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tO3KbeeYXNyyfaALr0CuMAMmxRlHkyPLABBDUQvlPVtrEokDVb1vPR41JGB7IeMkvSAKdhramyYa2tAolf7IAjHWc0CxeZ4BKuZ9wn2yEG5Q/M68DO2LnGm3HlxJfPRjd/rWtV69YbXULWHUMdBtJurmTgBp3LzMtJ1jdYnj1hQeoCgSwQLu8n4vxTWnQn0h4G3wqckUFU5dJ3Mx2v896sG3ajd/zJIYPL3PaAnRvf8Nn5yzU+Q2+0LHMTbV4V31B6VuK2tWsiKrg4BY+P7xoe0g4904MSywe2v93CKJIsJpI8e7QwDIl57AVrLFBBzqD+u2sl9EhujtJKL30l5kURpRTJCi29zDKBsrokUNGaZ0nTqPYAM8Aqe4vbAKUn3goCN6K7LVv8WcXFodRc0drUfWvHWNM+muXXsyxQgK+EHrb0o87VzZmUxtsPwrAjcDcMEeKacLliSIfmb14sZP3EGqem+r2Foha3wMIOiIOpWc01LCgT7hG/x8hwMMSw6TdOnPmGF4ZdrI0SKKT2L5d7O8mRwnuiNqfZdiOpJ5SPkXyHeij5bWB693yWAJBERG/y9U2SB7D/GbPDVr+HOfYLParEJIItzSBbtKX0LGYxU= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB2796.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(376002)(346002)(39860400002)(136003)(396003)(26005)(186003)(86362001)(83380400001)(55016002)(33656002)(6916009)(54906003)(316002)(6506007)(2906002)(5660300002)(122000001)(478600001)(71200400001)(38100700002)(4326008)(8676002)(8936002)(9686003)(66556008)(64756008)(66446008)(66946007)(66476007)(7696005)(52536014)(53546011)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hFEQDLWKjcJJ5Y9blCMLip61GmwR//U36Y0InrKSoII6iUbjUS8GcWaGlFCw?= =?us-ascii?Q?/Xyz/UG76bOlqqa/uTttgaXyzotW7ASza7MlC3aLtURqDLMAjShmTqYB0plR?= =?us-ascii?Q?3UqAn89rJ3u3Fy3v28fkb8KUSOor6Kzo70R8s/VCriS9V2l659VXak89iZMq?= =?us-ascii?Q?ST6SckrHyi03nDbyHMObttHZNdD1BHusZbKVrqPZMNWt+mFGieZKsI5oT/JC?= =?us-ascii?Q?j/O4wnQClwSrSQRAm+Gyf2NB+eKf2WFp8wge9xKtgJYM6jMAopSfH6KLjzbP?= =?us-ascii?Q?9OLyW6vdBT3qRNhutlke+3j3+hDsPsR0lhTs0GLpUKkW/Q0S/PivToUBwjmJ?= =?us-ascii?Q?qSDdARBijMlzP0NcjCvjMfON6hqjiKh/uclj1+oxY02uh5GDjZ14DvLrFKhB?= =?us-ascii?Q?RrGYKtE9gWhAH6BPWCuaRMGIBw2DjnAPoUKehDXOGZhkU13vRi1YRrrAXE1Q?= =?us-ascii?Q?ew2rq2kYGkOCzpjrBxG4cTBEpzr+JMlhzd+o1fXGn/IeXWFY2VswBve4bqFb?= =?us-ascii?Q?PIopB6h06THTrzjyIuJK7qO7a+980ppao/qZwClYpTZI3ucLBBrHNIvn9Qtx?= =?us-ascii?Q?58uqzieNWtpfmRBZ64+AMpuXTXqjRxkBwwc8GrM4J1PzM7rfsyxT63+0h3Ob?= =?us-ascii?Q?L78tnI/ZcifAeg6zaPbq8wtYFUv9MrVLXPYLzFP5/rDmv5YUmgEihhZh6wp9?= =?us-ascii?Q?bAjeidxTPF8C7htgN5+C+OzFSAFQiT/K6I3E4eH+z4xfdd7MeDzJyxkqdFNf?= =?us-ascii?Q?LtmGNntbCSGO84/nxwn8MhG8SCkftjmGczSGt5JUBvupeodduTEE1oBt8RgV?= =?us-ascii?Q?c10SCoIua9O+J9NVdH1Zm1YwKv73ITXjWBwk98/vby1onCSfEx5dwpJQRXXW?= =?us-ascii?Q?EVh5E0yKAsU+fDEJmmJdnaSYN0y9Abv+wTSqQxp0v6U5qsAKL6C4OK1Zja6H?= =?us-ascii?Q?Bl2kGaPPxXkVHoO3MyMdq+YhOQAwNdW5p7GHzQPN6tj4GLG5ZH1U//nBIum2?= =?us-ascii?Q?5J8DbDRFrRPLtRW94FDp5R+tz3oSC2DFjGde4hJ2sNT+NnKCVD/vE+ocAGfw?= =?us-ascii?Q?XLTJmikNrXAWiu3o/9RJGuha4DeekouFenPjtY2AyfvmCi325IDANzG1pSiM?= =?us-ascii?Q?UmQa3Ivzb5COXJggi/KlIo/0oLOvSE+Tfl9sDGSM6k0Btx+KmdHV5KphtOmC?= =?us-ascii?Q?8dRp8QU8vzHSt3RJRrgiimXxBG/ViRSuWqdCnmHjx2iQbF4ktd+TNBtfWVQC?= =?us-ascii?Q?CnAdcgDjLHFcPyrfJBAWuLfKBFO4WB5G/+IXUmeDqqScdrzBpgNidnKZbs9+?= =?us-ascii?Q?ga0=3D?= x-ms-exchange-transport-forked: True 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: DM6PR11MB2796.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e445967-4593-4d87-519a-08d92a67cf78 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2021 10:25:59.9633 (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: AoZ7k23NXDluGpaGUVQ5CpEACQIWNYFkfuk7X3fGx0npuERrROrfutELK753XEb989KLVuc89UzN9OrXHZGWt5lu69j9XF2afMSgTq3hMXs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3435 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] bitmap: fix buffer overrun in bitmap init function 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" > -----Original Message----- > From: Andrew Rybchenko > Sent: Wednesday, June 2, 2021 10:49 AM > To: Dumitrescu, Cristian > Cc: dev@dpdk.org; Ivan Ilchenko ; > stable@dpdk.org; Andy Moreton > Subject: [PATCH v2] bitmap: fix buffer overrun in bitmap init function >=20 > From: Ivan Ilchenko >=20 > Bitmap initialization function is allowed to memset() > caller-provided buffer with number of bytes exceeded > this buffer size. This happens due to wrong comparison > sign between buffer size and number of bytes required > to initialize bitmap. >=20 > Fixes: 602c9ca33a4 ("sched: bitmap is now dynamically allocated") > Cc: stable@dpdk.org >=20 > Reported-by: Andy Moreton > Signed-off-by: Ivan Ilchenko > Reviewed-by: Andy Moreton > Signed-off-by: Andrew Rybchenko > --- > lib/eal/include/rte_bitmap.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) >=20 > diff --git a/lib/eal/include/rte_bitmap.h b/lib/eal/include/rte_bitmap.h > index 9e2b8f2cbf..e4623bb176 100644 > --- a/lib/eal/include/rte_bitmap.h > +++ b/lib/eal/include/rte_bitmap.h > @@ -185,9 +185,8 @@ rte_bitmap_init(uint32_t n_bits, uint8_t *mem, > uint32_t mem_size) > size =3D __rte_bitmap_get_memory_footprint(n_bits, > &array1_byte_offset, &array1_slabs, > &array2_byte_offset, &array2_slabs); > - if (size < mem_size) { > + if (size > mem_size) > return NULL; > - } >=20 > /* Setup bitmap */ > memset(mem, 0, size); > -- > 2.30.2 Acked-by: Cristian Dumitrescu