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 D8E3A45A7E; Tue, 1 Oct 2024 18:37:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F9524064E; Tue, 1 Oct 2024 18:37:23 +0200 (CEST) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id 5FE3B40299 for ; Tue, 1 Oct 2024 18:37:20 +0200 (CEST) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-718d606726cso4126656b3a.3 for ; Tue, 01 Oct 2024 09:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727800639; x=1728405439; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3za6wZ8c6cAGDHtsy3pNcGcHr7ziS+4gK97QfhFwrwY=; b=MgfIBOo8Gywb5PpX8ruv7Pt8TgY3m2RQmMVAecAQKlBrnVQcyPRYtS+sRdFD7sMx8w sJOSm70xL426B8loytdSRnZgrF2QbuOpz+nuOxAMHjchC4kICWPqR8rQqFGMiIl8sEJN s4iFhAWDP3ZnpmbUVfvP7fOCr2aBoSsx1GnTp8T3krrmRXkKzZ1SjeTBDJwUJ95o7P5t 8KrzdP5anjzhnbNGkpRM4rDTv6m4B0UeUWPQo16stx4JICUcn93O249JAad4tqVwEVy8 +2LhBGL8KAt3CopFYRGzf+ZzWaD0PQIWEcyVua5B66XQkmzaFtz6XaHtEHFV7MIqR8un 5YOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727800639; x=1728405439; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3za6wZ8c6cAGDHtsy3pNcGcHr7ziS+4gK97QfhFwrwY=; b=YnVAvtHUTju5p0jSLl6Bro9o4LjO33yGVb0qVDZFhZYNciEjc+uiC2VSb54enCGDjZ 2BzAvfA73wC9mlh+qokgTWnr0AoxIEAZaJKt54W08XF62rRTYXlmPsdd8IVOaq6IQFA/ mKjELQP/rBIVOdPOtN/8nMtPI1rOakjDTKpnvSVrIMWPkKR4kEyQrePOHfyj/pwgYLLU wXQnqHUv6bWuLrUkni8DYtQd9aTthpHzCL4WpaFUsKtV/VZZv6GqbjbaNI0QIl2LVv+K 6UGoo4YTctCVRnp5i9liNI6pQt1agikVKwgwZs3KkNqrlwu1uGk+6b5yif6XtRH9GcUz Q8cA== X-Gm-Message-State: AOJu0Yx0sLtZLx8c5nLV1C84/I+8eYJrs/2MwzP4DilwEGeNFPnrqz+i mqGRsNFOf7A+LkOAZCxHvtBD+D0dU856sKLquZ0n4FwEAC8jyG3qeX0gWG9yn0r9tPmZWJnCcdy 0dzI= X-Google-Smtp-Source: AGHT+IEDXNN/fOMv546JOEjw7dEMHmin/etUsgGnuOKYczHxnJKC8abBMGrCcj6lDMZoSItxGeRe5w== X-Received: by 2002:a05:6a00:2343:b0:706:6962:4b65 with SMTP id d2e1a72fcca58-71dc5c8f147mr435505b3a.14.1727800639496; Tue, 01 Oct 2024 09:37:19 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518818sm8213565b3a.129.2024.10.01.09.37.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 09:37:19 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chengwen Feng , Anatoly Burakov , Tyler Retzlaff Subject: [PATCH v5 01/17] memzone: fix use after free in tracing Date: Tue, 1 Oct 2024 09:35:24 -0700 Message-ID: <20241001163708.355128-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001163708.355128-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20241001163708.355128-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Using the freed value for tracing is not a good idea. Although it is harmless for tracing, it will cause analyzers to flag this as unsafe. Signed-off-by: Stephen Hemminger Acked-by: Chengwen Feng Acked-by: Anatoly Burakov --- lib/eal/common/eal_common_memzone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 2d9b6aa3e3..90efbb621d 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -331,9 +331,10 @@ rte_memzone_free(const struct rte_memzone *mz) rte_rwlock_write_unlock(&mcfg->mlock); + rte_eal_trace_memzone_free(name, addr, ret); + rte_free(addr); - rte_eal_trace_memzone_free(name, addr, ret); return ret; } -- 2.45.2