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 EAE4545A9F; Wed, 2 Oct 2024 20:39:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B9B0402D3; Wed, 2 Oct 2024 20:39:30 +0200 (CEST) Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by mails.dpdk.org (Postfix) with ESMTP id 0B314402A7 for ; Wed, 2 Oct 2024 20:39:29 +0200 (CEST) Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7e6afa8baeaso42600a12.3 for ; Wed, 02 Oct 2024 11:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727894368; x=1728499168; 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=+FUxpU3eSh6sQ6SFBNZumGrcAp2cEcepW1/DUB8zk64=; b=YR/smVtOQZP9NKFvZGq6H4yry39iuvcCZ5xN6OrNsXx5JspGNrE5R9VmPRfTGtwE1e MmMjRkQx95h7al+0dQ6bBkbHJBjMfwZlJO7L37BHCFtvMR8EvO08rWbUmjLPoI5MGeGh zcxdFJKgZfqWt2wYmF57vhbcueeBMLLNeVEGB2K34uK4b/JedDzYqRQjmH1mf7gS656v pZNrz1F9g6yXyeZAeZrTZCdtSzbsvY1FjZfa0gjifgxgNTVdG1gXD/L3R4zYdVtPkOEj hLI7XH2/SDY6SJAmQ/JrpnTma0szrSOfUj8JktrwZ6e+2UeyWrcJtk8RDRiB4+u0uPcd dThw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727894368; x=1728499168; 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=+FUxpU3eSh6sQ6SFBNZumGrcAp2cEcepW1/DUB8zk64=; b=hMp8dK48kp0IQ/D9WBaPwGHR9lRy01auCj38LNhKjt4zLTxS6oDarwYG1FKyx6FvMj dwAXh94CMCs+0HEaPXlZXThbPxZ1qD/8L6khcMAGNtKN6kHpa2khJjsCsrolEjSoZnJs R6GGDTKMiTZefkKAs0G2rwhG2kJWo8uq118OT/K7k8w0F7vnT/8AfkszQrzhfUFmAZmt rQ5CyTLqRgIG66QvmIAHvnCjld4FWd8BBcR+BxzOCOj6MjP2sZaW2xFrQ4yQlZX3FeOX 7puu4QABUvVj3+UPZ/pWa55Cd8rwEV93AA6t+bA79TBW95JNY9KexxAce4BQ+d2Y7rN0 O6Pg== X-Gm-Message-State: AOJu0YwlSK3PDpskzgIHmgc+0r6jyVQ+AjiVgq/yBF71S5en5v5Tceel L7G1pf83Bh/4rhEFo0LEpwiNtvhWZRJvbx5KIFvbze+PMHPqHGoXUWjni9ZdTJS3muYT5Ce16Ni Y X-Google-Smtp-Source: AGHT+IF78k1bTgtcljNAaBSZJYW1TmpmufPgOKvzQgwBMlRA3JAwrI3E+aU80V0CfucOV+nbBlWPvQ== X-Received: by 2002:a05:6a21:a4c1:b0:1d5:1370:5b with SMTP id adf61e73a8af0-1d5db14cbacmr6436233637.19.1727894367932; Wed, 02 Oct 2024 11:39:27 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b2649b0bdsm10104362b3a.34.2024.10.02.11.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 11:39:27 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v7 00/16] Fix allocation bugs and prevent future ones Date: Wed, 2 Oct 2024 11:37:38 -0700 Message-ID: <20241002183918.161656-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240927204742.546164-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 Recent versions of GCC have some additional function attributes that can help with DPDK performance and stability. The alloc_align attribute tells the compiler what the alignment of the allocation will be, and the optimizer can use this to produce better code (especially memcpy and structure copies). The malloc attribute tells compiler that object is not overlapping and potentially aliasing. It also as an additional variant in GCC 11 or later that allows for detecting all sorts of common errors like calling free() on memory allocated with rte_malloc(). In order to use the malloc attribute the free function prototype needs to be moved before the allocator/create function prototype so that the malloc attribute can refer to it. This uncovered at least 16 pre-existing bugs in DPDK, these should go to stable. This patch set is structured with: - fix any new warnings that were discovered - add macros for enable the macros - enable the attributes The same attributes could be added to lots more functions in DPDK, but this patch set focuses on the key ones, and where problems exist in current code base. v7 - rebase and reword the release note Stephen Hemminger (16): memzone: fix use after free in tracing cryptodev/bcmfs: fix mis-matched free dma/ixd: fix incorrect free function in cleanup event/cnxk: fix pointer mismatch in cleanup examples/vhost: fix free function mismatch net/cnxk: fix use-after-free bpf: fix free mismatch if convert fails net/e1000: fix use-after-free net/sfc: fix use-after-free warning messages net/cpfl: fix free of nonheap object net/nfp: fix duplicate call to rte_free raw/ifpga/base: fix use after free common/qat: fix use after free drivers/ifpga: fix free function mismatch baseband/la12xx: prevent use after free common/idpf: fix use after free due drivers/baseband/la12xx/bbdev_la12xx.c | 1 + drivers/common/idpf/base/idpf_osdep.h | 10 ++++++++-- drivers/common/idpf/idpf_common_device.c | 3 +-- drivers/common/qat/qat_device.c | 6 +----- drivers/crypto/bcmfs/bcmfs_device.c | 4 ++-- drivers/dma/idxd/idxd_pci.c | 2 +- drivers/event/cnxk/cnxk_eventdev.c | 4 +++- drivers/net/cnxk/cnxk_ethdev_sec.c | 2 +- drivers/net/cpfl/cpfl_flow_parser.c | 1 - drivers/net/e1000/igb_ethdev.c | 4 ++-- drivers/net/nfp/flower/nfp_flower_flow.c | 1 - drivers/net/sfc/sfc_flow_rss.c | 4 ++-- drivers/net/sfc/sfc_mae.c | 23 +++++++++-------------- drivers/raw/ifpga/base/opae_intel_max10.c | 11 +++++++++-- drivers/raw/ifpga/ifpga_rawdev.c | 8 ++++---- examples/vhost_blk/vhost_blk.c | 2 +- lib/bpf/bpf_convert.c | 2 +- lib/eal/common/eal_common_memzone.c | 3 ++- 18 files changed, 48 insertions(+), 43 deletions(-) -- 2.45.2