From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id A0A781B19B; Wed, 11 Oct 2017 15:55:59 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 11 Oct 2017 06:55:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,361,1503385200"; d="scan'208";a="145296948" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga002.jf.intel.com with ESMTP; 11 Oct 2017 06:55:57 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.28]) by IRSMSX102.ger.corp.intel.com ([169.254.2.180]) with mapi id 14.03.0319.002; Wed, 11 Oct 2017 14:55:29 +0100 From: "Jastrzebski, MichalX K" To: "Jastrzebski, MichalX K" , "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+UhvrctaLQqtPQgA4iavA= Date: Wed, 11 Oct 2017 13:55:29 +0000 Message-ID: <60ABE07DBB3A454EB7FAD707B4BB158213C457C7@IRSMSX109.ger.corp.intel.com> References: <1505893654-25460-1-git-send-email-slawomirx.mrozowicz@intel.com> <60ABE07DBB3A454EB7FAD707B4BB158213C40F7A@IRSMSX109.ger.corp.intel.com> In-Reply-To: <60ABE07DBB3A454EB7FAD707B4BB158213C40F7A@IRSMSX109.ger.corp.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.181] 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: Wed, 11 Oct 2017 13:56:01 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jastrzebski, > MichalX K > Sent: Monday, October 2, 2017 4:08 PM > To: Mrozowicz, SlawomirX ; Mcnamara, > John > Cc: dev@dpdk.org; Mrozowicz, SlawomirX > ; ian.betts@intel.com; stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] examples/performance-thread: fix out-of- > bounds read >=20 > > -----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 > > > > 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. > > > > Coverity issue: 143459 > > Fixes: 116819b9ed0d ("examples/performance-thread: add lthread > > subsystem") > > Cc: ian.betts@intel.com > > Cc: stable@dpdk.org > > > > 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(-) > > > > 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); > > > > void _lthread_free(struct lthread *lt); > > > > -struct lthread_sched *_lthread_sched_get(int lcore_id); > > +struct lthread_sched *_lthread_sched_get(unsigned int lcore_id); > > > > struct lthread_stack *_stack_alloc(void); > > > > 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; > > } > > > > /* > > -- > > 2.11.0 >=20 > Hi John, > 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/ >=20 > I would like to ask for Your feedback about these fix proposals. > If everything is ok with them, please send acked-by. >=20 > Best regards > Michal. Acked-by: Michal Jastrzebski