From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D20C2A0093 for ; Wed, 9 Mar 2022 12:02:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE0B8410F3; Wed, 9 Mar 2022 12:02:57 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id 8985D40150 for ; Wed, 9 Mar 2022 12:02:56 +0100 (CET) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 6A3853F79C for ; Wed, 9 Mar 2022 11:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646823776; bh=JuyNG7s3N8hWwxYmm/QQ1coBfZS1ItD0npRglVWQ0Tk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HLfvwqxXKBGK8mRfhpmoB89rcFsoicvFSr0p+BtbDSBLCkDGRfLoTtfUEUmy0pGp4 NCuZFjmaZhkkeFLz9RAOEIa4eQ0k4u3Locp8QFDwJ2ous6pxQjxUtKG4zdvvSjCixw d0wKooMbaZ6EcKgk5uQ/eMn6zBEN7NQWuUNIq7yZ5kUznJmYMlQL3a/0SEhOVfzZaQ TJJpYuwhMTyEDkYtYvXTDmCk8c8esDgwI1uli9AUFNtFF7M6+sy5zE9pbHa/03n/4Z n9bf4YS61tz9bE6M4bCiogqflcVrdJQZTiq+vnNDHtVRJqxQzXyYxtTiviZBskv6WZ tLgu/DZXv2QPw== Received: by mail-wm1-f72.google.com with SMTP id 14-20020a05600c104e00b003897a167353so818500wmx.8 for ; Wed, 09 Mar 2022 03:02:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JuyNG7s3N8hWwxYmm/QQ1coBfZS1ItD0npRglVWQ0Tk=; b=JJeJ2qjfzcW7bcxJ7TtuXJtIQN+faBqIr8RCWiGbKiPUwO5VDW5gxe04/Fs0kK3ZiT bJSoFM8bp6LJP6so4Wa9R/kdje3OBjthkvls9aazIUFEp13r5odKBqMhHEMz/VDnVEcw lVi4Wx+GxO5/tUOwpvcn9Gfabko1P6JrYvwk8F0Gx3XbA+TxhXAbpjzwekU877KRzDeZ +4j/y8o5q7NylUBFPCcNClic5N6axbT8IUG7tlS8P93TnVyWFSRSxICFoAnQcKDC/xde 8//y54r96SLvayQ2TuNbrcwTNbDEowF/GIWDFRChTD9FvRnEnHm+xIJwEda036fN7Wlt HtWQ== X-Gm-Message-State: AOAM53335on3U5hLN6qeFZN6B0ySlmjBgHFZRxcBZqwxZWWdgfnyruSO X/p4nVLglgsQPx49ifaqkpvFievUe/oJWirTXIVR11lyd/Yi/cHHzaC1EanNiWtK08E4KulAd9Q rS0LtclxR6RQu4OdWYTdDAmtu X-Received: by 2002:a05:6000:1864:b0:203:7e40:b0de with SMTP id d4-20020a056000186400b002037e40b0demr669609wri.268.1646823775463; Wed, 09 Mar 2022 03:02:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2myofuQT74uDbcUUE63qMzZZwxOj/sXaejuHCcfStn80ISTdWE5nJtpQKVyfd098lvzcrRg== X-Received: by 2002:a05:6000:1864:b0:203:7e40:b0de with SMTP id d4-20020a056000186400b002037e40b0demr669591wri.268.1646823775235; Wed, 09 Mar 2022 03:02:55 -0800 (PST) Received: from localhost.localdomain (068-133-067-156.ip-addr.inexio.net. [156.67.133.68]) by smtp.gmail.com with ESMTPSA id u4-20020adfdb84000000b001e8d8ac5394sm1412993wri.110.2022.03.09.03.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 03:02:54 -0800 (PST) From: christian.ehrhardt@canonical.com To: Steve Yang Cc: Ferruh Yigit , dpdk stable Subject: patch 'eal/linux: fix illegal memory access in uevent handler' has been queued to stable release 19.11.12 Date: Wed, 9 Mar 2022 12:00:59 +0100 Message-Id: <20220309110116.1295395-28-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220309110116.1295395-1-christian.ehrhardt@canonical.com> References: <20220309110116.1295395-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 19.11.12 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/11/22. 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/1566ae455c008892d65a852f63f044ffe38dc6d8 Thanks. Christian Ehrhardt --- >From 1566ae455c008892d65a852f63f044ffe38dc6d8 Mon Sep 17 00:00:00 2001 From: Steve Yang Date: Wed, 23 Feb 2022 08:49:50 +0000 Subject: [PATCH] eal/linux: fix illegal memory access in uevent handler [ upstream commit 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 ] 'recv()' fills the 'buf', later 'strlcpy()' used to copy from this buffer. But as coverity warns 'recv()' doesn't guarantee that 'buf' is null-terminated, but 'strlcpy()' requires it. Enlarge 'buf' size to 'EAL_UEV_MSG_LEN + 1' and ensure the last one can be set to 0 when received buffer size is EAL_UEV_MSG_LEN. CID 375864: Memory - illegal accesses (STRING_NULL) Passing unterminated string "buf" to "dev_uev_parse", which expects a null-terminated string. Coverity issue: 375864 Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process") Signed-off-by: Steve Yang Acked-by: Ferruh Yigit --- lib/librte_eal/linux/eal/eal_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_dev.c b/lib/librte_eal/linux/eal/eal_dev.c index 4248f8db5a..eb3e2642e0 100644 --- a/lib/librte_eal/linux/eal/eal_dev.c +++ b/lib/librte_eal/linux/eal/eal_dev.c @@ -220,13 +220,13 @@ dev_uev_handler(__rte_unused void *param) { struct rte_dev_event uevent; int ret; - char buf[EAL_UEV_MSG_LEN]; + char buf[EAL_UEV_MSG_LEN + 1]; struct rte_bus *bus; struct rte_device *dev; const char *busname = ""; memset(&uevent, 0, sizeof(struct rte_dev_event)); - memset(buf, 0, EAL_UEV_MSG_LEN); + memset(buf, 0, EAL_UEV_MSG_LEN + 1); ret = recv(intr_handle.fd, buf, EAL_UEV_MSG_LEN, MSG_DONTWAIT); if (ret < 0 && errno == EAGAIN) -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-09 11:57:44.839486065 +0100 +++ 0028-eal-linux-fix-illegal-memory-access-in-uevent-handle.patch 2022-03-09 11:57:43.396938405 +0100 @@ -1 +1 @@ -From 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 Mon Sep 17 00:00:00 2001 +From 1566ae455c008892d65a852f63f044ffe38dc6d8 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ - lib/eal/linux/eal_dev.c | 4 ++-- + lib/librte_eal/linux/eal/eal_dev.c | 4 ++-- @@ -27,5 +28,5 @@ -diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c -index f6e5861221..e6f509bcff 100644 ---- a/lib/eal/linux/eal_dev.c -+++ b/lib/eal/linux/eal_dev.c -@@ -227,13 +227,13 @@ dev_uev_handler(__rte_unused void *param) +diff --git a/lib/librte_eal/linux/eal/eal_dev.c b/lib/librte_eal/linux/eal/eal_dev.c +index 4248f8db5a..eb3e2642e0 100644 +--- a/lib/librte_eal/linux/eal/eal_dev.c ++++ b/lib/librte_eal/linux/eal/eal_dev.c +@@ -220,13 +220,13 @@ dev_uev_handler(__rte_unused void *param) @@ -45,2 +46,2 @@ - if (rte_intr_fd_get(intr_handle) < 0) - return; + ret = recv(intr_handle.fd, buf, EAL_UEV_MSG_LEN, MSG_DONTWAIT); + if (ret < 0 && errno == EAGAIN)