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 9A8F9460FB; Thu, 23 Jan 2025 12:44:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7575140279; Thu, 23 Jan 2025 12:44:07 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 79E6540269 for ; Thu, 23 Jan 2025 12:44:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737632644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NY7IV5jBAyFHvbeaWjhgjbPDPVIZBzayU8gHnyA865I=; b=fYWjLCQ89crcKc5ALY7u5HqF3BZd2h3oGn3lA1/80gdvxJHxXSVamtgCX+ETQ1wGTIUpOw 6IXOQX1vM3DrPcV63DDzyKzI7T5pJXEU8Zd5guE/qmMLXnVVMfFc1PkWoW7aQrBDgq8zUD bIYTZnrPJc5SVes2FP+MnIBNp3LnOCY= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-576-6IVANVXnOrmPgUOXTmEboA-1; Thu, 23 Jan 2025 06:44:03 -0500 X-MC-Unique: 6IVANVXnOrmPgUOXTmEboA-1 X-Mimecast-MFC-AGG-ID: 6IVANVXnOrmPgUOXTmEboA Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-3021e171631so4319191fa.0 for ; Thu, 23 Jan 2025 03:44:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737632642; x=1738237442; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NY7IV5jBAyFHvbeaWjhgjbPDPVIZBzayU8gHnyA865I=; b=HcpN6FihesyDy3Bdluio5gnbjvyoLYSamcfFIIuVVA+4qZYHh/qKiwajER+ynEXwZd VpMe+9iVsWUwNMht+qB94mhqDj+hAvgb9iGhvII71pVzRAiWrR2mIuHv4C5sgRRnffjp h8jmtTiiu2ozYrih/JtmqTvMWTOmVtlS+UmYtNafGiJcbylfvfDoN+U3l4o1Y9AMeHgA Rh/HOg3sHkcX6m47h8gMbQgrlFOyzXYqqKnEl7kC/TLdelUWpS0cuLgIl+bCDMs6lTVh IEeJqmZL9YzhdJvW0cYxKXf8/3LI/sGSOFQvKkYzKqQuAVWxCr0iyVdUaIBByYy98Bn/ iU3Q== X-Forwarded-Encrypted: i=1; AJvYcCXyMOGSFEC1oGBxjKnGoJc1nDNJ7hBXw7eCBgH/Q6xl4nY7dN/ZXnFTWz3aRzYSGSOtyu8=@dpdk.org X-Gm-Message-State: AOJu0Yzz8wkzi2eoiY6uz/d6PW3tBfiCWpF8dvo5POUUIJBPUAIu9eom fGwP1EhyS4RBMQKZv4qAPp0f9sorvgqHdIJVHoUkpq3z6R6PbZ5Mmn2ib8cqa5wx05uZVrh718w HCt+QOqBjqfMCA+1DoEOxVID4QCnt0WDc7bwAUmkwyPjSzaN632HeQ+HXLG5l4i6b2WItVM+Y3R vj2mQ/h1ePOlRoLUM= X-Gm-Gg: ASbGnctGXNtOvnLqvfavbOVEB1MaY/qSYpNrp1ZtFT1+PPDkcXvBW5x3xcVfVo4Q3wT SaNUQJ5rghPcaNeYVLGJ7iHsgsS+T2SS5Yxv3v1bF3aPn4kaQTHIfYw== X-Received: by 2002:a05:651c:1986:b0:302:2202:14f0 with SMTP id 38308e7fff4ca-30761c7048cmr10252801fa.11.1737632642116; Thu, 23 Jan 2025 03:44:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWxtFkLdVo44lb+u1sTEbcKWELnt6DH7ge+tcbk54vc4//sIaesAE+tCtbxogv6BXnkHaXU842IDhOUYhiZ/w= X-Received: by 2002:a05:651c:1986:b0:302:2202:14f0 with SMTP id 38308e7fff4ca-30761c7048cmr10252751fa.11.1737632641707; Thu, 23 Jan 2025 03:44:01 -0800 (PST) MIME-Version: 1.0 References: <20250113085404.1447006-1-praveen.shetty@intel.com> <20250113083001.611db94d@hermes.local> In-Reply-To: From: David Marchand Date: Thu, 23 Jan 2025 12:43:50 +0100 X-Gm-Features: AbW1kvZJTceXnAGwO61X3wyLdHjQKmNLBeQQ4hO2F5cFcu-H6WJZecjtgDEJWWg Message-ID: Subject: Re: [PATCH v1] common/idpf: fix heap use after free error To: Bruce Richardson Cc: Stephen Hemminger , Praveen Shetty , dev@dpdk.org, stable@dpdk.org X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: _QpFjxDyv6FUnJ-q6fGUMipzLr05Ae7KEH5_cg7UqHw_1737632642 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Thu, Jan 23, 2025 at 12:18=E2=80=AFPM Bruce Richardson wrote: > > On Mon, Jan 20, 2025 at 02:32:49PM +0000, Bruce Richardson wrote: > > On Mon, Jan 13, 2025 at 08:30:01AM -0800, Stephen Hemminger wrote: > > > On Mon, 13 Jan 2025 08:54:04 +0000 > > > Praveen Shetty wrote: > > > > > > > Heap use after free error is detected in AddressSanitizer while qui= tting > > > > the testpmd application.Issue is due to accessing the empty control > > > > queue in the idpf_ctlq_deinit function.idpf_ctlq_deinit function is= called > > > > during the rte_eal_cleanup routine. > > > > This patch will fix this issue. > > > > > > > > Fixes: fb4ac04e9bfa ("common/idpf: introduce common library") > > > > Cc: stable@dpdk.org > > > > > > > > Signed-off-by: Praveen Shetty > > > > > > This should not be needed. LIST_FOR_EACH_ENTRY_SAFE part, don't under= stand. > > > > I would tend to agree. Is there an actual confirmed bug here? If so, th= en > > either our standard list macros are broken, or the code using them is d= oing > > something rather strange. > > > > I followed up on with with Praveen, and he went through the code and > possible solutions with me. The issue flagged by ASAN is correct, because > it turns out that the version of the _SAFE macro provided in this > particular driver is not actually safe! :-( > > There are therefore two options to fixing this: 1) fix the macro/use a > different copy of the macro, or 2) rework the code as in this patch and d= rop > the macro. Copies of the driver in other OS use the style given in this p= atch, > so we will go with the second option. However, we will do a v2 to include > the removal of the bad macro, alongside fixing this. That should hopefull= y > prevent this issue from reoccurring. > > Praveen, will review v2 when you send it. Sorry, I am not following. 1) seems the best way as it does not require touching base driver code. Afaiu, the LIST_FOR_EACH_ENTRY_SAFE macro is defined in the "abstraction" header that is DPDK specific (drivers/common/idpf/base/idpf_osdep.h). There is already an implementation of LIST_FOR_EACH_ENTRY_SAFE in driver/net/ice/base/ice_osdep.h. (note that it may be worth providing such a macro in a common place in DPDK and remove copies of it in various drivers). --=20 David Marchand