patch 'examples/performance-thread: fix build with ASan' has been queued to stable release 19.11.11

Peng, ZhihongX zhihongx.peng at intel.com
Wed Dec 1 02:44:42 CET 2021


Hi , ehrhardt

This patch is not backward compatible. 

Regards,
Peng,Zhihong

> -----Original Message-----
> From: christian.ehrhardt at canonical.com <christian.ehrhardt at canonical.com>
> Sent: Wednesday, December 1, 2021 12:35 AM
> To: Peng, ZhihongX <zhihongx.peng at intel.com>
> Cc: Lin, Xueqin <xueqin.lin at intel.com>; Richardson, Bruce
> <bruce.richardson at intel.com>; dpdk stable <stable at dpdk.org>
> Subject: patch 'examples/performance-thread: fix build with ASan' has been
> queued to stable release 19.11.11
> 
> Hi,
> 
> FYI, your patch has been queued to stable release 19.11.11
> 
> Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
> It will be pushed if I get no objections before December 10th 2021. So please
> shout if anyone has objections.
> 
> Also note that after the patch there's a diff of the upstream commit vs the
> patch applied to the branch. This will indicate if there was any rebasing
> needed to apply to the stable branch. If there were code changes for
> rebasing
> (ie: not only metadata diffs), please double check that the rebase was
> correctly done.
> 
> Queued patches are on a temporary branch at:
> https://github.com/cpaelzer/dpdk-stable-queue
> 
> This queued commit can be viewed at:
> https://github.com/cpaelzer/dpdk-stable-
> queue/commit/478db9fdd0f6214bd02fce0dfe49723d82b68228
> 
> Thanks.
> 
> Christian Ehrhardt <christian.ehrhardt at canonical.com>
> 
> ---
> From 478db9fdd0f6214bd02fce0dfe49723d82b68228 Mon Sep 17 00:00:00
> 2001
> From: Zhihong Peng <zhihongx.peng at intel.com>
> Date: Wed, 20 Oct 2021 15:46:43 +0800
> Subject: [PATCH] examples/performance-thread: fix build with ASan
> 
> [ upstream commit 4d2d1258151657d69b0be5d118956b7e809f9d47 ]
> 
> Code changes to avoid the following build error:
> "strncpy specified bound XX equals destination size".
> 
> Signed-off-by: Xueqin Lin <xueqin.lin at intel.com>
> Signed-off-by: Zhihong Peng <zhihongx.peng at intel.com>
> Acked-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
>  examples/performance-thread/common/lthread.c       | 4 ++--
>  examples/performance-thread/common/lthread_cond.c  | 6 +++---
> examples/performance-thread/common/lthread_mutex.c | 6 +++---
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/examples/performance-thread/common/lthread.c
> b/examples/performance-thread/common/lthread.c
> index 3f1f48db43..190e5874b1 100644
> --- a/examples/performance-thread/common/lthread.c
> +++ b/examples/performance-thread/common/lthread.c
> @@ -20,6 +20,7 @@
>  #include <sys/mman.h>
> 
>  #include <rte_log.h>
> +#include <rte_string_fns.h>
>  #include <ctx.h>
>  #include <stack.h>
> 
> @@ -463,6 +464,5 @@ void lthread_set_funcname(const char *f)  {
>  	struct lthread *lt = THIS_LTHREAD;
> 
> -	strncpy(lt->funcname, f, sizeof(lt->funcname));
> -	lt->funcname[sizeof(lt->funcname)-1] = 0;
> +	strlcpy(lt->funcname, f, sizeof(lt->funcname));
>  }
> diff --git a/examples/performance-thread/common/lthread_cond.c
> b/examples/performance-thread/common/lthread_cond.c
> index cdcc7a7b5a..e7be17089a 100644
> --- a/examples/performance-thread/common/lthread_cond.c
> +++ b/examples/performance-thread/common/lthread_cond.c
> @@ -20,6 +20,7 @@
> 
>  #include <rte_log.h>
>  #include <rte_common.h>
> +#include <rte_string_fns.h>
> 
>  #include "lthread_api.h"
>  #include "lthread_diag_api.h"
> @@ -57,10 +58,9 @@ lthread_cond_init(char *name, struct lthread_cond
> **cond,
>  	}
> 
>  	if (name == NULL)
> -		strncpy(c->name, "no name", sizeof(c->name));
> +		strlcpy(c->name, "no name", sizeof(c->name));
>  	else
> -		strncpy(c->name, name, sizeof(c->name));
> -	c->name[sizeof(c->name)-1] = 0;
> +		strlcpy(c->name, name, sizeof(c->name));
> 
>  	c->root_sched = THIS_SCHED;
> 
> diff --git a/examples/performance-thread/common/lthread_mutex.c
> b/examples/performance-thread/common/lthread_mutex.c
> index 01da6cad4f..709ab9f553 100644
> --- a/examples/performance-thread/common/lthread_mutex.c
> +++ b/examples/performance-thread/common/lthread_mutex.c
> @@ -19,6 +19,7 @@
>  #include <rte_log.h>
>  #include <rte_spinlock.h>
>  #include <rte_common.h>
> +#include <rte_string_fns.h>
> 
>  #include "lthread_api.h"
>  #include "lthread_int.h"
> @@ -52,10 +53,9 @@ lthread_mutex_init(char *name, struct lthread_mutex
> **mutex,
>  	}
> 
>  	if (name == NULL)
> -		strncpy(m->name, "no name", sizeof(m->name));
> +		strlcpy(m->name, "no name", sizeof(m->name));
>  	else
> -		strncpy(m->name, name, sizeof(m->name));
> -	m->name[sizeof(m->name)-1] = 0;
> +		strlcpy(m->name, name, sizeof(m->name));
> 
>  	m->root_sched = THIS_SCHED;
>  	m->owner = NULL;
> --
> 2.34.0
> 
> ---
>   Diff of the applied patch vs upstream commit (please double-check if non-
> empty:
> ---
> --- -	2021-11-30 16:50:11.974298631 +0100
> +++ 0106-examples-performance-thread-fix-build-with-ASan.patch	2021-
> 11-30 16:50:05.910874410 +0100
> @@ -1 +1 @@
> -From 4d2d1258151657d69b0be5d118956b7e809f9d47 Mon Sep 17 00:00:00
> 2001
> +From 478db9fdd0f6214bd02fce0dfe49723d82b68228 Mon Sep 17 00:00:00
> 2001
> @@ -5,0 +6,2 @@
> +[ upstream commit 4d2d1258151657d69b0be5d118956b7e809f9d47 ]
> +
> @@ -19 +21 @@
> -index 98123f34f8..009374a8c3 100644
> +index 3f1f48db43..190e5874b1 100644
> @@ -30 +32 @@
> -@@ -465,6 +466,5 @@ void lthread_set_funcname(const char *f)
> +@@ -463,6 +464,5 @@ void lthread_set_funcname(const char *f)
> @@ -64 +66 @@
> -index 061fc5c19a..f3ec7c1c60 100644
> +index 01da6cad4f..709ab9f553 100644


More information about the stable mailing list