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 956E2A0093 for ; Tue, 19 May 2020 15:00:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8C6A11D610; Tue, 19 May 2020 15:00:18 +0200 (CEST) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 9962D1D610 for ; Tue, 19 May 2020 15:00:17 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id i15so15753767wrx.10 for ; Tue, 19 May 2020 06:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VgXHsFd4puQ9mmIkHSZJsVETS9H2UnmeqDYfu9Z0Bmk=; b=KJWk8a0VJB+eZFUKDFWCt+ycrPzuURUOPcSf0toJ4Mr3My+4g2h0+hAbYJ3jkAz/Ur mpZpiKoSriEXlgroziGx+HBG/DHiBVnW517uSAlbvNCJwbGCDsA+iPObe5Ga97b3SUKL +5qHIMGJLZeRGXZLU8SACOgv7nGE5WU2EOTEL0NZOlmmtqINJcFllE/8UMbjFylsLgqW 1m4UvPpiGI0/O8wZwDDJVmoJFxsip1EuWgxfIRH3djlAr1sr1pXrLoX8DkR+AeHRA7xE 6C5U5GzRKbkwuSsFtA31PdB5RcpHIbQdT8fr1e3EpKFJUaK1pQMWSsnqGs3PJIIKpOod ossg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VgXHsFd4puQ9mmIkHSZJsVETS9H2UnmeqDYfu9Z0Bmk=; b=ChL0JKa3idMQMaz0NoMWHPR3bXoq7b1xwFYtDjl0cvpiLV/h7xZM7XaO65XaLnpnvv qAywB8gGmjeNVD0wVzsv73mxW2r3eZkRa9qeExo9SPPCGZrFZQ44ASPHf8yeTOw+krff aFlm09ZGqS3d4GWCCuC6oJYMgT4OFEkZUFnQ7mhBeH6773vBI8pEc0z9G3aXccslWnSh Js4PJza3OsniAR+YHc/U6GTY3+xryVQu3wZp7zHYsbHWoXaeawvBaBF27pJm5qwpAkzb aw6aOCrdPaN8UggQ/tPyJJCwF/dpTgIOIkBUSRgMZbnsFO8gY8YWNxfdNM3jGB9czJ/m oPaw== X-Gm-Message-State: AOAM531T4m7ABdGSVvz2IwFIoSdO4+poYfaDwDLLib02q4iVT8mddQYR qOXrmaLU2jKgv3DSo/kNauk= X-Google-Smtp-Source: ABdhPJwaPM25hI5yyxdhJGdsrOM3hABBVVygE8N09YprTubVoGgVpLbdSO43oWKrXR7cv/rc/Z76/A== X-Received: by 2002:a5d:6984:: with SMTP id g4mr26317790wru.205.1589893217313; Tue, 19 May 2020 06:00:17 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id b145sm4268955wme.41.2020.05.19.06.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:00:16 -0700 (PDT) From: luca.boccassi@gmail.com To: Ruifeng Wang Cc: Phil Yang , Gavin Hu , Konstantin Ananyev , dpdk stable Date: Tue, 19 May 2020 13:54:12 +0100 Message-Id: <20200519125804.104349-62-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519125804.104349-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'test/ipsec: fix crash in session destroy' has been queued to stable release 19.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 stable release 19.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 05/21/20. 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. Thanks. Luca Boccassi --- >From 2193048d873333899100af6436725928ea9db909 Mon Sep 17 00:00:00 2001 From: Ruifeng Wang Date: Fri, 20 Mar 2020 16:05:20 +0800 Subject: [PATCH] test/ipsec: fix crash in session destroy [ upstream commit 40a49a89d7dc7c64e58260e0097dd0ae5f98e9c4 ] Segfault was observed when running ipsec unit test: + TestCase [10] : test_ipsec_replay_inb_repeat_null_null_wrapper succeeded + TestCase [11] : test_ipsec_replay_inb_inside_burst_null_null_wrapper succeeded + TestCase [12] : test_ipsec_crypto_inb_burst_2sa_null_null_wrapper succeeded + TestCase [13] : test_ipsec_crypto_inb_burst_2sa_4grp_null_null_wrapper succeeded Segmentation fault Data corruption happens due to incorrect destroy of session. Security session needs process different from crypto session. Destroy corresponding sessions according to different security actions. Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test") Signed-off-by: Ruifeng Wang Reviewed-by: Phil Yang Reviewed-by: Gavin Hu Tested-by: Konstantin Ananyev Acked-by: Konstantin Ananyev --- app/test/test_ipsec.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 9e14472938..79d00d7e02 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -1167,6 +1167,34 @@ test_ipsec_dump_buffers(struct ipsec_unitest_params *ut_params, int i) } } +static void +destroy_dummy_sec_session(struct ipsec_unitest_params *ut, + uint32_t j) +{ + rte_security_session_destroy(&dummy_sec_ctx, + ut->ss[j].security.ses); + ut->ss[j].security.ctx = NULL; +} + +static void +destroy_crypto_session(struct ipsec_unitest_params *ut, + uint8_t crypto_dev, uint32_t j) +{ + rte_cryptodev_sym_session_clear(crypto_dev, ut->ss[j].crypto.ses); + rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses); + memset(&ut->ss[j], 0, sizeof(ut->ss[j])); +} + +static void +destroy_session(struct ipsec_unitest_params *ut, + uint8_t crypto_dev, uint32_t j) +{ + if (ut->ss[j].type == RTE_SECURITY_ACTION_TYPE_NONE) + return destroy_crypto_session(ut, crypto_dev, j); + else + return destroy_dummy_sec_session(ut, j); +} + static void destroy_sa(uint32_t j) { @@ -1175,9 +1203,8 @@ destroy_sa(uint32_t j) rte_ipsec_sa_fini(ut->ss[j].sa); rte_free(ut->ss[j].sa); - rte_cryptodev_sym_session_clear(ts->valid_dev, ut->ss[j].crypto.ses); - rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses); - memset(&ut->ss[j], 0, sizeof(ut->ss[j])); + + destroy_session(ut, ts->valid_dev, j); } static int -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 13:56:21.356042820 +0100 +++ 0062-test-ipsec-fix-crash-in-session-destroy.patch 2020-05-19 13:56:18.291503115 +0100 @@ -1,8 +1,10 @@ -From 40a49a89d7dc7c64e58260e0097dd0ae5f98e9c4 Mon Sep 17 00:00:00 2001 +From 2193048d873333899100af6436725928ea9db909 Mon Sep 17 00:00:00 2001 From: Ruifeng Wang Date: Fri, 20 Mar 2020 16:05:20 +0800 Subject: [PATCH] test/ipsec: fix crash in session destroy +[ upstream commit 40a49a89d7dc7c64e58260e0097dd0ae5f98e9c4 ] + Segfault was observed when running ipsec unit test: + TestCase [10] : test_ipsec_replay_inb_repeat_null_null_wrapper @@ -21,7 +23,6 @@ Destroy corresponding sessions according to different security actions. Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test") -Cc: stable@dpdk.org Signed-off-by: Ruifeng Wang Reviewed-by: Phil Yang