From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60048.outbound.protection.outlook.com [40.107.6.48]) by dpdk.org (Postfix) with ESMTP id D2FB72BD3 for ; Thu, 14 Mar 2019 08:23:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MKVlTQGXbWB65d8Yvz8sW1rvmSNcq4xg3yIkZJsQfZk=; b=ZUlU3JafWZ1vfsgWwzRFGLUljHqR+dnVkNaVwEwyYe10rK96vN50KXcY0p445RSzMFG+VTtLe6/EmOZdZ3yTrh3EEl78G99kz6eXuFlNwxSmzJZI9SVtlKgNDFr8ajE6+dXyEFdqftzF+4tHLtkdOSQSehnH0t+TjjnJeVTdbLw= Received: from VI1PR05MB4269.eurprd05.prod.outlook.com (52.133.12.22) by VI1PR05MB5168.eurprd05.prod.outlook.com (20.178.10.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.19; Thu, 14 Mar 2019 07:23:31 +0000 Received: from VI1PR05MB4269.eurprd05.prod.outlook.com ([fe80::55ef:d19:7985:4c7f]) by VI1PR05MB4269.eurprd05.prod.outlook.com ([fe80::55ef:d19:7985:4c7f%4]) with mapi id 15.20.1709.011; Thu, 14 Mar 2019 07:23:31 +0000 From: Ali Alnubani To: Stephen Hemminger , "dev@dpdk.org" CC: Thomas Monjalon , Shahaf Shuler Thread-Topic: [dpdk-dev] [PATCH] ethdev: check for invalid device name Thread-Index: AQHU2DZ23QBxdSt0qEOv6tI7Riw9aqYKvD1A Date: Thu, 14 Mar 2019 07:23:31 +0000 Message-ID: References: <20190311181544.15646-1-stephen@networkplumber.org> In-Reply-To: <20190311181544.15646-1-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=alialnu@mellanox.com; x-originating-ip: [82.213.2.186] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 55bdb335-a9b6-4e65-f186-08d6a84df661 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB5168; x-ms-traffictypediagnostic: VI1PR05MB5168: x-ms-exchange-purlcount: 2 x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; VI1PR05MB5168; 23:wCMDr88Sr79uktN0eKlb3iGhhkGTlg4PruHC7GCn/?= =?us-ascii?Q?m1kV1ohXfXHf2mCac4BboEdjcpmSF3x6WJHM8jv1EUPGtNNbN1QneBUJTALt?= =?us-ascii?Q?IW2x/9SWjtJ9Jt6FTk61/YsZX34nxUQJdMAzGnB3BTugeGpu6de4ECBBJ2W+?= =?us-ascii?Q?/7dzSeSaTQzD0TYhHSg8sNbIJJSx22oAqRYH8S0Imd/N8gi3wutyyXOIEAeC?= =?us-ascii?Q?tOH8pUOIHr0GaLsgP5A3LdPJBgECSrfRvgtrqNe5GW1OWuc2K4imwuvwLu/Z?= =?us-ascii?Q?596aG6S86e2h63nX1c0Wq3sTTicvxr3SjH76S7fgcUz/poPYbTzUhIpUwMRq?= =?us-ascii?Q?aqYzuZrvCS1ra9AaQQhUkzRV34grtByVqlB8Y3e5F2wleN28AnhPx8TMdtAq?= =?us-ascii?Q?oPjqxfkERheyGYcFlb5QLkoqNSC30evef5JpqCV7pnKSIWdU32yYc/jZzRGL?= =?us-ascii?Q?0ujHPI5HAHKBg93i8akpB+wpClTRXgHjoYMUch/chb+Ls/xEugaaROE623+X?= =?us-ascii?Q?zPrB4El3hD67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+2/SvweKX?= =?us-ascii?Q?UUB7NbUeg=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09760A0505 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(376002)(136003)(346002)(396003)(39860400002)(366004)(199004)(189003)(13464003)(55016002)(81166006)(2906002)(106356001)(9686003)(2501003)(81156014)(66066001)(6246003)(102836004)(53936002)(97736004)(3846002)(5660300002)(86362001)(6116002)(8676002)(6306002)(68736007)(99286004)(52536014)(74316002)(8936002)(105586002)(4326008)(110136005)(54906003)(26005)(76176011)(478600001)(7696005)(186003)(25786009)(305945005)(71200400001)(476003)(71190400001)(6436002)(14454004)(486006)(6506007)(53546011)(107886003)(316002)(7736002)(11346002)(966005)(33656002)(229853002)(446003)(256004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB5168; H:VI1PR05MB4269.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: vTy2tbqgyfu86ailHpfHQiLvslnOIdy4ePATJLxUML2RL4OdI5GiUKzVehRXIqJEywwMgSm4pJIJVlAe60OplLPUFrINHxMTZYyBzccdvGHsmxm0Qrs/EPJgG+NlqxN/6rNYw+j2PSn73flD4jvgWH6nQEAcj70hPx+gMrM5eO0rEBFmPJEUMfMVXyDHCykYlX2c7bqecLm5AV6YbxQTfDRqY6eE7x+6vd01i0j9gzNGaQ4aTXmavXw5luokW73IpsjtvdYhWDbNpyYf2YzAT7bPpNiB8qQ/zsZdg8oN1P7YpvLcUUF0zWCxhVPvVIIo0D9+mSyw/nre6wLfMKECmIzSVth5HMRg2KCk7Lalk0huo7JrTBhegCrAsFq9QCr2rbgCk2OIL3SwAw3TxkBMqm6l6mM2bW3Jd3le+mYtfWg= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55bdb335-a9b6-4e65-f186-08d6a84df661 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Mar 2019 07:23:31.8625 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5168 Subject: Re: [dpdk-dev] [PATCH] ethdev: check for invalid device name X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2019 07:23:34 -0000 Hi Stephen, I see failures in performance tests caused by this patch: http://mails.dpdk.org/archives/test-report/2019-March/076705.html http://mails.dpdk.org/archives/test-report/2019-March/076704.html After applying your patch, the devices will not be probed: ''' Zero length Ethernet device name net_mlx5: can not allocate rte ethdev net_mlx5: probe of PCI device 0000:12:00.1 aborted after encountering an er= ror: Cannot allocate memory EAL: Requested device 0000:12:00.1 cannot be used testpmd: No probed ethernet devices ''' Testpmd command: ./x86_64-native-linuxapp-gcc/build/app/test-pmd/testpmd -c 0x3 -n 4 -w 12:0= 0.0 -w 12:00.1 -- --txd=3D256 --rxd=3D256 -i > -----Original Message----- > From: dev On Behalf Of Stephen Hemminger > Sent: Monday, March 11, 2019 8:16 PM > To: dev@dpdk.org > Cc: Stephen Hemminger > Subject: [dpdk-dev] [PATCH] ethdev: check for invalid device name >=20 > Do not allow creating a ethernet device with a name over the allowed > maximum (or zero length). This is safer than silently truncating which is= what > happens now. >=20 > Signed-off-by: Stephen Hemminger > Acked-by: Andrew Rybchenko > --- > v1 - previously sent as RFC >=20 > lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 85c1794968dd..0b81980ff71c 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -439,6 +439,16 @@ rte_eth_dev_allocate(const char *name) > uint16_t port_id; > struct rte_eth_dev *eth_dev =3D NULL; >=20 > + if (*name) { > + RTE_ETHDEV_LOG(ERR, "Zero length Ethernet device > name\n"); > + return NULL; > + } > + > + if (strnlen(name, RTE_ETH_NAME_MAX_LEN) >=3D > RTE_ETH_NAME_MAX_LEN) { > + RTE_ETHDEV_LOG(ERR, "Ethernet device name is too > long\n"); > + return NULL; > + } > + > rte_eth_dev_shared_data_prepare(); >=20 > /* Synchronize port creation between primary and secondary > threads. */ > -- > 2.17.1 Regards, Ali From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 22A7AA0096 for ; Thu, 14 Mar 2019 08:23:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E4AA374E; Thu, 14 Mar 2019 08:23:35 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60048.outbound.protection.outlook.com [40.107.6.48]) by dpdk.org (Postfix) with ESMTP id D2FB72BD3 for ; Thu, 14 Mar 2019 08:23:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MKVlTQGXbWB65d8Yvz8sW1rvmSNcq4xg3yIkZJsQfZk=; b=ZUlU3JafWZ1vfsgWwzRFGLUljHqR+dnVkNaVwEwyYe10rK96vN50KXcY0p445RSzMFG+VTtLe6/EmOZdZ3yTrh3EEl78G99kz6eXuFlNwxSmzJZI9SVtlKgNDFr8ajE6+dXyEFdqftzF+4tHLtkdOSQSehnH0t+TjjnJeVTdbLw= Received: from VI1PR05MB4269.eurprd05.prod.outlook.com (52.133.12.22) by VI1PR05MB5168.eurprd05.prod.outlook.com (20.178.10.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.19; Thu, 14 Mar 2019 07:23:31 +0000 Received: from VI1PR05MB4269.eurprd05.prod.outlook.com ([fe80::55ef:d19:7985:4c7f]) by VI1PR05MB4269.eurprd05.prod.outlook.com ([fe80::55ef:d19:7985:4c7f%4]) with mapi id 15.20.1709.011; Thu, 14 Mar 2019 07:23:31 +0000 From: Ali Alnubani To: Stephen Hemminger , "dev@dpdk.org" CC: Thomas Monjalon , Shahaf Shuler Thread-Topic: [dpdk-dev] [PATCH] ethdev: check for invalid device name Thread-Index: AQHU2DZ23QBxdSt0qEOv6tI7Riw9aqYKvD1A Date: Thu, 14 Mar 2019 07:23:31 +0000 Message-ID: References: <20190311181544.15646-1-stephen@networkplumber.org> In-Reply-To: <20190311181544.15646-1-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=alialnu@mellanox.com; x-originating-ip: [82.213.2.186] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 55bdb335-a9b6-4e65-f186-08d6a84df661 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB5168; x-ms-traffictypediagnostic: VI1PR05MB5168: x-ms-exchange-purlcount: 2 x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; VI1PR05MB5168; 23:wCMDr88Sr79ukt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jcfrIKCL5PQg3hea+HdyY7FDnFrqQs0HIFvMCeS/WI2p3?= =?us-ascii?Q?QS6dvC7MqcT6/jcsRyhFl6qwOQLOCzgy5SNWYNPKkfIfRhaoqGiGLUc3vh8d?= =?us-ascii?Q?rbgorpPSHakY7pfXz/a5i9AGMsIq5d2ZeAdB6sFf2IcnG9CWPcoLmK3J+ryb?= =?us-ascii?Q?4vm8v88uMFWXVBzzXaQ0E4p49+O6cNfMsXZOFdeyy6ne8hzFOa5BIRkFFNhA?= =?us-ascii?Q?epPbaETA4Yi0T2mFcyTACAoUZTSbsEph6fsN3mcpFFMahFL+tf9Ev/3a8ddN?= =?us-ascii?Q?p9sHdaXjMhJR52zNxAWOoj1XM/soKBerpufEHEW3s9eFnnikc6BbvCy2xwO/?= =?us-ascii?Q?U5XEqrPumGRtxYwJDtxWsdrVBMV4xbfahs2kg7gt2FD4DJLAszqLxHbxWprZ?= =?us-ascii?Q?1gf6rY6MaqL4Eziwb3a55lfMVycOFwoKzwy4z1dUbV1IeJBGoGVv6Sqadp4O?= =?us-ascii?Q?iOIVXiHDLUnqZfCrFenOxdgFNSTaUrhHDXsyTX8uhugoFitvX5G+2/SvweKX?= =?us-ascii?Q?UUB7NbUeg=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09760A0505 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(376002)(136003)(346002)(396003)(39860400002)(366004)(199004)(189003)(13464003)(55016002)(81166006)(2906002)(106356001)(9686003)(2501003)(81156014)(66066001)(6246003)(102836004)(53936002)(97736004)(3846002)(5660300002)(86362001)(6116002)(8676002)(6306002)(68736007)(99286004)(52536014)(74316002)(8936002)(105586002)(4326008)(110136005)(54906003)(26005)(76176011)(478600001)(7696005)(186003)(25786009)(305945005)(71200400001)(476003)(71190400001)(6436002)(14454004)(486006)(6506007)(53546011)(107886003)(316002)(7736002)(11346002)(966005)(33656002)(229853002)(446003)(256004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB5168; H:VI1PR05MB4269.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: vTy2tbqgyfu86ailHpfHQiLvslnOIdy4ePATJLxUML2RL4OdI5GiUKzVehRXIqJEywwMgSm4pJIJVlAe60OplLPUFrINHxMTZYyBzccdvGHsmxm0Qrs/EPJgG+NlqxN/6rNYw+j2PSn73flD4jvgWH6nQEAcj70hPx+gMrM5eO0rEBFmPJEUMfMVXyDHCykYlX2c7bqecLm5AV6YbxQTfDRqY6eE7x+6vd01i0j9gzNGaQ4aTXmavXw5luokW73IpsjtvdYhWDbNpyYf2YzAT7bPpNiB8qQ/zsZdg8oN1P7YpvLcUUF0zWCxhVPvVIIo0D9+mSyw/nre6wLfMKECmIzSVth5HMRg2KCk7Lalk0huo7JrTBhegCrAsFq9QCr2rbgCk2OIL3SwAw3TxkBMqm6l6mM2bW3Jd3le+mYtfWg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55bdb335-a9b6-4e65-f186-08d6a84df661 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Mar 2019 07:23:31.8625 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5168 Subject: Re: [dpdk-dev] [PATCH] ethdev: check for invalid device name X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Message-ID: <20190314072331.Amp7ALVtfkcKazruEvzx58l2Z7-oEz_noKGcZMk8Lug@z> Hi Stephen, I see failures in performance tests caused by this patch: http://mails.dpdk.org/archives/test-report/2019-March/076705.html http://mails.dpdk.org/archives/test-report/2019-March/076704.html After applying your patch, the devices will not be probed: ''' Zero length Ethernet device name net_mlx5: can not allocate rte ethdev net_mlx5: probe of PCI device 0000:12:00.1 aborted after encountering an er= ror: Cannot allocate memory EAL: Requested device 0000:12:00.1 cannot be used testpmd: No probed ethernet devices ''' Testpmd command: ./x86_64-native-linuxapp-gcc/build/app/test-pmd/testpmd -c 0x3 -n 4 -w 12:0= 0.0 -w 12:00.1 -- --txd=3D256 --rxd=3D256 -i > -----Original Message----- > From: dev On Behalf Of Stephen Hemminger > Sent: Monday, March 11, 2019 8:16 PM > To: dev@dpdk.org > Cc: Stephen Hemminger > Subject: [dpdk-dev] [PATCH] ethdev: check for invalid device name >=20 > Do not allow creating a ethernet device with a name over the allowed > maximum (or zero length). This is safer than silently truncating which is= what > happens now. >=20 > Signed-off-by: Stephen Hemminger > Acked-by: Andrew Rybchenko > --- > v1 - previously sent as RFC >=20 > lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 85c1794968dd..0b81980ff71c 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -439,6 +439,16 @@ rte_eth_dev_allocate(const char *name) > uint16_t port_id; > struct rte_eth_dev *eth_dev =3D NULL; >=20 > + if (*name) { > + RTE_ETHDEV_LOG(ERR, "Zero length Ethernet device > name\n"); > + return NULL; > + } > + > + if (strnlen(name, RTE_ETH_NAME_MAX_LEN) >=3D > RTE_ETH_NAME_MAX_LEN) { > + RTE_ETHDEV_LOG(ERR, "Ethernet device name is too > long\n"); > + return NULL; > + } > + > rte_eth_dev_shared_data_prepare(); >=20 > /* Synchronize port creation between primary and secondary > threads. */ > -- > 2.17.1 Regards, Ali