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 0BBB142800 for ; Wed, 22 Mar 2023 01:42:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0316540F18; Wed, 22 Mar 2023 01:42:01 +0100 (CET) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 1DCED40E09 for ; Wed, 22 Mar 2023 01:41:59 +0100 (CET) Received: by mail-wm1-f41.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so10478380wmq.1 for ; Tue, 21 Mar 2023 17:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679445719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+cr/ygtJJzKl0Vk8fR0B6lYoARvTaJPPsLsNEkRvDNY=; b=pNjv8RXXwf8TYimi8feRfQdxY275xXWdrSfs8q6snjAEeodrFnsApLpQbHXCK+6e2c TEtAEgYoA51591xdI7MMtjUb3XfK/mZWFarG6U0PD0sobTItDL5gpI0YnPSln6CKddYJ 82jFAXZQ7IpZZ9LuhVS7ctazgRYUQaNVuLZtdnu5pE84nAFxWiGncZ8XVcwttxs3Nvuy Q/LvpG9oyldAMhO2VvDV7ZoIz5C5q5hG9togXPSkN0wbOsmOCtmytYGW5/zUi5sGdHZw 9lSjAgT9pbSBNbtaezeoOsXczJTUnDps44YZOTjYXXpSL0nSLX4eAEeZN02+92TuvYL7 iDSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679445719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+cr/ygtJJzKl0Vk8fR0B6lYoARvTaJPPsLsNEkRvDNY=; b=3VGaTDCY6ImeVDOWEI/jbt25urAYxqabeWLdT4LKbtxtNeULBQ6Li8/02pBSZ7Ww7U AGOCVuneeV+oX5JetjT0kwynZyk+V0E1QT/VJQ+WGMeVpL5kMPEbqQLFpSa1EIyD/iEi 9zxbhSmmMRdHe7TLMsFsj5KsTBgiG979zXl7xFYSi+Ph1pNnUK2L8iYOMlJ+Wq2GnVm8 Seoas2Am74lSH1zMQBG0Pz1pyW31FF2kSeDeJ7EvyzFrdO62u0e3Wq+5iQedk9abcFxw SayXCVO8MWcWXIeBLMJK189AGyNkIhcsTxCMoCLFI4BQnpT3KqDOcRaSKY+5gOV0JKob KqyA== X-Gm-Message-State: AO0yUKV6B2lZakCyvQ6ex/buZPItSlxt7FqoieYmQ/ftAHNou1gaKBHr dYuW7EWfhSoS1ClzYuSoHq4= X-Google-Smtp-Source: AK7set+QWOSPdz4BmqFPqyXEwn5KBariQbOSsyb2PLK9gSq4YcAP18bIWftAQfJjhI4zWz9539XuqQ== X-Received: by 2002:a05:600c:3648:b0:3ed:2105:9ac6 with SMTP id y8-20020a05600c364800b003ed21059ac6mr3821421wmq.28.1679445718381; Tue, 21 Mar 2023 17:41:58 -0700 (PDT) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id k22-20020a05600c0b5600b003ed2987690dsm14966249wmr.26.2023.03.21.17.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Mar 2023 17:41:57 -0700 (PDT) From: luca.boccassi@gmail.com To: David Marchand Cc: Yu Jiang , Hemant Agrawal , dpdk stable Subject: patch 'raw/skeleton: fix selftest' has been queued to stable release 20.11.8 Date: Wed, 22 Mar 2023 00:41:37 +0000 Message-Id: <20230322004155.2333903-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315224631.1025649-39-luca.boccassi@gmail.com> References: <20230315224631.1025649-39-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.8 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/23/23. 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/7a7e6c5bb80b87768e0d18d9da2c5bc30fb6f9b5 Thanks. Luca Boccassi --- >From 7a7e6c5bb80b87768e0d18d9da2c5bc30fb6f9b5 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Fri, 10 Mar 2023 15:26:03 +0100 Subject: [PATCH] raw/skeleton: fix selftest [ upstream commit 365ec3c4fe599048c67cc79817ae9dfa090753cc ] ASan reported issues in this driver. rte_rawdev_obj_t context object points at a uint16_t. skeleton_rawdev_enqueue_bufs() and skeleton_rawdev_dequeue_bufs() were incorrectly casting to an int. The enqueue/dequeue selftest had a leak on the enqueued string and was wrong in passing a rte_rawdev_buf pointer array. Fix this by allocating buffers on the stack and check that returned string is the expected one. Bugzilla ID: 999 Fixes: 61c592a8d035 ("raw/skeleton: introduce skeleton rawdev driver") Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases") Signed-off-by: David Marchand Tested-by: Yu Jiang Acked-by: Hemant Agrawal --- drivers/raw/skeleton/skeleton_rawdev.c | 4 +- drivers/raw/skeleton/skeleton_rawdev_test.c | 46 +++++++++------------ 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c index ebb9075dd9..11d0beefbd 100644 --- a/drivers/raw/skeleton/skeleton_rawdev.c +++ b/drivers/raw/skeleton/skeleton_rawdev.c @@ -421,7 +421,7 @@ static int skeleton_rawdev_enqueue_bufs(struct rte_rawdev *dev, * help in complex implementation which require more information than * just an integer - for example, a queue-pair. */ - q_id = *((int *)context); + q_id = *((uint16_t *)context); for (i = 0; i < count; i++) queue_buf[q_id].bufs[i] = buffers[i]->buf_addr; @@ -443,7 +443,7 @@ static int skeleton_rawdev_dequeue_bufs(struct rte_rawdev *dev, * help in complex implementation which require more information than * just an integer - for example, a queue-pair. */ - q_id = *((int *)context); + q_id = *((uint16_t *)context); for (i = 0; i < count; i++) buffers[i]->buf_addr = queue_buf[q_id].bufs[i]; diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c index 484468eeb4..cad05ed60f 100644 --- a/drivers/raw/skeleton/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c @@ -368,42 +368,34 @@ static int test_rawdev_enqdeq(void) { int ret; - unsigned int count = 1; uint16_t queue_id = 0; - struct rte_rawdev_buf buffers[1]; - struct rte_rawdev_buf *deq_buffers = NULL; + struct rte_rawdev_buf buffer; + struct rte_rawdev_buf *buffers[1]; + struct rte_rawdev_buf deq_buffer; + struct rte_rawdev_buf *deq_buffers[1]; - buffers[0].buf_addr = malloc(strlen(TEST_DEV_NAME) + 3); - if (!buffers[0].buf_addr) - goto cleanup; - snprintf(buffers[0].buf_addr, strlen(TEST_DEV_NAME) + 2, "%s%d", + buffers[0] = &buffer; + buffer.buf_addr = malloc(strlen(TEST_DEV_NAME) + 3); + if (!buffer.buf_addr) + return TEST_FAILED; + snprintf(buffer.buf_addr, strlen(TEST_DEV_NAME) + 2, "%s%d", TEST_DEV_NAME, 0); - ret = rte_rawdev_enqueue_buffers(test_dev_id, - (struct rte_rawdev_buf **)&buffers, - count, &queue_id); - RTE_TEST_ASSERT_EQUAL((unsigned int)ret, count, + ret = rte_rawdev_enqueue_buffers(test_dev_id, buffers, + RTE_DIM(buffers), &queue_id); + RTE_TEST_ASSERT_EQUAL((unsigned int)ret, RTE_DIM(buffers), "Unable to enqueue buffers"); - deq_buffers = malloc(sizeof(struct rte_rawdev_buf) * count); - if (!deq_buffers) - goto cleanup; - - ret = rte_rawdev_dequeue_buffers(test_dev_id, - (struct rte_rawdev_buf **)&deq_buffers, - count, &queue_id); - RTE_TEST_ASSERT_EQUAL((unsigned int)ret, count, + deq_buffers[0] = &deq_buffer; + ret = rte_rawdev_dequeue_buffers(test_dev_id, deq_buffers, + RTE_DIM(deq_buffers), &queue_id); + RTE_TEST_ASSERT_EQUAL((unsigned int)ret, RTE_DIM(buffers), "Unable to dequeue buffers"); + RTE_TEST_ASSERT_EQUAL(deq_buffers[0]->buf_addr, buffers[0]->buf_addr, + "Did not retrieve expected object"); - if (deq_buffers) - free(deq_buffers); - + free(buffer.buf_addr); return TEST_SUCCESS; -cleanup: - if (buffers[0].buf_addr) - free(buffers[0].buf_addr); - - return TEST_FAILED; } static void skeldev_test_run(int (*setup)(void), -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-03-21 21:56:37.117329432 +0000 +++ 0001-raw-skeleton-fix-selftest.patch 2023-03-21 21:56:37.004805629 +0000 @@ -1 +1 @@ -From 365ec3c4fe599048c67cc79817ae9dfa090753cc Mon Sep 17 00:00:00 2001 +From 7a7e6c5bb80b87768e0d18d9da2c5bc30fb6f9b5 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 365ec3c4fe599048c67cc79817ae9dfa090753cc ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org @@ -27,2 +28,2 @@ - drivers/raw/skeleton/skeleton_rawdev_test.c | 44 +++++++++------------ - 2 files changed, 21 insertions(+), 27 deletions(-) + drivers/raw/skeleton/skeleton_rawdev_test.c | 46 +++++++++------------ + 2 files changed, 21 insertions(+), 29 deletions(-) @@ -31 +32 @@ -index 53fe49f936..6e99d35536 100644 +index ebb9075dd9..11d0beefbd 100644 @@ -34 +35 @@ -@@ -428,7 +428,7 @@ static int skeleton_rawdev_enqueue_bufs(struct rte_rawdev *dev, +@@ -421,7 +421,7 @@ static int skeleton_rawdev_enqueue_bufs(struct rte_rawdev *dev, @@ -43 +44 @@ -@@ -450,7 +450,7 @@ static int skeleton_rawdev_dequeue_bufs(struct rte_rawdev *dev, +@@ -443,7 +443,7 @@ static int skeleton_rawdev_dequeue_bufs(struct rte_rawdev *dev, @@ -53 +54 @@ -index ca15c49990..b7a7f623aa 100644 +index 484468eeb4..cad05ed60f 100644 @@ -56 +57 @@ -@@ -370,40 +370,34 @@ static int +@@ -368,42 +368,34 @@ static int @@ -105 +106,2 @@ -- free(deq_buffers); +- if (deq_buffers) +- free(deq_buffers); @@ -110 +112,2 @@ -- free(buffers[0].buf_addr); +- if (buffers[0].buf_addr) +- free(buffers[0].buf_addr);