From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 45B801B24C; Mon, 9 Oct 2017 23:27:13 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C789520D3F; Mon, 9 Oct 2017 17:27:12 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Mon, 09 Oct 2017 17:27:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=rBqDJNuFVcaTiLe xdU121q4jCmNaEDheIUvnOJ4HkU4=; b=mYY1M5TTdRedko/LrPoj3ugNFRnzLF1 OvZZ4qdBSQYc3GxhaBoD1qdv107TAwOuAWIZyyxQ0U4gvBPyeCR2B9G4RItEGmh3 Jn9IIWOQTuPAf8+I97mAPwSmRP2P1t97+NWBS26zZa3OMQW759GJg/GvkicI7Vfc jjGdsi1XVUdo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=rBqDJNuFVcaTiLexdU121q4jCmNaEDheIUvnOJ4HkU4=; b=UAW3vqj2 2t+EyzFvrPeMbiJaK+WAuxm3nLKpRXaPsdin56rjvhPHAajEriw2qfcxCZ6alvGv 9wCI9yO7HFNkaBaNJhnbxquHCKvtayxp2ZHtywTNSPCyZtluBo/X1+VS4cRKWMcP b/pcZ93MnE98Uek5JCP527kvMdX8InLhDozqRpB5mPXQShBSNKbkx2JKF4qMQX3p kBV3ON3tgyoHvVW9Gu4bHT0XsONO0QJyeijiQxgXY3BhBu/cSK+GUjKGFyV/b/hJ WCYh4FFrnWUNEuP8o+34ndztOqGuPju1mnBLSlJEZbTfEIzDTrkV1ygi6dFB5TsN MnLJYB++QsvBqQ== X-ME-Sender: X-Sasl-enc: s1URKvIINy3ZvtNlhM7r3FszAO9VFC0NtHS6jVpf2Wdb 1507584432 Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 5376B24141; Mon, 9 Oct 2017 17:27:12 -0400 (EDT) From: Thomas Monjalon To: Patrick MacArthur Cc: dev@dpdk.org, Sergio Gonzalez Monroy , stable@dpdk.org Date: Mon, 09 Oct 2017 23:27:11 +0200 Message-ID: <94235766.fjgY1ahyDR@xps> In-Reply-To: References: <20170804185357.6612-1-patrick@patrickmacarthur.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] eal: Copy raw strings taken from command line X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Oct 2017 21:27:13 -0000 04/09/2017 12:12, Sergio Gonzalez Monroy: > On 04/08/2017 19:53, Patrick MacArthur wrote: > > Normally, command line argument strings are considered immutable, but > > SPDK [1] and urdma [2] construct argv arrays to pass to rte_eal_init(). > > These strings are allocated using malloc() and freed after DPDK > > initialization with free(). However, in the case of --file-prefix and > > --huge-dir, DPDK takes the pointer to these strings in argv directly. If > > a secondary process calls rte_eal_pci_probe() after rte_eal_init() > > returns, as is done by SPDK, this causes a use-after-free error because > > the strings have been freed by the calling code immediately after > > rte_eal_init() returns. [...] > > Fix this by using strdup() to create separate memory buffers for these > > strings. Note that this patch will cause valgrind to report memory > > leaks of these buffers as there is nowhere to free them. Using static > > buffers is an option but would make these strings have a fixed maximum > > length whereas there is currently no limit defined by the API. > > > > [1] http://spdk.io > > [2] https://github.com/zrlio/urdma > > > > Fixes: af75078fece3 ("first public release") > > Cc: stable@dpdk.org > > > > Signed-off-by: Patrick MacArthur > > Acked-by: Sergio Gonzalez Monroy Applied, thanks