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 CD638A0350 for ; Mon, 28 Feb 2022 22:23:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C30CC411B8; Mon, 28 Feb 2022 22:23:21 +0100 (CET) Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by mails.dpdk.org (Postfix) with ESMTP id 8ABC840140 for ; Mon, 28 Feb 2022 22:23:19 +0100 (CET) Received: by mail-ed1-f51.google.com with SMTP id h15so19420767edv.7 for ; Mon, 28 Feb 2022 13:23:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dnfXdncUSV5ceIcLFgkxNBh9PiJg+czbNnbU/NNa1J0=; b=lIzUpIxrfecCWr6KzulmEh7nPUk/s8V6ZSfHp6DVHL7ItfEeLU19ALx2GXE+MLQmfU PnR5CfcfctoYegaP8PwojBs37OGMuew94via7+fMKBzRtFtd2GBWND3CTiPiP+5VKLst mqKecWsBNQcwmAuHAPCGL7b95nwe2sSi5TN4CS8xr0D5gJOg5S16Bnr7yVdRKE46d6CC 38cA/qtkmKpuCnBeYyDTrGRc1FxY5QOfss1sZAvBqFVlZ4y5BIeB0soVQ4KCevk9TsrQ 6oDv4hdS5zdRg7X+uq3/fdgG9P2RXst/1bCfEHn0ANx9LBOKWrIy23yVejZRTzdehSYe 97Lw== 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=dnfXdncUSV5ceIcLFgkxNBh9PiJg+czbNnbU/NNa1J0=; b=6wQ0MFpGB0rC14UzFWD63N419hELyJZ1hnzhgKYKMEd9AyTyOWeqjmwv9yTX1hhh/d 2GQbmbXjuJ3g3MfMfiEjRWsPe+sazdBOEdzgk/pXfQYmCk7Uv+z0W6UXkcQqj+BTlRJP EH/FB7bI6ddTXivzKRCyWikkYxuvueYpEgvq1u/XvsBA7UUYmf+SHIW88fu9mkAJZi4e w/D6iSb0zLIxzvreBnzxAHW93hwmTOw+uEQGwrHQRxlOoRsdI1UF5jc1jxCURdeP4up0 5vTBjme1DHiS21VpR/xcXc1BMFsyVAdcipPeEDn7jaxpsWBrld5HWDPwZQlz4ykYcjPq minQ== X-Gm-Message-State: AOAM5324+lnQ1Att5BOnLe3WrMlgf5+qt1yZFgPfpgajsqmOchUNpn+w KUAOmHMeli42YoGoWS4rNPSbi5m48rebbaCO X-Google-Smtp-Source: ABdhPJyMsZ6wbtMBfpTj2K/DwC7zbnAyMRcCtXvtd0E7QKQa21nuYnRqLIkElmuPk5VHuhGt0x020A== X-Received: by 2002:a05:6402:4409:b0:412:aac5:4e48 with SMTP id y9-20020a056402440900b00412aac54e48mr21346722eda.75.1646083399254; Mon, 28 Feb 2022 13:23:19 -0800 (PST) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id v4-20020a170906338400b006d5aca9fc80sm4678591eja.106.2022.02.28.13.23.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 13:23:18 -0800 (PST) From: luca.boccassi@gmail.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 20.11.5 Date: Mon, 28 Feb 2022 21:20:46 +0000 Message-Id: <20220228212047.3341966-50-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220228212047.3341966-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-122-luca.boccassi@gmail.com> <20220228212047.3341966-1-luca.boccassi@gmail.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 20.11.5 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/02/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/3cb68884dd7bb7edfa8813cfbe4335951c1cd14f Thanks. Luca Boccassi --- >From 3cb68884dd7bb7edfa8813cfbe4335951c1cd14f 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_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c index ae0021e7b5..c1737f4672 100644 --- a/lib/librte_eal/linux/eal_dev.c +++ b/lib/librte_eal/linux/eal_dev.c @@ -226,13 +226,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.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-28 21:17:57.957762290 +0000 +++ 0050-eal-linux-fix-illegal-memory-access-in-uevent-handle.patch 2022-02-28 21:17:54.064934139 +0000 @@ -1 +1 @@ -From 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 Mon Sep 17 00:00:00 2001 +From 3cb68884dd7bb7edfa8813cfbe4335951c1cd14f 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_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_dev.c b/lib/librte_eal/linux/eal_dev.c +index ae0021e7b5..c1737f4672 100644 +--- a/lib/librte_eal/linux/eal_dev.c ++++ b/lib/librte_eal/linux/eal_dev.c +@@ -226,13 +226,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)