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 C709141E77; Fri, 17 Mar 2023 03:44:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6E1540DF6; Fri, 17 Mar 2023 03:44:13 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id E663040A79 for ; Fri, 17 Mar 2023 03:44:12 +0100 (CET) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Pd7fv0z5Dz17LSq; Fri, 17 Mar 2023 10:41:11 +0800 (CST) Received: from [10.67.100.224] (10.67.100.224) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 17 Mar 2023 10:43:37 +0800 Subject: Re: [PATCH 0/5] fix segment fault when parse args To: Ferruh Yigit , CC: , David Marchand References: <20230314124813.39521-1-fengchengwen@huawei.com> <53326af4-26ab-eba7-047f-42917e8f3b00@amd.com> From: fengchengwen Message-ID: Date: Fri, 17 Mar 2023 10:43:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <53326af4-26ab-eba7-047f-42917e8f3b00@amd.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 2023/3/17 2:18, Ferruh Yigit wrote: > On 3/14/2023 12:48 PM, Chengwen Feng wrote: >> The rte_kvargs_process() was used to parse KV pairs, it also supports >> to parse 'only keys' (e.g. socket_id) type. And the callback function >> parameter 'value' is NULL when parsed 'only keys'. >> >> It may leads to segment fault when parse args with 'only key', this >> patchset fixes rest of them. >> >> Chengwen Feng (5): >> app/pdump: fix segment fault when parse args >> net/memif: fix segment fault when parse devargs >> net/pcap: fix segment fault when parse devargs >> net/ring: fix segment fault when parse devargs >> net/sfc: fix segment fault when parse devargs > > Hi Chengwen, > > Did you scan all `rte_kvargs_process()` instances? No, I was just looking at the modules I was concerned about. I looked at it briefly, and some modules had the same problem. > > > And if there would be a way to tell kvargs that a value is expected (or > not) this checks could be done in kvargs layer, I think this also can be > to look at. Yes, the way to tell kvargs may lead to a lot of modifys and also break ABI. I also think about just set value = "" when only exist key, It could perfectly solve the above segment scene. But it also break the API's behavior. Or continue fix the exist code (about 10+ place more), for new invoking, because the 'arg_handler_t' already well documented (52ab17efdecf935792ee1d0cb749c0dbd536c083), they'll take the initiative to prevent this. Hope for more advise for the next. > . >