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 B1AF2432F6; Fri, 10 Nov 2023 21:15:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3CD84402EE; Fri, 10 Nov 2023 21:15:59 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by mails.dpdk.org (Postfix) with ESMTP id 48107402EA for ; Fri, 10 Nov 2023 21:15:57 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f4IT6lJpe2uCXMKNxdKp1vSvcChGUDNHdkx4k+Ns3F1jYUgrngP9WGvcMKpXkhPC8Zw43nt/ucsFntNuEZ3Qmdp5Agyk/GtacjvcSR35AJ+F4Z/WHG+uHNOB+nuHqRI2kfrlBJHMpJ8YO1bq4gCSuWyxtTi3zyiPnlicDllAG4tQg+NbKqBWzNCUIj0kShRc0ogB4N3MoQmxzIhYigwMhew+o+K+0ycF3O+niSx/riPiGCWeBLySSGpt9qgBPSxtNWpYmv7JIqp+a0JDxxPjYKfTpiAcdDUhw//j2mXA9Aq8vHmfjCnRFzL+vS/WlFDceBbEhqaEF3LD0MZNviRLoA== 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=KssE5Wald7elxTHhGB66GChh+qiugUWSBPAZhx1jwvE=; b=Ik5fEN6lp45wcaabvB7uGW+fWCDd9Ek4ff9F3qU/3uA9arjufoQaBqukd6WZyqxTtL9eiMWkJkmxmnIe5k+XrsBBT5drMboYgzB0OmLc5+vq5gHpvZ4v0Aooe/k7gnpbi/OP2+tVwSJwHEci1EJw5kq6FORI82MXDwZCTID8j0n/2Ms1FOa3AlGVUbe61h3IbLT09DbeEWAelc7PB+oQTFSIh+oT6VGSDjDrpW8Ywmr3pi+cd9UWZnpJly0gL8bP6lERVoYsvVxdj8S+EFiDOQ3Eg2+B8d2vW/ueDRWSBZ8a5Mn97AzrJi71zD6tgKt0qQ29ct/8wevBC+sgZ2JYog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KssE5Wald7elxTHhGB66GChh+qiugUWSBPAZhx1jwvE=; b=rkZqK8I5AnePW+fh8GS39F1bft6/VCaYVvw8e0yLuMQk+h9EQC2RnD6rIne7VWwmjVKtKOr65A/nMsr7fj5yf1rDCvpkGK00Pfhunt31LCMPiA8DXy/Q4X1ckSGU0A4e1fpObQEfbc2ivUyTqu1REYfqGH1SdKBfv0pz2vw2rPk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by IA1PR12MB8494.namprd12.prod.outlook.com (2603:10b6:208:44c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.21; Fri, 10 Nov 2023 20:15:55 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::2569:edb2:670f:816f]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::2569:edb2:670f:816f%6]) with mapi id 15.20.6954.029; Fri, 10 Nov 2023 20:15:55 +0000 Message-ID: <10312d29-eafe-47a6-8654-380941d74dde@amd.com> Date: Fri, 10 Nov 2023 20:15:32 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] app/testpmd: fix indirect action list parameters parsing Content-Language: en-US To: "Etelson, Gregory" Cc: "dev@dpdk.org" , Maayan Kashani , Raslan Darawsheh , Ori Kam , Aman Singh , Yuying Zhang 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> From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iARRCiQ N3AmBIxZ/A7UXBKLaOyZ+/i3sE6Wb53nrO4i8+0K2Qwyh6LjTeiJAIjYKN43ppxz3DaI+QwQ vI+uyHr4Gg0Da9EPPz/YyKauSeOZCfCB5gIfICO0j6x0SCl8uQ2nLpjxcZkf0gjcwUzP3h+S 3x6NfDji9YEij0zczW/dcSpGgZ6vsFpPrtnP9ZXy6J53yp0kJtOJoOlkEFFdU2yCZnCDseum CoudmGLZVvS0/DzHDJejq+3kK3FDGktZBOxZIIpal+nFqS7lVgOZc4+huVv3jyhzoAUOEyXA XK5j6o7g8STUY+z33QNnHpdLvecMwuzmvqy0jR54yAbZ64mB9QAR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fxJ7sYM4P8Mg5kKOsaoUdyA/2qVe cMh1CLUHXF1GlofpGbe1lj4KUJVse5g3qwV7i9VrseA8c4VIZewdIjkzAhmmbxl+8rM/LKBH dZUMTzME5PFCXJIZ83qkZQ795MTe2YScp9dIV7fsS5tpDwIs7BZNVM1l3NAdK+DLHqNxKuyO 8Zk= In-Reply-To: <2ddf95cd-840d-81dc-1fff-99b3dbe59095@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR4P281CA0356.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f4::20) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|IA1PR12MB8494:EE_ X-MS-Office365-Filtering-Correlation-Id: e3f961ee-d11f-4630-5d9d-08dbe229d7d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c//mPBLkvgjTqib4Y4uaqQq6vAzKn65ksWVUcfzfJmFSwunVUKlOYBwPCqopEu0qK/9Yy+vSDIv5eXcbkiK6UVG5Yz/xz9pusVh/ShUSNDNt+cnzEkOKFLBQNAN03ICKWwttLI/EmHNPpDUaV3nVIra6HE1Cqjn/IeXF9TR9psUUZ/S2xfbyt/evF1Y1VZjKn13TTIdCbIsfe0vDxP2TpQIgCzQiQKD7/JDcqOMu/JysY8s88pPhO4rfpOqjrWqZzZ4g+LlcVyzvYsIiBKaJVYPd+JiMQxDz3hx76MmqLKfy2dp4OKNFhc7W13AZwu1bLOjnEV2+k0wnNqjhRh8pi+RBajKPlX/ggDfBnUV/CYkD4TeuLANyt9n6X15yFYriPli0Cyw2vTkhxJ24qexUv05QIUE6TxGqUCD56Odh2GcFwHGsZw9P19rr9+HSVDgDRiSjzTK5gOV5hKu1Wim6eXpFar5lAAVMX4QFU4pKpZeBAysbGL4/2JBavbJeVfurUwzDxN/S9N/YG3SY+/qbLzozutMluYe/15cTqUBl3fSE9W23B9p5iRKxMX3FIQiBqXcQh+qDFoMla1mmnmX6oeUqMZyM731z2vLzdZ240PeyxVIEQ6Hy85b5H6RtkLWTOo3EGH4k1EfTEr4BNi2M8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(39860400002)(366004)(136003)(376002)(396003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(66476007)(38100700002)(66556008)(316002)(66946007)(2616005)(6916009)(54906003)(86362001)(6666004)(36756003)(31696002)(6486002)(478600001)(53546011)(6506007)(6512007)(41300700001)(5660300002)(44832011)(31686004)(8936002)(8676002)(4326008)(2906002)(83380400001)(26005)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?czRVWDdBZzdhSlQvNjFFRUlPU1lCeGpWMU9yNm1ZRWt5VG5SQTZWT0sramlm?= =?utf-8?B?d1dPeEYvc09RbUNOR0owUkRhRUQ4Zkx5MDBLWXFwYktsN2UrY1luWGhyKys3?= =?utf-8?B?WVA1ZmZDVVE5Ymt2SkJFWmp5L29yb0VMOG42bk9jdHhXbVdKa1g4cnBJbUNu?= =?utf-8?B?cjhwaGphY0JDRDBhQUNzZzk0dmlROFZBS2YvZ2l5ZXIra3AxeVVJc1NDSE5I?= =?utf-8?B?bkNqZ2FTc29xVjhZRklLa1UxbkdxWHExSTd1Lzlrc3FzSmVicXVNL25ZSUlk?= =?utf-8?B?VGhOdCt2OXVmSzBXY3EyRXh4QUJoS3I3V2lJeGNCRDBOSkY0Zkd2SncwY1Nj?= =?utf-8?B?MmlEL28rM0pFWmpBVCtwbXFCZ0NjYWswK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9d-08dbe229d7d7 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2023 20:15:54.9168 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Vk848/rJUcv4gP+NIxK1+Un5IqM2tQI3yIDtnWLYC9nHE/GQ4UIurOXC1TDDj8hG X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8494 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 On 11/10/2023 5:41 PM, Etelson, Gregory wrote: > Hello Ferruh, > > [:snip:] > >>> *** stack smashing detected ***: terminated >>> >>> The corruption occurred in `parse_int()` called from >>> `parse_indlst_id2ptr()`. >>> >>> Inside `parse_int()` the arg parameter referenced 8 bytes of memory >>> while the target buffer was 4 bytes allocated on caller optimized stack: >>> >>> (gdb) p *arg >>> $1 = { ... size = 8, ...} >>> >> >> Thanks Gregory, I can see the problem now. >> > > [: Thumbs up :] > > [:snip:] > >> BUT back to the root cause of the problem, >> `parse_int()` tries to be generic and it support different size of >> variables [1], but it fails on this. >> >> `parse_int()` gets 'size' as argument, but it doesn't use parameter >> value, instead overwrites it with 'size = arg->size;' and uses this >> value, in this case when context provides larger variable size than what >> `parse_int()` gets as parameter, the problem you observed occurs. >> >> What do you think to use 'size' from parameter list, as it is intended, >> instead of using 'arg->size'? >> Or perhaps use 'buf' and 'size' from parameter if they are valid, else >> get the from context/arg [2]? >> I think this solves your problem, can you please verify it? >> >> btw, 'buf' usage is a little more complex, since `parse_int()` checks >> for "ctx->object != NULL" to continue, I can't really be sure about >> intention there, but please check usage in `parse_port()`, it looks like >> when 'buf' provided expectation is to get parsed value in the 'buf'. >> >> >> >> >> [1] >>  switch (size) { >>  case sizeof(uint8_t): >>    ... >>  case sizeof(uint16_t): >>    ... >>  ... >>  case sizeof(uint64_t): >>    ... >> >> >> [2] >> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c >> index 0d521159e97d..cd123c69265e 100644 >> --- a/app/test-pmd/cmdline_flow.c >> +++ b/app/test-pmd/cmdline_flow.c >> @@ -10805,8 +10805,10 @@ parse_int(struct context *ctx, const struct >> token *token, >>                         goto error; >>                 return len; >>         } >> -       buf = (uint8_t *)ctx->object + arg->offset; >> -       size = arg->size; >> +       if (buf == NULL || size == 0) { >> +               buf = (uint8_t *)ctx->object + arg->offset; >> +               size = arg->size; >> +       } >>         if (u > RTE_LEN2MASK(size * CHAR_BIT, uint64_t)) >>                 return -1; >>  objmask: >> > > 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? > 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. 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. > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index ce71818705..7fb3b61d37 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > > +typedef uint32_t indirect_id_t; > + > +static int > +parse_indirect_index(struct context *ctx, const struct token *token, > +               const char *str, unsigned int len, > +               void *buf, unsigned int size) > +{ > +       indirect_id_t id; > + > +       ctx->object = &id; > +       parse_int(ctx, token, str, len, ctx->object, sizeof(id)); > + > +       switch (ctx->curr) { > +       case INDIRECT_ACTION_ID2PTR: > +               /**/ > +               break; > +       case INDIRECT_LIST_ACTION_ID2PTR_HANDLE: > +               /**/ > +               break; > +       case INDIRECT_LIST_ACTION_ID2PTR_CONF: > +               /**/ > +               break; > +       default: > +               /**/ > +       } > + > + > +} > + > > Regards, > Gregory