From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E8E54A0613 for ; Tue, 27 Aug 2019 11:31:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E00231BFFA; Tue, 27 Aug 2019 11:31:52 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 17BD31BFFA for ; Tue, 27 Aug 2019 11:31:52 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C20C2A09B4; Tue, 27 Aug 2019 09:31:51 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-48.ams2.redhat.com [10.36.117.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F8D25C1B2; Tue, 27 Aug 2019 09:31:50 +0000 (UTC) From: Kevin Traynor To: David Hunt Cc: Anatoly Burakov , dpdk stable Date: Tue, 27 Aug 2019 10:30:24 +0100 Message-Id: <20190827093032.20423-47-ktraynor@redhat.com> In-Reply-To: <20190827093032.20423-1-ktraynor@redhat.com> References: <20190827093032.20423-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 27 Aug 2019 09:31:51 +0000 (UTC) Subject: [dpdk-stable] patch 'examples/power: fix strcpy buffer overrun' has been queued to LTS release 18.11.3 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 09/03/19. 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/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/29f6c01ad677f5693d2cba9e89f8d490c209cb99 Thanks. Kevin Traynor --- >From 29f6c01ad677f5693d2cba9e89f8d490c209cb99 Mon Sep 17 00:00:00 2001 From: David Hunt Date: Tue, 16 Jul 2019 12:19:00 +0100 Subject: [PATCH] examples/power: fix strcpy buffer overrun [ upstream commit 135393d4560bcffaa3fe0b739d26591565a320a2 ] replace strcpy with strlcpy to prevent buffer overrun With fix, attempting to use a VERY lonng vm name results in a nicely truncated 32 character name rather than a segfault: Setting VM Name to [sdfdsfsfsdffdsdsasdsadasdakjshd] Using strlcpy rather than rte_strlcpy, as the rte_ version is only a fallback. As well as the fix in main.c, this patch also changes an occurrence of rte_strlcpy in channel_manager.c and channel_monitor.c to strlcpy. Fixes: 59287933a0bb ("examples/vm_power: add options to guest app") Signed-off-by: David Hunt Acked-by: Anatoly Burakov --- examples/vm_power_manager/guest_cli/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c index 36365b124..2094145eb 100644 --- a/examples/vm_power_manager/guest_cli/main.c +++ b/examples/vm_power_manager/guest_cli/main.c @@ -66,5 +66,5 @@ parse_args(int argc, char **argv) /* portmask */ case 'n': - strcpy(policy->vm_name, optarg); + strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ); printf("Setting VM Name to [%s]\n", policy->vm_name); break; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-08-27 09:40:13.475508439 +0100 +++ 0047-examples-power-fix-strcpy-buffer-overrun.patch 2019-08-27 09:40:10.948143708 +0100 @@ -1 +1 @@ -From 135393d4560bcffaa3fe0b739d26591565a320a2 Mon Sep 17 00:00:00 2001 +From 29f6c01ad677f5693d2cba9e89f8d490c209cb99 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 135393d4560bcffaa3fe0b739d26591565a320a2 ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -23,27 +24,3 @@ - examples/vm_power_manager/channel_manager.c | 2 +- - examples/vm_power_manager/channel_monitor.c | 2 +- - examples/vm_power_manager/guest_cli/main.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c -index 2c1332257..4db225755 100644 ---- a/examples/vm_power_manager/channel_manager.c -+++ b/examples/vm_power_manager/channel_manager.c -@@ -589,5 +589,5 @@ add_host_channels(void) - } - chan_infos[i] = chan_info; -- rte_strlcpy(chan_info->channel_path, socket_path, -+ strlcpy(chan_info->channel_path, socket_path, - sizeof(chan_info->channel_path)); - -diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c -index 9d7474da0..496772f8a 100644 ---- a/examples/vm_power_manager/channel_monitor.c -+++ b/examples/vm_power_manager/channel_monitor.c -@@ -310,5 +310,5 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt, - return -1; - } -- rte_strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ); -+ strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ); - pkt->resource_id = resource_id; - } + examples/vm_power_manager/guest_cli/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) +