From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30041.outbound.protection.outlook.com [40.107.3.41]) by dpdk.org (Postfix) with ESMTP id 7B532FFA; Wed, 30 Aug 2017 08:11:55 +0200 (CEST) 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; bh=Q6LOZhufKDdUVYCNmWQAzF659RfIGmYdRC4ihVTHaO0=; b=nCdtcRrdcogbiCGSAD3PqvRhuHFY6Psj3b3+w4Tv//b/R9GEMcrssKZVt8thJHvQDKvm4Bzc46uYnOzpiL4tdzaqtd2KboUUg1r5v1ioTOuVJZd/LW4LZ77MZ3Xqvy0nbpGtdv2AssWpu6RWH8E+QRNg+XFzmK1RypewHp6gFOk= Received: from DB6PR0502MB3048.eurprd05.prod.outlook.com (10.172.250.136) by DB6PR0502MB3048.eurprd05.prod.outlook.com (10.172.250.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Wed, 30 Aug 2017 06:11:47 +0000 Received: from DB6PR0502MB3048.eurprd05.prod.outlook.com ([fe80::e938:efe9:effc:7ef8]) by DB6PR0502MB3048.eurprd05.prod.outlook.com ([fe80::e938:efe9:effc:7ef8%14]) with mapi id 15.01.1385.014; Wed, 30 Aug 2017 06:11:47 +0000 From: Matan Azrad To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: "dev@dpdk.org" , Raslan Darawsheh , "stable@dpdk.org" Thread-Topic: [PATCH] net/failsafe: fix exec parameter parsing error flow Thread-Index: AQHTIOSZ0QRNWhqwGkGaxALU1E3A3qKcZV0Q Date: Wed, 30 Aug 2017 06:11:47 +0000 Message-ID: References: <1504018748-4766-1-git-send-email-matan@mellanox.com> <20170829163339.GP8124@bidouze.vm.6wind.com> In-Reply-To: <20170829163339.GP8124@bidouze.vm.6wind.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0502MB3048; 6:5Da5CqCSe3ZbosQ3SVKelA0kKD+wm3TpF6c64mOJr4dNEuZNt5Wzo3Ssy1SGgSM22XBLDudzvmM0KN2MZk2bexx8asnaF8lF2HUzFbkow0RZbRhE13VHOF47sOccvNJlcJ9cb2S5VRUfAI1yp4Pr4qq5VZyxnN8fsKx5iybiFTBwL3dUi0KcVXdZfBogRNJoc4gnUOD7+tqayMwAyrExmOA/mBe98k1PR+y905bYf9KkiIiCm1WTo1NH7ewhg9akFVpUPnKakLmSgGAafwB5rWXngmvRgh/jxd3j39WtphoNss1v66P532cJ381MlSbLsqS8853U3hbTJbt7YFiGsg==; 5:IwQcJHsKkkMYpk/KRVFhbsKzfEIvTbI7PbCnsSVwcVVlOiHkfHPSIMdj8ohBf+KD6K+5eWpyfAiyFwM31LgtWmH3Hv2y+7HjAC76QakzGjPmwSX9Y0hKxa9drA1Ip5UaUTRCabnijk7hzFtbtFQkOg==; 24:Cuku/NGVHVcnzzBwfWUO0lXkOwiwtL0t2Al7+hpJHrh7Dfh1usHiows4qULCTRjgBv5Zf17pkm7XHYKdU9AGrbj3VbTWHGWgzCeYTKfp5hk=; 7:6q7xKm0s5Dr6Mh7IeKJrHdAaxmWNkw5Y9QgRZecTKnsT4oE2XqD9i2bxG6y2/B+D+5jkhqqUQM58KcVykTKfxAYKB9KS4+tp+vJ/ulAIkRGBaHJItMpkWUp//GltkFCUmIR1AFlzZTFbaLPzDUKNpMkISI7htJVg+OMNPSb9+0OyTV+VLWDCFicqFkX1m2DDYO7oSR6SYuqOwtKU63sqUJh6ItzsMEBEN8d++eyE7b0= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: e12cb670-adbc-4ae9-c5b2-08d4ef6dff4c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DB6PR0502MB3048; x-ms-traffictypediagnostic: DB6PR0502MB3048: x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(20161123564025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0502MB3048; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0502MB3048; x-forefront-prvs: 041517DFAB x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(24454002)(13464003)(377454003)(189002)(199003)(478600001)(3280700002)(50986999)(54906002)(9686003)(101416001)(76176999)(99286003)(55016002)(54356999)(53936002)(7696004)(3660700001)(8936002)(8676002)(81156014)(81166006)(189998001)(229853002)(74316002)(5660300001)(6436002)(2906002)(6506006)(7736002)(2900100001)(305945005)(33656002)(2950100002)(6916009)(66066001)(53546010)(105586002)(68736007)(106356001)(14454004)(102836003)(4326008)(3846002)(5250100002)(110136004)(25786009)(97736004)(86362001)(6246003)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0502MB3048; H:DB6PR0502MB3048.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Aug 2017 06:11:47.8683 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0502MB3048 Subject: Re: [dpdk-stable] [PATCH] net/failsafe: fix exec parameter parsing error flow X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2017 06:11:55 -0000 Hi Gaetan > -----Original Message----- > From: Ga=EBtan Rivet [mailto:gaetan.rivet@6wind.com] > Sent: Tuesday, August 29, 2017 7:34 PM > To: Matan Azrad > Cc: dev@dpdk.org; Raslan Darawsheh ; > stable@dpdk.org > Subject: Re: [PATCH] net/failsafe: fix exec parameter parsing error flow >=20 > Hi Matan, >=20 > On Tue, Aug 29, 2017 at 05:59:08PM +0300, Matan Azrad wrote: > > The corrupted code returns success value in case of the execution > > process output stream is empty(EOF). > > It causes to segmentation fault while failsafe polls this command line > > again, than gets success and tries to do hotplug add to the sub device > > by uninitialized pointer dereferencing. > > >=20 > This is a bug and should be fixed, thanks. >=20 > > Morever, when the output is not empty but uncorrect, failsafe returns > > error for its probe function while the expected behavior is to do > > polling until the output is correct. > > >=20 > The expected behavior is for the fail-safe to return an error if the exec= ution > of the given command returns an error. >=20 > The intention is that users writing such script would be able to output a= blank > lines in case there is nothing to probe, but still remain aware of issues= during > the execution of the command. >=20 > The fail-safe ignores errors pertaining to absent devices due to its natu= re. > This does not mean that it should ignore all errors and try to keep on go= ing > while everything else is on fire. >=20 > The contract with the user is that "blank line" without other errors mean= s > "absent device". Garbled output or return code !=3D 0 means runtime error > and should be thrown to the user / application. >=20 OK, good, I would have signed this contract :) What's about if the parsing is not empty and out with error in the polling = process? I think in current code failsafe just continues normally and tries again on= next polling time. Because of this code I thought that if error occurs we should poll it again= ... Can you please add it (the contract) in failsafe documentation for exec par= ameter? > > The fix changes the return value to be -ENODEV for this sub device in > > the two cases. > > By this way, failsafe tries to parse this sub device parameter by exec > > method until the output is correct. > > >=20 > The issue is that this portion of the code will be heavily modified anywa= y. The > errno handling is erroneous and must be fixed, which is in conflict with = your > patch. >=20 > I will send the intended fix shortly, referencing this patch and the issu= e your > highlighted, but both patch won't be compatible. >=20 Good, no problems. > > Fixes: a0194d828100 ("net/failsafe: add flexible device definition") > > Fixes: 35ffe4208140 ("net/failsafe: fix missing pclose after popen") > > Cc: stable@dpdk.org > > > > Signed-off-by: Matan Azrad > > --- > > drivers/net/failsafe/failsafe_args.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/failsafe/failsafe_args.c > > b/drivers/net/failsafe/failsafe_args.c > > index 645c885..61c55df 100644 > > --- a/drivers/net/failsafe/failsafe_args.c > > +++ b/drivers/net/failsafe/failsafe_args.c > > @@ -157,12 +157,16 @@ fs_execute_cmd(struct sub_device *sdev, char > *cmdline) > > ret =3D fs_parse_device(sdev, output); > > if (ret) { > > ERROR("Parsing device '%s' failed", output); > > + ret =3D -ENODEV; Remove the above line for probe function error report. > > goto ret_pclose; > > } > > ret_pclose: > > pclose_ret =3D pclose(fp); > > if (pclose_ret) { > > - pclose_ret =3D errno; > > + if (errno =3D=3D 0) > > + errno =3D -(pclose_ret =3D ret); > > + else > > + pclose_ret =3D errno; > > ERROR("pclose: %s", strerror(errno)); > > errno =3D old_err; > > return pclose_ret; > > -- > > 2.7.4 > > >=20 > Best regards, > -- > Ga=EBtan Rivet > 6WIND Thanks, Matan Azrad