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 AE9B4460FC for ; Thu, 23 Jan 2025 12:44:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F1A74069D; Thu, 23 Jan 2025 12:44:08 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id A046540279 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=1737632645; 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=CBwAAvMyQuRlm7RCT7K2rAThif+65ru0IIK/uBR3kbetmqnhjwq86d6E4CRn3Cao34ldRz mpPRxPpAtdEOJnd7S9bxZZxuuT0YTON7VX2tlSR0T623a7y0dEf18vcbapqPAQunUhj36m QRnSYFknIuj+z0UBHbcTidYVYW1J0m4= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-117-1j9Yrdw7NtyPzQ3Wlw-HHA-1; Thu, 23 Jan 2025 06:44:03 -0500 X-MC-Unique: 1j9Yrdw7NtyPzQ3Wlw-HHA-1 X-Mimecast-MFC-AGG-ID: 1j9Yrdw7NtyPzQ3Wlw-HHA Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-3023b76e4bfso4038311fa.1 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=VD0cgUmtV4TdSXUS+KSDpaORoIB1/RQbM5dGvNETKg2GMgscEOCSyCyovUAmFBc9Up mbVUEpwnWJVHbSDLqb/GlamTVXaKqIx8rCPChYVBIlJr3CbsEm2rCsTlBT+x/4BRJ3D7 PGkgaKGlv8utq+etQgrZPS48yAxNQ2Mqf30Im2a5/bA1mTswECifeWMH8cwNanmAHdB3 CTW5QajiBKr+qFm1+xOL7su59+SHrehyIOp5GY4CdBN+hGprxmDTV8S0i4/E1e4P4f7T 51QRtfqo+r+7+rUTAIY66axiGeeeg9hI0XaHjxR02DQzZBEXHUPi9OT67Ew/uzlFTUQB SoZQ== X-Forwarded-Encrypted: i=1; AJvYcCV0RkvO6c6H8Gpc5SYgIdWJZ2nadIh8/8ej2bQtVFtcSZg7iPRI8Ldu1+tkV18lR+fRQD62aVg=@dpdk.org X-Gm-Message-State: AOJu0Yw8q4i8OmTWTY8gpIhCXDSytey9nfxXMH4W9S/nNQwaORGf3fBf R2J/gMqvXwF7c6Nfj9owhJKTZKHuiJFZSq6yKsGlgcROCvmcAG7bxG4FfZqfyAOay3cBGPRHKMh PqjzWH4UrJxp9FrbD9NdSlLIjARKlTJQ7IjxIgiRcJfzq3sDJ/gh3Wbe589b2fdtpgt9XhuvK4B Fj9a3ZKU7N0e5VxvsQZtw= X-Gm-Gg: ASbGncvolskawgygyPxvbR6Zso/p9FVwPbQJHgxBniZTiO4sHUIVlC6rASSI4mJyvlq 19D71yXwGYUIZiJYp22ZQIyVCOTa0q2M4RxNPKf4FOw8fwbHXtkhATQ== X-Received: by 2002:a05:651c:1986:b0:302:2202:14f0 with SMTP id 38308e7fff4ca-30761c7048cmr10252811fa.11.1737632642117; 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: w5WFvER_6vHESymf02gbs_QkkoezkWn4DcAMEq3rdTo_1737632642 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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