DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Jastrzebski, MichalX K" <michalx.k.jastrzebski@intel.com>
To: "Mrozowicz, SlawomirX" <slawomirx.mrozowicz@intel.com>,
	"Mcnamara, John" <john.mcnamara@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Mrozowicz, SlawomirX" <slawomirx.mrozowicz@intel.com>,
	"ian.betts@intel.com" <ian.betts@intel.com>,
	 "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] examples/performance-thread: fix out-of-bounds	read
Date: Mon, 2 Oct 2017 14:07:43 +0000	[thread overview]
Message-ID: <60ABE07DBB3A454EB7FAD707B4BB158213C40F7A@IRSMSX109.ger.corp.intel.com> (raw)
In-Reply-To: <1505893654-25460-1-git-send-email-slawomirx.mrozowicz@intel.com>

> -----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 <john.mcnamara@intel.com>
> Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> <slawomirx.mrozowicz@intel.com>; 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 <slawomirx.mrozowicz@intel.com>
> ---
>  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 = NULL;
> +
> +	if (lcore_id < LTHREAD_MAX_LCORES)
> +		res = schedcore[lcore_id];
> +
> +	return res;
>  }
> 
>  /*
> --
> 2.11.0

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/

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.

  reply	other threads:[~2017-10-02 14:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20  7:47 Slawomir Mrozowicz
2017-10-02 14:07 ` Jastrzebski, MichalX K [this message]
2017-10-11 13:55   ` Jastrzebski, MichalX K
2017-10-13 23:14     ` Thomas Monjalon
2017-09-20  8:05 Slawomir Mrozowicz
2017-10-11 13:55 ` Jastrzebski, MichalX K
2017-10-13 23:19   ` Thomas Monjalon
2017-09-20  8:20 Slawomir Mrozowicz
2017-10-11 13:56 ` Jastrzebski, MichalX K
2017-09-20  8:21 Slawomir Mrozowicz
2017-10-11 13:56 ` Jastrzebski, MichalX K
2017-10-13 23:23   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60ABE07DBB3A454EB7FAD707B4BB158213C40F7A@IRSMSX109.ger.corp.intel.com \
    --to=michalx.k.jastrzebski@intel.com \
    --cc=dev@dpdk.org \
    --cc=ian.betts@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=slawomirx.mrozowicz@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).