From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 92852432E9;
	Thu,  9 Nov 2023 19:22:46 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 81F5840ED6;
	Thu,  9 Nov 2023 19:22:46 +0100 (CET)
Received: from NAM10-DM6-obe.outbound.protection.outlook.com
 (mail-dm6nam10on2048.outbound.protection.outlook.com [40.107.93.48])
 by mails.dpdk.org (Postfix) with ESMTP id 760774026B
 for <dev@dpdk.org>; Thu,  9 Nov 2023 19:22:44 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Cx/og/EXhx4GMqewwFisuhLd2T70T4ksENJSRaQwFQmev0636sb0TURy8762CjTga1t23j1RW8S2ngmmWY4PXOj8bP4f/PaFv51ZIoHWIdN5cmkK45m7OuuwzivateyDqkXsgLWMF40XI5bJRYJ2TS0WNPenR0FeEgBv4XSpNpXARvIf0PI+FhWJO6xtouZHHCyy+TEP0YOBELIESV+IgRGnyh/u966GCuyYZI9QO/IaqK1dY19ORW8CLrX6dCUH3hK19zAtUENYsYOvCrkvsDMCy64qlcwQK760urz9Cx1uVXVesy0NuNfJK/gRxaronRPuo0Ro5yOxBZ3LfOMxSw==
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=AR/wbQUHpztBBFJokAeYcukKcNfqn+YnPrW4quN6m8k=;
 b=DZo0ak8wviKkYhTk5KA4Fip7PBRWUBvn7E4d0vdn5XMdNJopZ3PE0g8ZHspB90d8rWELCEdHdA1F4diojUdi1M3A+YCI69c6htookmlMQBvI6T1qesbQ4pkNZyEvC5Sx2KP5qZF8OQ4wvCeuNSB4pnLJJKN2OhpL/nbNaeGdfc6vt5s472klBQNPhLaVGmaVFze0qRpG38OdbviZYDGxs3e4wj+nIi7GCNTtJmRNedqNRYQfhc5UUApL2x5RclMvvY5XUsbSLliXijH4FcEOYGsXHvetk7/VY0JzeXqqfyTF73Tf/sbIU2LF5Ij4t1VWkMdXO7KTRphDWCgsMZzvgQ==
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=AR/wbQUHpztBBFJokAeYcukKcNfqn+YnPrW4quN6m8k=;
 b=R68RHRy5piLxUmPEfA40N6RU5nZ30XZrFbhYpRc3oW1TUDgoTeGfjGEQ9vK4eap0FlA/cRqaT5TOFRrq1WqExokYAAB6j52HdZ9Lu3HxKK45PiNPg/gG/NQSwTmZjLn7B6mz1nMnXlucmuxaowLnwhEELkVNpYM7ptnfGdq0r20FXxc9hQ/kTnuuPm6L4Zg3hz4UGrxiQxo+GsXaIY45u8U0gGPdRAw6cIP75kIuO9DVMVFVtbQ416PWSCYXGzoc2N6AKNboSBPl0SCJ/5xFJMQv3wGSPXvq9KTTlydA/3N3XhiTDXouV5EgRW2rCdVD3bTlk7ztwufEGPgr7GEm8A==
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 DM6PR12MB4894.namprd12.prod.outlook.com (2603:10b6:5:209::12) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Thu, 9 Nov
 2023 18:22:41 +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; Thu, 9 Nov 2023
 18:22:41 +0000
Date: Thu, 9 Nov 2023 20:22:37 +0200 (IST)
From: "Etelson, Gregory" <getelson@nvidia.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>
cc: Gregory Etelson <getelson@nvidia.com>, "dev@dpdk.org" <dev@dpdk.org>, 
 Maayan Kashani <mkashani@nvidia.com>, 
 Raslan Darawsheh <rasland@nvidia.com>, Ori Kam <orika@nvidia.com>, 
 Aman Singh <aman.deep.singh@intel.com>, 
 Yuying Zhang <yuying.zhang@intel.com>
