From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id C797D1B230; Mon, 2 Oct 2017 16:08:11 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Oct 2017 07:07:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,469,1500966000"; d="scan'208";a="1226061122" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by fmsmga002.fm.intel.com with ESMTP; 02 Oct 2017 07:07:46 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by irsmsx110.ger.corp.intel.com (163.33.3.25) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Oct 2017 15:07:45 +0100 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.28]) by irsmsx112.ger.corp.intel.com ([169.254.1.142]) with mapi id 14.03.0319.002; Mon, 2 Oct 2017 15:07:45 +0100 From: "Jastrzebski, MichalX K" To: "Mrozowicz, SlawomirX" , "Mcnamara, John" CC: "dev@dpdk.org" , "Mrozowicz, SlawomirX" , "ian.betts@intel.com" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] examples/performance-thread: fix out-of-bounds read Thread-Index: AQHTMeUOvWSIq/3Wi0ybna+UhvrctaLQqtPQ Date: Mon, 2 Oct 2017 14:07:43 +0000 Message-ID: <60ABE07DBB3A454EB7FAD707B4BB158213C40F7A@IRSMSX109.ger.corp.intel.com> References: <1505893654-25460-1-git-send-email-slawomirx.mrozowicz@intel.com> In-Reply-To: <1505893654-25460-1-git-send-email-slawomirx.mrozowicz@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDRhNmM2Y2MtNjhjZi00NWNmLWJiOTgtNjJmNDE1MzFmZWE5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImM0WjdNWE9FTkNoXC9ES2M5ZFhLY2krN094aDh5NXBTcng0QTZEbjVjeFBRPSJ9 x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples/performance-thread: fix out-of-bounds read 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: Mon, 02 Oct 2017 14:08:12 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Slawomir > Mrozowicz > Sent: Wednesday, September 20, 2017 9:48 AM > To: Mcnamara, John > Cc: dev@dpdk.org; Mrozowicz, SlawomirX > ; ian.betts@intel.com; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] examples/performance-thread: fix out-of- > bounds read >=20 > Overrunning array schedcore of 128 8-byte elements at element index 128 > using index lcore_id. > Fixed by correct check index lcoreid condition and > change type of lcoreid to unsigned. >=20 > Coverity issue: 143459 > Fixes: 116819b9ed0d ("examples/performance-thread: add lthread > subsystem") > Cc: ian.betts@intel.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Slawomir Mrozowicz > --- > examples/performance-thread/common/lthread.h | 2 +- > examples/performance-thread/common/lthread_sched.c | 11 +++++++---- > 2 files changed, 8 insertions(+), 5 deletions(-) >=20 > diff --git a/examples/performance-thread/common/lthread.h > b/examples/performance-thread/common/lthread.h > index 5c2c1a5f0..0cde5919b 100644 > --- a/examples/performance-thread/common/lthread.h > +++ b/examples/performance-thread/common/lthread.h > @@ -87,7 +87,7 @@ int _lthread_desched_sleep(struct lthread *lt); >=20 > void _lthread_free(struct lthread *lt); >=20 > -struct lthread_sched *_lthread_sched_get(int lcore_id); > +struct lthread_sched *_lthread_sched_get(unsigned int lcore_id); >=20 > struct lthread_stack *_stack_alloc(void); >=20 > diff --git a/examples/performance-thread/common/lthread_sched.c > b/examples/performance-thread/common/lthread_sched.c > index 98291478e..3484387b4 100644 > --- a/examples/performance-thread/common/lthread_sched.c > +++ b/examples/performance-thread/common/lthread_sched.c > @@ -562,11 +562,14 @@ void lthread_run(void) > * Return the scheduler for this lcore > * > */ > -struct lthread_sched *_lthread_sched_get(int lcore_id) > +struct lthread_sched *_lthread_sched_get(unsigned int lcore_id) > { > - if (lcore_id > LTHREAD_MAX_LCORES) > - return NULL; > - return schedcore[lcore_id]; > + struct lthread_sched *res =3D NULL; > + > + if (lcore_id < LTHREAD_MAX_LCORES) > + res =3D schedcore[lcore_id]; > + > + return res; > } >=20 > /* > -- > 2.11.0 Hi John,=20 Here are four fixes for coverity issues in lthread code: http://dpdk.org/dev/patchwork/patch/28979/ http://dpdk.org/dev/patchwork/patch/28977/ http://dpdk.org/dev/patchwork/patch/28976/ http://dpdk.org/dev/patchwork/patch/28975/ I would like to ask for Your feedback about these fix proposals. If everything is ok with them, please send acked-by. Best regards Michal.