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 3A431432F7; Fri, 10 Nov 2023 22:22:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A536402EE; Fri, 10 Nov 2023 22:22:29 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2077.outbound.protection.outlook.com [40.107.92.77]) by mails.dpdk.org (Postfix) with ESMTP id BFA6C402EA for ; Fri, 10 Nov 2023 22:22:27 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JgfrvXGLXv8zUjx+o/h1N817h93qBY3gDzzyyGqmpa3NAZavmHGexobEC3JIqRuvFrKPVO3t2j3FirqmFBG+yRA3ibhB4Q+DMIxJIz43LqqB63zAGnz5XAXJ5VxIanEDj8TDaStYpM0+VPf3rms/9Y1TsONR/JwNBqZxbSGNLZlKkoImlEMynO5pn5NH5V4WxZQLfc4fZSP931NOqmetDwK6A57MonhaSVp13oOf827G22ihupygmqZZiq0VUQMezkPXV/1wBGqbZvSRdNuFKg8QLG9LVVWiTw7JciMjoQz5b180WbEYMwRi6bD5q+p+W8gt4wSRMhlGxh2U6Vg9iA== 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=uoCBH9Vp3LVWg40Ks5mpIWLdVvnqY7zMIUhEwAjbTrg=; b=GRBlskIFkEC0j+v5TKDYIpjETD7YWPgjxHSa50R13cJVS7VCvAQds6VYPBVj4tVhMVzPCRLPOyCQIS+qTFT1Xtqhc4ExVkmHrC2XO7n7MG+5K1Ckn/4dy9QnGvS4YWggU6F6p6FvS67d1ixYQK00vgynsKV9qOr1dQpSwMDPMqRWNIcDb1I2nF00Z6bF08Qwzc3xFC7ITk3qgMViEhwLqJEYHkjlhUrONYbgxjoNlBrs48n5fsML3gYbA2053Qljh4NHSqFcn6CIGS0Gbg4WU15WqbEvAHMLp3LY/9PjPAFxeCeSJxgHbGWJO2PY0sd1YOp9pzubLCxeKOUGYB5KWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=uoCBH9Vp3LVWg40Ks5mpIWLdVvnqY7zMIUhEwAjbTrg=; b=dGn47GgRBm/HHUpPID2mwN83b5k6UXUouXjTDrh1k441QhGjXYoWGxUrpWSrlgr0h7eN73KosI0dYbEDYsWE0DpBFyOLGTv8OzX5rDEcHCSC8XnIyMrt5qENL+L9oxXJ98tbwhZ8X/NbDoB8K1tDRZdyaBh9mUoDAe6dxiHU8IL+eNVTY8R2Du+91oK0fcLRvFndRSfXxjPk5orVP7+4Qgz4ByPpKm9aZflLfo0/ME/ATcaYWGzWU2i+u7rXV+HqXH91sAxygHTosSSzQKCqIUuCS683RB7MEp0G322Ri96GM6575DDNnBTOaKKZBEg1X74fAs8ZHN3iKhDniTp8wg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6332.namprd12.prod.outlook.com (2603:10b6:208:3e2::13) by CH3PR12MB9028.namprd12.prod.outlook.com (2603:10b6:610:123::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.19; Fri, 10 Nov 2023 21:22:25 +0000 Received: from IA1PR12MB6332.namprd12.prod.outlook.com ([fe80::43ed:468d:3105:4071]) by IA1PR12MB6332.namprd12.prod.outlook.com ([fe80::43ed:468d:3105:4071%4]) with mapi id 15.20.6954.029; Fri, 10 Nov 2023 21:22:25 +0000 Date: Fri, 10 Nov 2023 23:22:20 +0200 (IST) From: "Etelson, Gregory" To: Ferruh Yigit cc: "Etelson, Gregory" , "dev@dpdk.org" , Maayan Kashani , Raslan Darawsheh , Ori Kam , Aman Singh , Yuying Zhang Subject: Re: [PATCH] app/testpmd: fix indirect action list parameters parsing In-Reply-To: <10312d29-eafe-47a6-8654-380941d74dde@amd.com> Message-ID: <703d0804-606b-9539-29fc-20cf74dafb6a@nvidia.com> References: <20231108163445.422772-1-getelson@nvidia.com> <9c982259-df1f-bdce-11ff-554831abc42f@nvidia.com> <01176d6f-7f4e-465e-b0e3-20dd6a7e6d18@amd.com> <95a14c2f-f6ba-4133-b787-99c2feb8739c@amd.com> <2ddf95cd-840d-81dc-1fff-99b3dbe59095@nvidia.com> <10312d29-eafe-47a6-8654-380941d74dde@amd.com> Content-Type: text/plain; charset=US-ASCII; format=flowed X-ClientProxiedBy: LO4P123CA0037.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::6) To IA1PR12MB6332.namprd12.prod.outlook.com (2603:10b6:208:3e2::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR12MB6332:EE_|CH3PR12MB9028:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d666a22-5e1b-4b4f-29dd-08dbe2332255 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CzDeyCE2NxymY2zMvALMQW/WSQCCWQRVdRcWduVZ3U3mONqIlMTaGTLgiFLsTi1ur0IwmYsAaWxrOq0XefPlv4tMiFuJuXsB8NQJBJgARfWGCOtim9uuxw2ojEkdnJvKD6OPkbOUScJbtdQsyX0QiSLw9THNDs/JV7rHh6cz8dkZ//WxzTFlrFsqNWLEVX668W15EczRcc5UHhVlHusds7YxCNk/FfPES/IoTVxSzCkeuygIqROV4/h2olet5US/hHdJdv2DtKSmoBeDjZ3WOGigzusz8hujKwY5dnycwK8KrVNlv5kTG7FOdMah/JUK9xhF6AX023c1vLLFRbX2J95jA4DPZXqpigEgLAxpeU31PZ6ahPnXGRPXJl0C/WAA+PXgpHXknXkH2pcztwVga1UpavZ8gnLQsBgiGp/5+Qma1sFA9z7t3K1jPtjQNKW38rR7BVmnhORTa8ReO6bILoQfFsbnOzruPfgp8DwyiUJV4eGoiZfRufY7mt6IfjLMcPRHqMh6YsXVpHpUwk53ial95gM0KnkCt4gPgqwPrpxX5TXycGOCg6eaIZkwepD5mWZc2qfkP2WbzxmlOwGmVW31A8Rc74XYRocWldwZDxIq5KPhKhEDwXyrl6PaM//o X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA1PR12MB6332.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(376002)(39860400002)(366004)(396003)(136003)(230922051799003)(186009)(451199024)(1800799009)(64100799003)(6916009)(316002)(66556008)(66476007)(66946007)(54906003)(6506007)(2616005)(6512007)(6666004)(36756003)(478600001)(6486002)(83380400001)(5660300002)(38100700002)(41300700001)(31686004)(2906002)(31696002)(86362001)(8936002)(4326008)(8676002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZLS3RFESwOwurg27IoAZrB+eI/RX7sQPN4t9sPRZhkE9gUE43Wr8wy/ok95v?= =?us-ascii?Q?enSUwC7FiBwyCjMHzvVFzkM7QuqoXjS8GxO40JHPD9HsObhJS6vlAdvwEID6?= =?us-ascii?Q?FPyW7s9Rr9lSp8h00+8liBYOUPcymYlpbyb4tuntH5SAAHCsxnWsqI2GkQJC?= =?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lmnUjtCHrgiCUYAxIjO1SrRE2/ggGWTwE?= =?us-ascii?Q?dtHuowxa+Gp8wl2TW2uooiSXbOGovjqiWYs5+zZdyrP6nh1MnA2JdaORYeVI?= =?us-ascii?Q?l8kqZj0VCq43ru8+eHyf9LHsPApSUbQdXA4hePS6v7D1uXqD/NpZ99tVcGSY?= =?us-ascii?Q?PpEp/B7aaVhcr/Z/qX0Ndzhu07bxWNO4Lt2S1/UFntjUrr/jdxwgnWp2gs4l?= =?us-ascii?Q?08h0d0UB1jPTaYN7543v/e/lA5oRdjMpSN8nUcaFtdHmOBew6LSeo+wRZWL1?= =?us-ascii?Q?0ayUiU2I4EWpKPvKkYgQXCIxnuXAoUj58BHD4iRss2jf5yWElmOt1MdywyVz?= =?us-ascii?Q?ifwVC1P0BnIv9Sm+YLmdfl+ock/9+1CPaYCVgE2en900oSln1dGGV5oZwwE4?= =?us-ascii?Q?7sXSMLhf18b5sxhvRHWubm1H75DpgD9ttUsXGUmwXUIb97mu4gUZHcjMCNRb?= =?us-ascii?Q?2xlRAvo4La1ACtrqM6iMiZKBB8x0btvj8yIx9apJVJyacOPZjKjd78qfRRoD?= =?us-ascii?Q?6V4SSTSyv+6iui793IAJDILvV0OB7XH+z1mPr1hLjOdXNNZlwYQHkd+fAN3M?= =?us-ascii?Q?vjGgGr3GeEGkp1Su8JP3yLQCERfoT9Za8A/JSwSMmzeP?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d666a22-5e1b-4b4f-29dd-08dbe2332255 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6332.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2023 21:22:25.2458 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XI+Eu5X16e1CwMlO+gibFqtVdqSGdaIUBAvhtLzwE7MtZ/fcFq2MOSFGbq1vTi26cN0HAh0XMituJ2erB9+Nhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9028 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hello Ferruh, >> About the fault root cause. >> There were 2 uncoupled resources in that case: static token size and >> variable size passed to parse_int(). >> parse_int() caller must provide a buffer large enough for token size. >> Otherwise parse_int() will corrupt memory outside the input buffer. >> > > As you said 'parse_int()' has two sizes, 'token->size' and 'size' > function argument. Why function ignores 'size' argument and only uses > 'token->size', I think this is a mistake. > > > If 'parse_int()' doesn't use 'buf' and 'size' arguments at all, why it > has them? > > parse_int() receives target buffer size as an argument and also has access to original token size through the arg pointer. In that configuration the token size has priority. parse_int() must compare token and buffer sizes and return an error if target buffer size did not fit. That will not break existing parser_int() functionality. I'll send a fix in a new patch series. >> In the generic solution parse_int() caller allocates target buffer using >> existing knowledge about input token size. >> >> Testpmd add_port() imitates the ARGS_ENTRY() macro that extrapolates >> target buffer size from RTE structure member. >> >> Current testpmd cannot use that approach directly because indirect >> action references internal testpmd ID. >> >> Testpmd indirect ID has no defined type or token that leads to indirect >> ID parser. >> >> As a solution, testpmd can provide centralized parser function for all >> indirect IDs. The function will parse ID value and use the token as the >> key to indirect database search: >> > > Although it sounds reasonable to have indirect id parser, won't it have > exact same problem? > > If token size if 64 bits as it is now, as far as I can see below code > will have same stack corruption problem. > The function parses indirect ID. That ID is translated into the original object of any size according to token type. That means testpmd will have common pool of 32 bits IDs for all possible indirect translations. > > I think we should update parse_int function, to use either function > parameters or context values, but changes has potential side effect and > timing is not good for it, let's continue with your v3 for now. > > [: Thumbs up :] Regards, Gregory