From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0064.outbound.protection.outlook.com [104.47.38.64]) by dpdk.org (Postfix) with ESMTP id CE5C22BC9 for ; Tue, 15 May 2018 12:31:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rBRLIy0YjcwYVFtE/sZ9PUC7EeGUUdRD0ADn0Cy/9t4=; b=fryK6UgtkUrIRDGClTpjeADgZIjpR0JjZzgo8QvfT07mNUSITcCjuv9WR0RwLLwa86SGx6E3nVog5jUGo0pG2V+AqzDEi8+nc4/0e1NDp4U5vXpgRomkds40Jn6GgrPjR/W8aTfioHR0T8M1VvywCsOs6w6HEX+O6KZ7C5TmYMw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (111.93.218.67) by CO2PR07MB2519.namprd07.prod.outlook.com (2603:10b6:102:13::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Tue, 15 May 2018 10:31:46 +0000 Date: Tue, 15 May 2018 16:01:31 +0530 From: Jerin Jacob To: Andy Green Cc: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com, Pablo de Lara Message-ID: <20180515103130.GA14446@jerin> References: <20180515100335.13051-1-jerin.jacob@caviumnetworks.com> <54ecbab4-185e-2da6-8733-f40cc0648aa1@warmcat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54ecbab4-185e-2da6-8733-f40cc0648aa1@warmcat.com> User-Agent: Mutt/1.9.5 (2018-04-13) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BMXPR01CA0003.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:d::13) To CO2PR07MB2519.namprd07.prod.outlook.com (2603:10b6:102:13::6) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CO2PR07MB2519; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2519; 3:4hc7WGxT02wDBCwaWTjil5K0Y3GXbWDZ8dsjRgaL/nZH00WaoZelzLFSJNUlW6LfLHWlvRaJHlMBBnZSuQHZC9Uo1jscScTQZ+hiZaAgftWdGyJezA4v1UwAtl3IocStWWKzcugMI9Ny/laQwAgZNOvqSIfNKbNZsg8TbqUEKVkiYoM4QcGBwLFavbdG3OaWmMaGbiwcDLnbWzCWhg4gsmLgyFD2oBkMMGOvpu6KBH5Ape/gcKsno9W2PmS0TEtG; 25:PWaK+0La2AAogErP1b2BiApQ5cvROYCRoU1Wjyd/XvPu5Cr9mqWQu8keNZ4SXAZPipiRrDuzeKYHBN2KV1zCEkHdmbs9MKxGkCILYYthV6IkfGn527CLGQHYVpZF4c/xpyCiPjIvpOqwP2Gv2RjSnQFDxY5lfj+eMqicH8EQJYYT1M7JedRSQkk+3R+5DXzZ1omfTcFtfEDY0qFeqO1rsLVNZIPf+49nsKRbReGqeBkLqDx7d7Ntqfkte5AgBg6IHj8ciDMQsIRI7/d5dq8boFLEat+iM/AEesEKPKAYXME08DHuXYREVEvTMcOJcU0vjGIOXdQvbHUmV4guefZkbw==; 31:BUwCiGEr7aSaQEWrDIMjCCv/1JqWckFJOFE3evZv/UMsf9ZGcv6KezlxVc7mzLpamhEqqOYAeYf/3doHPVsXpBUKQcabRVpvQPqFVh4S6BRoChvPhQZ2oI2tJ7l3np+qWQp3ICeF3oKVQLdpE90WucqbPIdCBMPREw02ZHUbK4S6516+3xlkp1pNB6vvC8rcKMCwG3cY4lUNpzf5kRwyV4gAGxwyYidDT6huOc4t2Sg= X-MS-TrafficTypeDiagnostic: CO2PR07MB2519: X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2519; 20:0cQH1I61mfgXdd3kAEP+xQig01pSjKasmROPuGYHd/giHATTj70iRaZd3EYq3SAgNSvUuVkkUjZHtkTZLfI7STV+bf5MyREK0Mbbg+/MduWbJdj2UKtaJGISMa1iABjHOsfeSqXmDxpau1J+PVWa2+3O+l02TazzudmBagyTWIgIevYYKfi2YOqJ7VCyDnBxcvcs+BXsRKpcfqgYhi1uooGzcjv6QXbLYpcGT+gzpC2d2ULuIz8hHmR2fMSz4oJ5LolLY/M5CVmOZscuhDtmdFUKq12KIWs8Dqtd5+6SXlh8fi4wQG0PB1dxA8RpwMqxpKLXdIbz7KIawJF+QEGbuaBeihCkpgx+oKrYiaGNNc6Og/TeM8xMavcikYiBE3VL1urGEgczGr5RCoY+wVq1MUSRc9+jkxxhkS+8PA9yrQnPRKP3U5ZSL/XoN+74M4Ic6x5qSRAEGVIzoyHp6Xauwbo/Cx4t+5lFm2HebdzgxAEpZNEJWwZ1UQJO8eSdO21NdHFP0hPZt7URHEJU222Wc6sKK/t7wuDlh6U+ioEJo7cvhNJM9YdhD/RhJXh/yPO/g7oCTst5Cp+3PedW0O/hh15lYXbOYepWcFgR9ZDRQs0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(10201501046)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CO2PR07MB2519; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2519; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2519; 4:E6hyhC0zB4E3aZ4HHObDji0E/O4gyheLPhqyCb1kt63wEI8dpCnBLLJUDDGS9GgPL4ZZveXhFOGtii/3uiLZUHxu6ZD4IYkgvbrgw2JWvWSszKbHoyQXVzVnUT4/bSGnT/Thx5vHOx5txuvDqFBc5rRTM4BK3OWeehfz/aK1m1C6OT+46MsSkecWH5welZrijXIdRiJSDhVfbRrQI1S1xL/Xnb2bYdRwweIeUBZFQmV3CqVGRtHHA8TSou08SuG9LDflY2XRJcRIqLR3K/Ykp6kccL7F3SD2XVXqF7BQkxpjc8pT6BYAW7EaePQPKKSpiKwzdZTOs3i4EvSNyCYzYuhsQle8doyTAocKLip5jy0= X-Forefront-PRVS: 0673F5BE31 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(396003)(39830400003)(346002)(376002)(366004)(39380400002)(13464003)(199004)(189003)(6496006)(53546011)(53936002)(1076002)(2870700001)(6246003)(26005)(33656002)(25786009)(76176011)(68736007)(4326008)(33896004)(52116002)(59450400001)(316002)(55016002)(52146003)(2486003)(58126008)(105586002)(33716001)(9686003)(23676004)(106356001)(47776003)(66066001)(6916009)(386003)(6666003)(7736002)(8936002)(6116002)(3846002)(81156014)(8676002)(81166006)(16526019)(50466002)(305945005)(229853002)(2906002)(97736004)(5660300001)(446003)(5009440100003)(476003)(956004)(186003)(72206003)(42882007)(478600001)(486006)(44832011)(11346002)(18370500001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB2519; H:jerin; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDTzJQUjA3TUIyNTE5OzIzOnRjTnBTSHcrMFVDM3ZEaUhyaWtGZ2dYWHc5?= =?utf-8?B?QWNZUUNYb0pBQzZzeEk4SDFZcjVUZTdXTVlnTlVlT2pzWGZJWXJuNHhUalRV?= =?utf-8?B?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ms1DvwU9FSWeyd2bw0uvhGX7dDan4FQlG9xPnnK0WfQC38fx9kBrTc+5jCH3y2xjP+DQqsb/EejDMBQZQyVlQmSnN8w0=; 24:Bv5M3Qw0YB+ipEx3TGxN8DbM/5rXr3ogGW8PL+PHbmvidR2WjHTQw/26PqTm7Igov4fMOrTJKw0t4B84WVZO+Gh9n458TGIuiV7xhU0Brfg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2519; 7:KrxZJE8Qiu4E0D4wpyVmiV6vEJqvmK3rwuEot5bbT+5BHoOCZBgT2mfxNewlqFqxQwktPTihSEFnVE0KWFPNEr1uY29K/sz2oidU193MwEPNkPLDPTIm9g/ZrzPtwpSkHuQtcx/s6EkRNYOYYb7a7HOoBCGvumgfoyVIVVCx/jXffY+B2nYuQfvgiM6eY+Mh0gHjtdRVLMzzZyPdnrobW7lfwiP6QnXTy3+bphmbdGdeptRZ0i7isHqoJmKGYJJz X-MS-Office365-Filtering-Correlation-Id: d80f1b3c-827c-4b1a-55c5-08d5ba4f10be X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2018 10:31:46.6697 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d80f1b3c-827c-4b1a-55c5-08d5ba4f10be X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2519 Subject: Re: [dpdk-dev] [PATCH] bus/pci: fix driver name string manipulation 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: Tue, 15 May 2018 10:31:52 -0000 -----Original Message----- > Date: Tue, 15 May 2018 18:19:19 +0800 > From: Andy Green > To: Jerin Jacob , dev@dpdk.org > CC: thomas@monjalon.net, ferruh.yigit@intel.com, Pablo de Lara > > Subject: Re: [dpdk-dev] [PATCH] bus/pci: fix driver name string manipulation > User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 > Thunderbird/52.7.0 > > > > On 05/15/2018 06:03 PM, Jerin Jacob wrote: > > sizeof(dri_name) is 8B on 64Bit systems.The intended operation is coping > > the string after '/' from the string `name`. > > > > This bug is not letting to probe any device string >8B hence results in > > the testpmd error("No ethernet devices found) on some PMDs. > > You are right... but... > > > Cc: Andy Green > > Cc: Pablo de Lara > > > > Fixes: fe5f777b538 ("bus/pci: replace strncpy by strlcpy") > > > > Signed-off-by: Jerin Jacob > > --- > > drivers/bus/pci/linux/pci.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c > > index a73ee49c2..cd45875b1 100644 > > --- a/drivers/bus/pci/linux/pci.c > > +++ b/drivers/bus/pci/linux/pci.c > > @@ -54,7 +54,7 @@ pci_get_kernel_driver_by_path(const char *filename, char *dri_name) > > name = strrchr(path, '/'); > > if (name) { > > - strlcpy(dri_name, name + 1, sizeof(dri_name)); > > + strlcpy(dri_name, name + 1, strlen(name)); > > ... this fix is no good. The underlying problem is the length of dri_name > is not getting passed into this function... it just doesn't know how much of > dri_name is safe to use. Telling it to use the strlen() of something > unrelated is going to make buffer overflows possible. In this case, already there is a check for following in the code. So it is fine either way. path[count] = '\0'; name = strrchr(path, '/'); > > I sent a patch to the list a few hours ago that amends this function to take > the allocated length of dri_name, and sets the limit for the strlcpy() to > that, so no matter what turns up in name it's not possible to blow past > dri_name allocation. > > [dpdk-dev] [PATCH] bus/pci: correct the earlier strlcpy conversion​ I am fine with taking any of the of the patch. Please improve the patch subject and bug description in case if you prefer to take your original patch. > > -Andy > > > return 0; > > } > >