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 735BAA034F for ; Wed, 10 Nov 2021 07:54:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D49440142; Wed, 10 Nov 2021 07:54:00 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2071.outbound.protection.outlook.com [40.107.223.71]) by mails.dpdk.org (Postfix) with ESMTP id E229540142 for ; Wed, 10 Nov 2021 07:53:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RotK/rOqsDsDgguuqBFgO3vrz9MJRWZ76oFSi0CyiWbXxfQBC1r1yndmVFnQ/IKn1K75WUZBS3VqmNpfW4rblY7oYGoqs0V92odq0nbdH0LbPiDFPAymW4DzZI6+Zkt4RoRwe23ThXd7aRiMKZyPgcwr3+fuN+7XaeCDPSQq2zT4gFPPnLKV6neGE8Zh3hihQ3NoF2FgCUfRoaqHqsTypz5EpVB+4GOkpOyq6i0wQC2S+wtMlAyM4V0AoaJfyaWERuBxmbTDZbyRlfoMB629ABUCmpMEyVTEloNDGc9fbBt2HssJ/cb272qe9/HDFh2hEwykbkoSC27OpSfqjVw+2A== 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=LM/rGh9lmHZwQOeVNIJwN9QJ51iWNlH5CaIERXe5jsc=; b=hZ4EBEwLMBDRgSjQ+mCjHbHS0Y0uJySLh+eSU8k0KmCg4jyNbXgBAvLNkcMWdZ9U45fEfrda+3UF0iZ4K+pSi1P6EaNOOengt1A5a1n1gafkViICwaXCr1/x9JsDNTjI2iydM0MXYf/CCe4vyclOKwlPfsDjS19bA0OEkDskkZ59YNnNwF6VP4om667epqtxmhbyk3zG9fqPbyi9trdPs14jW4QZuADaq2+exFpgcxyGZ374Pn4cjJEbC1QnTDNjF/MdzELztMR9vSaZIEYcMgA4p3wf6jM0eghExHgRdmGHxt1yjh3zsvGGMoIwWDI4P+kiCPkXboOEqrGVQDXauQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=LM/rGh9lmHZwQOeVNIJwN9QJ51iWNlH5CaIERXe5jsc=; b=JBq6oqkRQV9qmdVfrRP5PEc3G3O3UaQC2+hHLnWxT/IRKIV9S56AkOcd0+lrhn45qkhozLk7K2V2800cs+cspH5Qss2efEF2qrsbr9k9PGtnO9ICeG9Vu4SXgjgyoKsKvOoa2/UuRiVokMksGeBK92qUWWDt3Q3RNjmNCWnS9sHzly5POKK22fZMUJDM3DN/81REJzG2UWTc+pkk34GBBm7j5gt5N/N6MALjNC46Xa/ulanUk8WTBGoRpnt7+2P8LYyETVlH70A0gWK2V7LuuuAOYkZHDGgnfcuQTtszBIQozKY5UTU/fsYdWtV7/gf8HtvvnuxtV19KQuw9J2h7Fw== Received: from BN8PR07CA0009.namprd07.prod.outlook.com (2603:10b6:408:ac::22) by MN2PR12MB4549.namprd12.prod.outlook.com (2603:10b6:208:268::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 10 Nov 2021 06:53:57 +0000 Received: from BN8NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ac:cafe::c1) by BN8PR07CA0009.outlook.office365.com (2603:10b6:408:ac::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 10 Nov 2021 06:53:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT013.mail.protection.outlook.com (10.13.176.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 10 Nov 2021 06:53:54 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:53:52 +0000 From: Xueming Li To: Vladimir Medvedkin CC: Luca Boccassi , Bruce Richardson , dpdk stable Date: Wed, 10 Nov 2021 14:31:18 +0800 Message-ID: <20211110063216.2744012-195-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf83051a-1597-4920-969e-08d9a416dc80 X-MS-TrafficTypeDiagnostic: MN2PR12MB4549: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vAXfyEyPOae4GKI71sddPBk/hJR5Q9edfBFPAPDtvJML/fJb0JFpewQe+Z7p+OR3bio/0diZj+7VAOHHb/qCKrovTKCj1zITso0TR+rQtFjqBoD5bcJEhrQdtANCs7qJF8R9kuC/2JoTKwzCAQmh1aP1vb2QT5vCP6YduyF+HCqLk3H3WBq5p6i2kB9M7KBw7+57wyxS8XL2sTT4sDPi/ZGVID6SmtbN+mB173jE6WkJypHVFRuy1//sIPFqtaGPpPciaZj9+imsdGxYAjfWnwVJPDxZViC2PuCUR8zoFk+/dnxjfmVo8W+p6mXEBXfqbWluSNwmcGRPpP718T8Yn71Iyp1HfF478TFo3ucbOBDiVYJMhDMoQzCn73SWmsSlAJLa/EL2t8K2C6IidSbu5GyiKcQU4pbCq+2VWhY1xty9NZJHt7mpgduzNJsDa0fhUopGBEHdUYzGEOoSX8esIc2ygPYgQBmudNydNC3WnR/jJ33Nn+2iqHKWzhTASH1vEPga3VeNUjx+ZNh8NTnJ+zQBj8NLgukXkAUwxR62cEIWx3ZZazK250+DLXPrVAiqEJA5mbJ/eZkcHZPlkp2uxv2Sgc3wq9h+GFDAPDz1+Ou+4mgXczfnIiyawilvmkd4RuAeApjRL+o1svw3vZ707c3AJWPLRGKM8aSLIuQJ3Y5CL3po6cPX5tH5dDb4lDjyxvJ9W7WouEVLT3dwtRaxnRWBIaj6aQsh2/2hIdfAJQ3O87iMp2M6tEPF34zJplD+P+4ranGx3zWB6QEfYw0fG7qJBxvBmSVALN0hCxU3CZswuMiNAJG6yWoVqqdw3ySNaHdjNqTYXp22Tu8Xqcst4A== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(55016002)(508600001)(16526019)(47076005)(186003)(70206006)(336012)(316002)(1076003)(7636003)(54906003)(82310400003)(6916009)(26005)(86362001)(83380400001)(6286002)(4001150100001)(2616005)(6666004)(8676002)(4326008)(70586007)(36756003)(8936002)(7696005)(966005)(53546011)(36860700001)(5660300002)(2906002)(356005)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:53:54.3707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf83051a-1597-4920-969e-08d9a416dc80 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4549 Subject: [dpdk-stable] patch 'lpm6: fix buffer overflow' has been queued to stable release 20.11.4 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/12/21. 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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/d7d89ada026b295b577d0e93c55c383609825ff9 the Thanks. Xueming Li --- >From d7d89ada026b295b577d0e93c55c383609825ff9 Mon Sep 17 00:00:00 2001 From: Vladimir Medvedkin Date: Thu, 21 Oct 2021 18:15:49 +0100 Subject: [PATCH] lpm6: fix buffer overflow Cc: Xueming Li [ upstream commit b16ac536573869ba3afd724947bfa9abbd477f86 ] This patch fixes buffer overflow reported by ASAN, please reference https://bugs.dpdk.org/show_bug.cgi?id=819 The rte_lpm6 keeps routing information for control plane purpose inside the rte_hash table which uses rte_jhash() as a hash function. >From the rte_jhash() documentation: If input key is not aligned to four byte boundaries or a multiple of four bytes in length, the memory region just after may be read (but not used in the computation). rte_lpm6 uses 17 bytes keys consisting of IPv6 address (16 bytes) + depth (1 byte). This patch increases the size of the depth field up to uint32_t and sets the alignment to 4 bytes. Bugzilla ID: 819 Fixes: 86b3b21952a8 ("lpm6: store rules in hash table") Signed-off-by: Vladimir Medvedkin Acked-by: Bruce Richardson --- lib/librte_lpm/rte_lpm6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index 37baabb26d..73768fc956 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -80,7 +80,7 @@ struct rte_lpm6_rule { /** Rules tbl entry key. */ struct rte_lpm6_rule_key { uint8_t ip[RTE_LPM6_IPV6_ADDR_SIZE]; /**< Rule IP address. */ - uint8_t depth; /**< Rule depth. */ + uint32_t depth; /**< Rule depth. */ }; /* Header of tbl8 */ @@ -259,6 +259,8 @@ rte_lpm6_create(const char *name, int socket_id, lpm_list = RTE_TAILQ_CAST(rte_lpm6_tailq.head, rte_lpm6_list); RTE_BUILD_BUG_ON(sizeof(struct rte_lpm6_tbl_entry) != sizeof(uint32_t)); + RTE_BUILD_BUG_ON(sizeof(struct rte_lpm6_rule_key) % + sizeof(uint32_t) != 0); /* Check user arguments. */ if ((name == NULL) || (socket_id < -1) || (config == NULL) || -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:10.519219201 +0800 +++ 0194-lpm6-fix-buffer-overflow.patch 2021-11-10 14:17:02.000745027 +0800 @@ -1 +1 @@ -From b16ac536573869ba3afd724947bfa9abbd477f86 Mon Sep 17 00:00:00 2001 +From d7d89ada026b295b577d0e93c55c383609825ff9 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit b16ac536573869ba3afd724947bfa9abbd477f86 ] @@ -23 +25,0 @@ -Cc: stable@dpdk.org @@ -28 +30 @@ - lib/lpm/rte_lpm6.c | 4 +++- + lib/librte_lpm/rte_lpm6.c | 4 +++- @@ -31 +33 @@ -diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c +diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c @@ -33,2 +35,2 @@ ---- a/lib/lpm/rte_lpm6.c -+++ b/lib/lpm/rte_lpm6.c +--- a/lib/librte_lpm/rte_lpm6.c ++++ b/lib/librte_lpm/rte_lpm6.c