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 155C7A00C2; Thu, 23 Apr 2020 09:58:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 587D11D15B; Thu, 23 Apr 2020 09:58:34 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id DD9101C2EC for ; Thu, 23 Apr 2020 09:58:32 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200423075832euoutp027f70b1557a8b316d8a623c4bd46eefbc~IY_bzxauS2317223172euoutp02M for ; Thu, 23 Apr 2020 07:58:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200423075832euoutp027f70b1557a8b316d8a623c4bd46eefbc~IY_bzxauS2317223172euoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587628712; bh=TXT3uw/5Fk8LMV70COlMZQjaYXCm+6lfJ/sZIdr0voc=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=qEjLN7pUxeXU6uFOtd+KyUeroGiXeeVmaff3RFoENDamapzPeDrZILo1cNm2N6Xz7 fDs1fmx20f18y3XTdaYlWQM6aNtoqW23GKfdkcdDiFRPy5V7r1QqpGF5HHVdws1GQN 3HqtXvR4h7JcGRREbTmpDFjFv4+i0QWme+AKUGl0= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200423075831eucas1p1e68360e04303f9978da72a1711b8c55e~IY_beEMc31444114441eucas1p1E; Thu, 23 Apr 2020 07:58:31 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 40.2A.60698.7AA41AE5; Thu, 23 Apr 2020 08:58:31 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200423075831eucas1p12840260f8c3e8c311b5f587149c39593~IY_bCsiiK1444114441eucas1p1D; Thu, 23 Apr 2020 07:58:31 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200423075831eusmtrp18872536da8448db431e280060c6cb95c~IY_bCKIyo2355723557eusmtrp1H; Thu, 23 Apr 2020 07:58:31 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-ed-5ea14aa731c2 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 96.FE.08375.7AA41AE5; Thu, 23 Apr 2020 08:58:31 +0100 (BST) Received: from [106.210.88.70] (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200423075830eusmtip22d509a2a7fa8c710433ddb950b0d6d7a~IY_aio0Oi2432524325eusmtip2G; Thu, 23 Apr 2020 07:58:30 +0000 (GMT) To: "Ananyev, Konstantin" , "dev@dpdk.org" Cc: "akhil.goyal@nxp.com" , "Doherty, Declan" From: Lukasz Wojciechowski Message-ID: <6aa9d011-13cb-cc0a-6f2c-64843d248229@partner.samsung.com> Date: Thu, 23 Apr 2020 09:58:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Transfer-Encoding: 8bit Content-Language: pl X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEKsWRmVeSWpSXmKPExsWy7djP87rLvRbGGdxqMbJYf2Yeo8WbB00s Fu8+bWeyeP9nEYsDi8evBUtZPRbvecnksfHdDqYA5igum5TUnMyy1CJ9uwSujLmd+5kKPohW LH3fwt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IltnxvYQHpZRaIl3j+XR2i/gWjxOKuzWwgNWwCthJHZn5lBbF5BdwkVq39xAJiswio Sux6/5wJpFdUIFai5aImRImgxMmZT8BKOIHCza0XwVqZBcwk5m1+yAxhy0s0b50NZYtI3HjU wjiBUWgWkvZZSFpmIWmZhaRlASPLKkaR1NLi3PTcYkO94sTc4tK8dL3k/NxNjMAI2nbs5+Yd jJc2Bh9iFOBgVOLhjVBcECfEmlhWXJl7iFGCg1lJhHfDw3lxQrwpiZVVqUX58UWlOanFhxhN gX6byCwlmpwPjO68knhDU0NzC0tDc2NzYzMLJXHeDoGDMUIC6YklqdmpqQWpRTB9TBycUg2M Vk9OfrxuXbEhdkrmAgPlyhWnL/hwxLUcU+qyFVlQZ50gG2Vx5EmI2ZaijaotqX0bdvQJVcm/ jBX+eyHjTnOCXQH73uu7v95qm++9Lk08Zv9pjZO2MbNO1bxjsmTRerMw+/33NxnfHa/evqu9 +bT/I4/fMma12Umc4ZmuExcI6oaZrz+aUbRCiaU4I9FQi7moOBEAWeajI7YCAAA= X-CMS-MailID: 20200423075831eucas1p12840260f8c3e8c311b5f587149c39593 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200423001138eucas1p2a1123f4b1a845c6aec7748cdf4b68813 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200423001138eucas1p2a1123f4b1a845c6aec7748cdf4b68813 References: <20200422235158.24497-1-konstantin.ananyev@intel.com> Subject: Re: [dpdk-dev] [PATCH] security: fix crash at accessing non-implemented ops X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" W dniu 23.04.2020 o 02:11, Ananyev, Konstantin pisze: > Actually looking at app/test/test_security.c > I also see a few '#ifdef RTE_DEBUG's. > Let say: > > +static int > +test_get_userdata_inv_context(void) > +{ > +#ifdef RTE_DEBUG > + uint64_t md = 0xDEADBEEF; > + > + void *ret = rte_security_get_userdata(NULL, md); > + TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_get_userdata, > + ret, NULL, "%p"); > + TEST_ASSERT_MOCK_CALLS(mock_get_userdata_exp, 0); > + > + return TEST_SUCCESS; > +#else > + return TEST_SKIPPED; > +#endif > +} > > What is the point? > Why not always run the test unconditionally? If there is no RTE_DEBUG defined, the tested functionality is not compiled, so the tests won't work. They must be wrapped with same macro as library code. > > >> -----Original Message----- >> From: Ananyev, Konstantin >> Sent: Thursday, April 23, 2020 12:52 AM >> To: dev@dpdk.org >> Cc: akhil.goyal@nxp.com; Doherty, Declan ; Ananyev, Konstantin >> Subject: [PATCH] security: fix crash at accessing non-implemented ops >> >> Valid checks for optional function pointers inside dev-ops >> were disabled by undefined macro. >> >> Fixes: b6ee98547847 ("security: fix verification of parameters") >> >> Signed-off-by: Konstantin Ananyev >> --- >> lib/librte_security/rte_security.c | 4 ---- >> 1 file changed, 4 deletions(-) >> >> diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c >> index d475b0977..b65430ce2 100644 >> --- a/lib/librte_security/rte_security.c >> +++ b/lib/librte_security/rte_security.c >> @@ -107,11 +107,9 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance, >> struct rte_security_session *sess, >> struct rte_mbuf *m, void *params) >> { >> -#ifdef RTE_DEBUG >> RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, set_pkt_metadata, -EINVAL, >> -ENOTSUP); >> RTE_PTR_OR_ERR_RET(sess, -EINVAL); >> -#endif >> return instance->ops->set_pkt_metadata(instance->device, >> sess, m, params); >> } >> @@ -121,9 +119,7 @@ rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md) >> { >> void *userdata = NULL; >> >> -#ifdef RTE_DEBUG >> RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, get_userdata, NULL, NULL); >> -#endif >> if (instance->ops->get_userdata(instance->device, md, &userdata)) >> return NULL; >> >> -- >> 2.17.1 -- Lukasz Wojciechowski Principal Software Engineer Samsung R&D Institute Poland Samsung Electronics Office +48 22 377 88 25 l.wojciechow@partner.samsung.com