Subject: Re: [PATCH] app/testpmd: fix indirect action list parameters parsing
In-Reply-To: <bd8fad06-ebd7-491c-a0ef-9adc92ffaae9@amd.com>
Message-ID: <9c982259-df1f-bdce-11ff-554831abc42f@nvidia.com>
References: <20231108163445.422772-1-getelson@nvidia.com>
 <bd8fad06-ebd7-491c-a0ef-9adc92ffaae9@amd.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed
X-ClientProxiedBy: LNXP123CA0016.GBRP123.PROD.OUTLOOK.COM
 (2603:10a6:600:d2::28) To IA1PR12MB6332.namprd12.prod.outlook.com
 (2603:10b6:208:3e2::13)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: IA1PR12MB6332:EE_|DM6PR12MB4894:EE_
X-MS-Office365-Filtering-Correlation-Id: d77a23b2-dbae-4d41-8b38-08dbe150dc66
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: 0lTEHmChtuPmvkw+/Ls/B2uKNK1b44vIwWo3oaFZ+sG9KFlNqoHGfrtftHs8QMHl1wfZ4K1DMTxD/UlkaM7wACUFfiIUoatituYrL73RAkJlwVM9j+nTNFMytpj5LgHWoRIX0QFtyDcRBrvCuUoXmL+Xdh+gfUhi6y5O947fWjnoaetZmjFidpHXZPFy8vEQniHQT9ul0qFJvr4+GlbkzvskPmPPMxJfjG26u9r/8UNJ2edXFQ/IWCCfsAnVdw5fP+t1BgN5TR5kQQOSoEGGq074gRqjFygFZi+9xJBdixz2ytktvR99ND2Z/udjpQH8qgpi8IjHyvskINNM0xeMk6jWrdNQr2hxY1Kh3bUrWfvsYIjIFTya9AdTVhDNmYwfYCjWJIw/o6SSElquY+EHSxPHlZZUAVr5Irj2ga/yfjH6Y8DSg5ibOUnfMIiHkcxW6GJdo6DXeE2t/rdn36ccguTYD68Y6+UHbBIeyMupevQTFvlghQ2hzklqS/XgkeOwnzYLHBmttJ5zGWBgHfM+iMffvXowt0+Yg+q31uQ9KKAP2Vvqz5JFI1vtmAp0N/1H38znkRv31cjfEuMfyDF4QgEzLrQwx0ABFDmVKj7hgnk=
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)(39860400002)(136003)(376002)(396003)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799009)(36756003)(83380400001)(316002)(6916009)(6486002)(38100700002)(6506007)(6666004)(66556008)(66476007)(2616005)(6512007)(54906003)(66946007)(5660300002)(8676002)(8936002)(478600001)(31696002)(41300700001)(4326008)(86362001)(2906002)(31686004)(45980500001);
 DIR:OUT; SFP:1101; 
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5Npc9P9SxekhQL8QIuAefgHFv3FLVtaapdlDZnKM9bzR924Rus5d8GSiv1BT?=
 =?us-ascii?Q?sO1FJZf+Tro3Pv9RhQJ+d9L0GjiuxKa7JZ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uUOETfLDgO3aFzT?=
 =?us-ascii?Q?N5c6VOVduiPPEbGKxzA8TUXP3OJoAl6U84jyP42uyix0z/e2M6cYEcnraoZu?=
 =?us-ascii?Q?weLp8UfjBhtP2//oGS8TLmwDm6zmxBlZvLrWDZ7fCSqW5LXpPj3bCltzCcG0?=
 =?us-ascii?Q?Fl9mgs0CNOCcQXCA0MKT/gDXmcyN2oQIDcDfG8dJPl5wMCngrAs+lP6F49oj?=
 =?us-ascii?Q?K4MTgFqG2Qv9kx/v6b3UWb5jsga0955eGb4Lb0/8KikfcpXsqswcGUQN7QVF?=
 =?us-ascii?Q?E1RwnND5qVO1qH+nluc1QxNJlbsysvt1h4jD+di2iwt/O2698XZF7fqY2GH6?=
 =?us-ascii?Q?TlM+MBzJv/E5YfJfHFnuVvLedpPqs8TFEdeLjxP18lSI6dMW5OGyYZ3AzUms?=
 =?us-ascii?Q?Vn1tavO7VOfuGO4NYOx+Y9DM943jJfS8AflVUf10z/fxZ3PLmxfrDBkMnLAm?=
 =?us-ascii?Q?mhbxfMZWwPYLsqup5uR0ZiKN8GgjOpRHvOuByJTnwO88WbpzCahOVjuhoaqd?=
 =?us-ascii?Q?Fq1y4YDxBArpnq6b3cKmJKgrDYCVm1oVnRPJcAxiZAR2xThd6wa+92iOWtZi?=
 =?us-ascii?Q?8+5mxkvs/KYeoYXPGu1ZKHrJgsbnlHzytg3/YJf8dljW/c08P8FFG505LDLV?=
 =?us-ascii?Q?jd0xa5YTmF7PvFsUwnO/qN7ZPMyumknTgzwTJrbjJPBOS96Fj3BRApkl5Xe6?=
 =?us-ascii?Q?zepv46hUeK7oJiMWYdoOInh3pi73Dk1uyalLPjhLAC6x?=
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-Network-Message-Id: d77a23b2-dbae-4d41-8b38-08dbe150dc66
X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6332.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2023 18:22:41.6455 (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: q4UiQXIxfiwo/Qz0Q9rZWdzOhx2g3HM6zp572Uh3hHp0nyWaTs8eyyDiNsQkwO5dWv78PKh8n5qJWiRnsuQvIQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4894
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Hello Ferruh,

>> Indirect actions list arguments parser was configured to place target
>> number into 64bit value, while the code provided 32bits memory.
>>
>
> Hi Gregory,
>
> Can you please give more details why 'id' needs to be 64 bits, with
> callstack or usecase etc?
> And please describe what is the observed problem with current code?
>

In rte_flow.h, struct rte_flow_action_indirect_list::handle is a pointer.

Testpmd ACTION_INDIRECT_LIST_HANDLE and ACTION_INDIRECT_LIST_CONF tokens
define arguments size as uintptr_t.

On 64 bits system, defining the id variable as 32 bits value
corrupted parse_indlst_id2ptr stack.

I'll change the id definition to uintptr_t to match token in v2.

Regards,
Gregory

>
> Inside 'parse_indlst_id2ptr()',
> 'parse_int()' can work or 32bits and 64bits variables, so that one is OK.
> But both 'port_action_handle_get_by_id()' &
> 'indirect_action_list_conf_get()' gets 'id' as parameter and they get
> 32bits argument, when 'id' is 64bit won't it will be cast to 32bits and
> loose data, should those functions needs to be updated as well.
>
>
>
>> The patch updated variable size for translation results.
>>
>> Fixes: 72a3dec7126f ("ethdev: add indirect flow list action")
>> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
>> ---
>>  app/test-pmd/cmdline_flow.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
>> index 0d521159e9..cf1ca33208 100644
>> --- a/app/test-pmd/cmdline_flow.c
>> +++ b/app/test-pmd/cmdline_flow.c
>> @@ -11331,7 +11331,7 @@ parse_indlst_id2ptr(struct context *ctx, const struct token *token,
>>       struct rte_flow_action *action = ctx->object;
>>       struct rte_flow_action_indirect_list *action_conf;
>>       const struct indlst_conf *indlst_conf;
>> -     uint32_t id;
>> +     uint64_t id;
>>       int ret;
>>
>>       if (!action)
>> @@ -11350,7 +11350,8 @@ parse_indlst_id2ptr(struct context *ctx, const struct token *token,
>>       action_conf->handle = (typeof(action_conf->handle))
>>                               port_action_handle_get_by_id(ctx->port, id);
>>               if (!action_conf->handle) {
>> -                     printf("no indirect list handle for id %u\n", id);
>> +                     printf("no indirect list handle for id %"PRIu64"\n",
>> +                            id);
>>                       return -1;
>>               }
>>               break;
>
>