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 7868FA0C4B for ; Thu, 21 Oct 2021 19:15:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65593410DF; Thu, 21 Oct 2021 19:15:38 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id EB6D54003E; Thu, 21 Oct 2021 19:15:34 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10144"; a="229366282" X-IronPort-AV: E=Sophos;i="5.87,170,1631602800"; d="scan'208";a="229366282" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2021 10:15:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,170,1631602800"; d="scan'208";a="552780213" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga004.fm.intel.com with ESMTP; 21 Oct 2021 10:15:33 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 21 Oct 2021 10:15:33 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Thu, 21 Oct 2021 10:15:33 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Thu, 21 Oct 2021 10:15:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VQ4dzGYTfGU07mkLWcfAGs+jLinGQQNR9qBSzZ1Oor0jI6XdY4Ro3jNniy+4XHA92EJzAJYYhTXa6XgO1KwcTMq1uS8fuwumemnKhVf5eEJiLi/yTSQqRgg4/96/Ya9bt/3l4JiwOURUOXTPz1terfZTGiDjPzEmdKQpnBVHWqV2Pbn/7nFIjeZulu4ezHxiB0a3iHWm82iihEldunUN7KQ9OzNCB5+wJ/TXS8vXMUTNXCEi98hsX8Xt8CMTKuhtmTjHUMp6Z1qykxn+OA0iVWGAft+BTAMGHo+UoQFO3AP9HVXfCRY+fQrW/tNbvDrXL5d+WOoQMgXHxnifvM42Aw== 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=qzpaPRKDpIupZDhDzWu5A1jMubf/sEV+2NBjoRz6Yx8=; b=iYsAorCt3tPm0bUKEaySnuDtiQWE4rQg9ME6RoAtToryNCSwcf9VoQtmdPkQ4ZquES94YcJi601oLJpR3c6qwpbEcGMIwBI+DBD8wLQ62btxNttuDEZIHdKu8tU+BMhwAKBsFHv9kxUMvEv81mEyuD6QtdmWl6GzEyZ8Lx15TkZdVMmRB09b/nKDYLRn8bjLfEOw7jeXNlxd8TWu9zZJSCS4wKvRWunUS5sKnVxTXP7+R2U7xvlHRmpwJbg3JhOjKR9IPbwSmSz9suawTe+nU65Gqg3CBO0AMdY/wfGc0NciJvbLIE7rkTx8zQ4gBbVX4Yvwbp9sW3UP44luIQe9dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qzpaPRKDpIupZDhDzWu5A1jMubf/sEV+2NBjoRz6Yx8=; b=JgMgxpycMvJMEq6QQGtwNTdo1vQm9Zc5kAWBAa/pZ8u72jIDKYYZ3uPC80zKuQCkTNNLhlWDYTdSCCoon3F26zqE3bGtOLTgOWPZtdTb9KeyRPvz3ifTLhZjsm2BCJwo4HMpOgqW8zJpjEryNfYuOXpDcg/lbr7JGKJ4jnQTc/I= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=intel.com; Received: from CO1PR11MB5012.namprd11.prod.outlook.com (2603:10b6:303:90::18) by MWHPR11MB1808.namprd11.prod.outlook.com (2603:10b6:300:10f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Thu, 21 Oct 2021 17:15:30 +0000 Received: from CO1PR11MB5012.namprd11.prod.outlook.com ([fe80::442b:2192:c62b:c6c3]) by CO1PR11MB5012.namprd11.prod.outlook.com ([fe80::442b:2192:c62b:c6c3%7]) with mapi id 15.20.4628.018; Thu, 21 Oct 2021 17:15:30 +0000 To: David Marchand CC: dev , Bruce Richardson , , dpdk stable References: <1633728537-197824-1-git-send-email-vladimir.medvedkin@intel.com> From: "Medvedkin, Vladimir" Message-ID: <988e9f4e-128b-bedc-4eb3-0eefb34745fc@intel.com> Date: Thu, 21 Oct 2021 19:15:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DB7PR05CA0068.eurprd05.prod.outlook.com (2603:10a6:10:2e::45) To CO1PR11MB5012.namprd11.prod.outlook.com (2603:10b6:303:90::18) MIME-Version: 1.0 Received: from [192.198.151.54] (192.198.151.54) by DB7PR05CA0068.eurprd05.prod.outlook.com (2603:10a6:10:2e::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 17:15:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f841b128-587a-41d3-26f3-08d994b66257 X-MS-TrafficTypeDiagnostic: MWHPR11MB1808: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr 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: 2XuTkLBoqSq35ABkEJHsZm8kqH/8oUQXt7iRBdMTJ1IVEIJi4xlNIUDCe6FglI+x0AAVwdpU5kDTY8PmkFocYaAX18SVXwjkGsN7jcY9GV/3liTqKJFpjiumJK1hp/fFQfoh31FME41ujGBV+vlLKEmOGzy72AQY5aDjGNFgSSufWkp8wXZ285x9JD1Bg0Fiwv/kvT9OJk/JLqat7q8Cu/9bVIg+kFySTScw17OOnseCpvchZQmnfRtJhwzPhWR5CzfvD8xHV9Q8Qx1TZYYJlUsYCD6Gh8aR02cmAEBOEHdgG1X4UBQj3ADa/TO6cw2iwE6d6Khj5zSzhaIWYt7ef+aAoU5g5hK0FC6cU3KRjA/EodF/PdRna0tXRq2XTITZbQsjY2SO+zqP2yW0Lq4UGF4ZjYZlQKopgFAdF9Z2xGiE9Hr8x5c1QctO3hkSkPaIeb+quoFh+nw1jyOONgPtYNcsGduvJRJUGwFt1TsbQu4gYKdEnD5GdQiSVc4m9JQ7b23X0lqlcJiiM+Fj+n4EBqoMTsN40GvHjKvCT9w5GiWM7gLafTwm67eb2OBaqERb5m/oHiugUO7pm1H1vSvqadNxnn5yZ3ogm4kN2HNJXvnVIayeJq3vt/HMJgYq68V8AvQio71CE4DLBPVUGeUDERNLvHcVZ0+IyGVm5SIlREu7PBW/d8bEZyYTq6Qf4jQsnikuAAn3RkSNQcFx9vuBTdkw8g9hHrDA/mQnhws8K27X70DdvBfuBE1nHhfcmJSapfe74DIXFKBp7qX4hsC1oGNPo6cAZ6LLe/KfXS+JQxwGCG4k0Uq1uLij+ydfcru266Mo5YQ8dh4Sl7lAFby4NA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR11MB5012.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(6486002)(82960400001)(5660300002)(2906002)(66556008)(66476007)(66946007)(8936002)(38100700002)(54906003)(16576012)(316002)(31686004)(83380400001)(31696002)(86362001)(36756003)(53546011)(956004)(966005)(508600001)(8676002)(26005)(2616005)(6916009)(6666004)(4326008)(6706004)(186003)(3940600001)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UC9pdlB4c09LcHlrcEx0d1JqL2JqVnRsZnJIUE9RSHBhMDdlSlBBSWRTalo3?= =?utf-8?B?NEVLZUZ4c09ncDQ3MWpjbDFPcThUQ0ZpeWl1STkrV1hlM0hMWllzRXFNUGJq?= =?utf-8?B?bWJWbVk5T3AwclprdUFVbmRuYWx2NGxveUpma04wc3NLaFRaRkRESElidk12?= =?utf-8?B?TlRwbTEzSlRYRWhtVVNmZXhiUlk3bDQwK3dUQWdoZVlHaDlBLzA1c3RRTVlQ?= =?utf-8?B?QmxBYzlLdU5QZXoxbWY3WCtoVDRFZnlzcjhBeXIwSGlwcW5zRk1FUTkwbGdU?= =?ut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U1ITjFjZm55SG5FMDJ1?= =?utf-8?B?TUNuRWxWZ2hVMXh4RnZwK0FZU1cxeHRKTG9JNVZMMDlIVTFNUUVEQzR3ZU1s?= =?utf-8?B?Y09GMEc1UjBXWXY4aUZiWFJCR2o2eVBkeHBIMXhPMXVPVHlpM2d4aGt1bFlP?= =?utf-8?B?YXRzU1NqMXdUaEt5YmFaK3NGRGpRZnBmZXNLb1NrNEpEOWJBQjRHU0duOHFW?= =?utf-8?B?Z0hVMlhFaEw1U2FCaWlaOGh2Zkk2QUVuajFLZ004emNiZ045cjVtbUZRZFR4?= =?utf-8?B?ajlQVHAwZjM2V3hiL1NkOUhCQTlqVFhjQXh3bjdVMCtqZUpiS2J3YUp2ZTJa?= =?utf-8?B?bW14UTF1NjdUZUlTbzhvbkNvdHRFalpiSSsrUWlrM0xYbEJxOG9Fekd5QnMy?= =?utf-8?B?NDNSOVh0YWlHSFFYVjUvd0w0L2xhQ2w2VVkraDc3bE9HaGZrZGFxZXNxVkNo?= =?utf-8?B?TklNQ3htNG9pWG1TeHNTbDhBY1l6YlQyaElPTEtvem9INU93elkwUUhrQTdZ?= =?utf-8?B?MW4yMWowbGoySWk5ekVXdHBGMjBhOXI1dFk4SWRINkZJaUpMaEJLLzczOXh2?= =?utf-8?B?b2pkaE82VGVDMUY5UHA2TVU4LzRyNUtkVmFzLzcydWRuRWRjbFVpT0IzdHlB?= =?utf-8?B?NXcyeFZpWW5jc2E1bEVBdWROMS9mTjJTZWJTcytPV0RMYmdocWtBWTMwNXhT?= =?utf-8?B?b29YanZXVlJrUFV4Zzh1OU9QUTZ0eFZIT1lQTDd6alN6SmxpNmRVMlF4VVpI?= =?utf-8?Q?OLPBUBY2C8fsQsp7uFobWcV0OccWbQFA?= X-MS-Exchange-CrossTenant-Network-Message-Id: f841b128-587a-41d3-26f3-08d994b66257 X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB5012.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 17:15:30.5747 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vladimir.medvedkin@intel.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1808 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH] lpm: fix buffer overflow 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 David, On 20/10/2021 21:55, David Marchand wrote: > Hello Vladimir, > > On Fri, Oct 8, 2021 at 11:29 PM Vladimir Medvedkin > wrote: >> >> 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") >> Cc: alex@therouter.net >> Cc: stable@dpdk.org > > This change should be internal, and not breaking ABI, but are we sure > we want to backport it? > I think yes, I don't see any reason why we should not backport it. Do you think we should not? > >> >> Signed-off-by: Vladimir Medvedkin >> --- >> lib/lpm/rte_lpm6.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c >> index 37baabb..d5e0918 100644 >> --- a/lib/lpm/rte_lpm6.c >> +++ b/lib/lpm/rte_lpm6.c >> @@ -80,8 +80,8 @@ 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. */ >> +} __rte_aligned(sizeof(uint32_t)); > > I would recommend doing the same than for hash tests: keep growing > depth to 32bits, but no enforcement of alignment and add build check > on structure size being sizeof(uin32_t) aligned. > Agree, will send v2 > >> >> /* Header of tbl8 */ >> struct rte_lpm_tbl8_hdr { >> -- >> 2.7.4 >> > > -- Regards, Vladimir