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 07DBA42D46 for ; Sun, 25 Jun 2023 08:46:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 033A240ED8; Sun, 25 Jun 2023 08:46:44 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id C5EB240A7F for ; Sun, 25 Jun 2023 08:46:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UcB0p7FGBYkJcABRmm2T5rm6lOZzO3LntE9jSxHNcHxmVbykWK2QtW5BZpiKBZBX5qKKSOvlL3TgVYkSP+ECGMedI0v9r88WvtzvMQTlp1QIWiFwwgYW0DosJpUTw0IWnQytEQkdJV4v1pNZcmil07A5wqtz2VS5Kf11WgwxxUAjWFgAY49eLaQQ/KX7KTXZLityl1A2e38QsuxhTiJ7cmlbcLnlcBcJoWW3vsu8A029NqVc5tujS97jK/D6uWAr4e1h3t5Iin4EdSJLkoczkhznPrKwWTvN5yVRMek/VNs9QQB3jYt2cSX68/I/zoOxFD5njowKJHYZNtBzsCmo9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q298PW7kbXVPV2rBsZEs8RrIDoGvmSiecWQimjwQW/Q=; b=Og6Jb+Zeo+w0VHDr8GYz2TDm2UCQ7zrCIPI6NcHnbaSGBcD+YMnx+ghj93x/Ebv0uu2nGLK97oecG1L+cdfq4F0qWuRnRvtB1lETApyNVCBUnz5jlc4KlQdVGy6mrpa1iWUw6I1KY8IwA+eaUAJsVnPDE9onH4I/P6Q0LFz27m5jYpUrXgcjwn26j+iBc9zPAQrCX8AtJFPMNTlM0JQViSfGSJ1QoEue5UQQDjhOYfOgoHeOw1UQ0kvy/nNmTVqs18xPwSEhOITVG3BUZfKES4v90BLZKhN6r8nExuBs47S+6akwYhyU2BZNYWmNv0MF8mVeLjWODgURXH4Nged2Tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=arm.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q298PW7kbXVPV2rBsZEs8RrIDoGvmSiecWQimjwQW/Q=; b=YeGD9a2DtX/sezWAcJbCoKEEA9koANPyJRzaf+aEIfGhOuXcQqfBhjQFhD5WbjPmBOcizkog5xRNvyRutjYj4s/YJaewmPQhFEz1AG4dJoL+D3NlQMqEFJ9KEmbrZag+MLL3wPlqFRt5NTDb+S/PVvz3lf0ZUz7/aF5Vkn1wZRNda89v5AA68RnMxwRziqk014rvRa3CjyY4W7JFtfTZznyzIlO9Y25AqaJyaYD3UpCIT1VYIZYsGHDU+3e5JWrLSW3XMQmRwCNpirHLN5MoE48sTeUaASX5fsQMJdIZemm8OUq303wPNAQaSeIGz9eCj2h22qcE1fUDRvdJl93rvg== Received: from BN1PR13CA0025.namprd13.prod.outlook.com (2603:10b6:408:e2::30) by MW3PR12MB4572.namprd12.prod.outlook.com (2603:10b6:303:5e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Sun, 25 Jun 2023 06:46:40 +0000 Received: from BN8NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e2:cafe::db) by BN1PR13CA0025.outlook.office365.com (2603:10b6:408:e2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.14 via Frontend Transport; Sun, 25 Jun 2023 06:46:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT107.mail.protection.outlook.com (10.13.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.46 via Frontend Transport; Sun, 25 Jun 2023 06:46:39 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sat, 24 Jun 2023 23:46:25 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sat, 24 Jun 2023 23:46:23 -0700 From: Xueming Li To: Ruifeng Wang CC: Jia He , Anatoly Burakov , dpdk stable Subject: patch 'test/mbuf: fix crash in a forked process' has been queued to stable release 22.11.3 Date: Sun, 25 Jun 2023 14:35:41 +0800 Message-ID: <20230625063544.11183-124-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230625063544.11183-1-xuemingl@nvidia.com> References: <20230625063544.11183-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT107:EE_|MW3PR12MB4572:EE_ X-MS-Office365-Filtering-Correlation-Id: a8806c48-4d20-4433-d5f1-08db7547ee10 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H+lzrsP7XvmOPT/dmwURVwZlqyRcoxmzIhkeTsAE/PdxfjXXSCQVCVb5lx/j47i4TNMaAWi2yUdW47LilbnZpzqy2Goh5VKq430NZ/DPiIbAR11p3U/TCgUYAiORE3KcSV+TfwCVpYUeYVed7u+lDiC71vKypnjqgrRuM+Q5Xcr6qmxPjcqxMAkoyc3w+IZFT8z2Xctxf6j9sw7H4KbkzPdUmKyCfi1YV6n3lKQdySYNCE3MHpO8QfAucAJduBeAy9hyF7Jd4ZBafZ8rdbGc++tDHdXwddGhNwrPA7VHAJwCvIi295IoPm3L/M2JeZUhoAHgJe3gU9unKdnBToDU+EFdGT7o7XtVNLdsmhQ3PST+7qxOIqXj6p2LyxaMEtNQEVfrImXknf2wlyJcrIHslM6YFv2dvYN46YidoNo3B3cV4rPyr8XPU6J3xafE3kJhXHVI5RY6XvEgZrO654ujcQTUxBqSguRclh2gMElDH7B1s8b5WiQql94FpToPX7RFAFA9vP5O6ayiSVt2gVmnBp3pWLi7BxCWczdvUCwFDCeCESNlIiZnjyn5tOl48xUTRAVXZido2IMZhfttDUht4jV3toGyOA+6jfZmCHkB/R4lgRfkoM9Sa0U9xUCWiMO1F8WyYaNRlApdT5Py7V37SzRi+RUL+d8v5+ALjvCwJqTN378ClIJnUe48lwCzS9ojY0po1ClsmvprM/riHd9iag08dT8Y5x4Hl7nIx4/PJXPLbsEMtc0XalJz0p+j657afc4laFRCgOksTvsAZ53u6g== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199021)(40470700004)(36840700001)(46966006)(36860700001)(82310400005)(47076005)(966005)(478600001)(7696005)(6666004)(2616005)(54906003)(426003)(83380400001)(336012)(26005)(53546011)(1076003)(186003)(16526019)(6286002)(2906002)(5660300002)(40460700003)(36756003)(70206006)(356005)(4326008)(7636003)(70586007)(82740400003)(55016003)(40480700001)(316002)(86362001)(8936002)(8676002)(41300700001)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2023 06:46:39.8078 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8806c48-4d20-4433-d5f1-08db7547ee10 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4572 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 22.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 06/27/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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=55fbb9de8dd932518cccc95bdee011adfcdf2c32 Thanks. Xueming Li --- >From 55fbb9de8dd932518cccc95bdee011adfcdf2c32 Mon Sep 17 00:00:00 2001 From: Ruifeng Wang Date: Mon, 22 May 2023 14:01:37 +0800 Subject: [PATCH] test/mbuf: fix crash in a forked process Cc: Xueming Li [ upstream commit b6c419dde10e9f5dec7a02098c48060a7493420c ] Access of any memory in the hugepage shared file-backed area will trigger an unexpected forked child process segment fault. The root cause is DPDK doesn't support fork model [1] (calling rte_eal_init() before fork()). Forked child process can't be treated as a secondary process. Hence fix it by avoiding fork and doing verification in the main process. [1] https://mails.dpdk.org/archives/dev/2018-July/108106.html Fixes: af75078fece3 ("first public release") Signed-off-by: Jia He Signed-off-by: Ruifeng Wang Acked-by: Anatoly Burakov --- app/test/test_mbuf.c | 50 +++++++++++++------------------------------- 1 file changed, 14 insertions(+), 36 deletions(-) diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 1f4dd62466..7a2f8a9980 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -1167,38 +1167,16 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool) return TEST_SKIPPED; } #else - -#include -#include -#include -#include - -/* use fork() to test mbuf errors panic */ -static int -verify_mbuf_check_panics(struct rte_mbuf *buf) +/* Verify if mbuf can pass the check */ +static bool +mbuf_check_pass(struct rte_mbuf *buf) { - int pid; - int status; + const char *reason; - pid = fork(); + if (rte_mbuf_check(buf, 1, &reason) == 0) + return true; - if (pid == 0) { - struct rlimit rl; - - /* No need to generate a coredump when panicking. */ - rl.rlim_cur = rl.rlim_max = 0; - setrlimit(RLIMIT_CORE, &rl); - rte_mbuf_sanity_check(buf, 1); /* should panic */ - exit(0); /* return normally if it doesn't panic */ - } else if (pid < 0) { - printf("Fork Failed\n"); - return -1; - } - wait(&status); - if(status == 0) - return -1; - - return 0; + return false; } static int @@ -1215,19 +1193,19 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool) return -1; printf("Checking good mbuf initially\n"); - if (verify_mbuf_check_panics(buf) != -1) + if (!mbuf_check_pass(buf)) return -1; printf("Now checking for error conditions\n"); - if (verify_mbuf_check_panics(NULL)) { + if (mbuf_check_pass(NULL)) { printf("Error with NULL mbuf test\n"); return -1; } badbuf = *buf; badbuf.pool = NULL; - if (verify_mbuf_check_panics(&badbuf)) { + if (mbuf_check_pass(&badbuf)) { printf("Error with bad-pool mbuf test\n"); return -1; } @@ -1235,7 +1213,7 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool) if (RTE_IOVA_AS_PA) { badbuf = *buf; rte_mbuf_iova_set(&badbuf, 0); - if (verify_mbuf_check_panics(&badbuf)) { + if (mbuf_check_pass(&badbuf)) { printf("Error with bad-physaddr mbuf test\n"); return -1; } @@ -1243,21 +1221,21 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool) badbuf = *buf; badbuf.buf_addr = NULL; - if (verify_mbuf_check_panics(&badbuf)) { + if (mbuf_check_pass(&badbuf)) { printf("Error with bad-addr mbuf test\n"); return -1; } badbuf = *buf; badbuf.refcnt = 0; - if (verify_mbuf_check_panics(&badbuf)) { + if (mbuf_check_pass(&badbuf)) { printf("Error with bad-refcnt(0) mbuf test\n"); return -1; } badbuf = *buf; badbuf.refcnt = UINT16_MAX; - if (verify_mbuf_check_panics(&badbuf)) { + if (mbuf_check_pass(&badbuf)) { printf("Error with bad-refcnt(MAX) mbuf test\n"); return -1; } -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-06-25 14:32:01.762868000 +0800 +++ 0123-test-mbuf-fix-crash-in-a-forked-process.patch 2023-06-25 14:31:58.585773900 +0800 @@ -1 +1 @@ -From b6c419dde10e9f5dec7a02098c48060a7493420c Mon Sep 17 00:00:00 2001 +From 55fbb9de8dd932518cccc95bdee011adfcdf2c32 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit b6c419dde10e9f5dec7a02098c48060a7493420c ] @@ -16 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +28 @@ -index 8d8d3b9386..efac01806b 100644 +index 1f4dd62466..7a2f8a9980 100644 @@ -99 +101 @@ - if (RTE_IOVA_IN_MBUF) { + if (RTE_IOVA_AS_PA) {