Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/131331/?format=api
http://patches.dpdk.org/api/patches/131331/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230911080953.10355-1-artur.paszkiewicz@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20230911080953.10355-1-artur.paszkiewicz@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230911080953.10355-1-artur.paszkiewicz@intel.com", "date": "2023-09-11T08:09:53", "name": "[v2] malloc: fix allocation for a specific case with ASAN", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "44b968d849a8892c37d995af8105320be2a4317b", "submitter": { "id": 3175, "url": "http://patches.dpdk.org/api/people/3175/?format=api", "name": "Artur Paszkiewicz", "email": "artur.paszkiewicz@intel.com" }, "delegate": { "id": 24651, "url": "http://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230911080953.10355-1-artur.paszkiewicz@intel.com/mbox/", "series": [ { "id": 29473, "url": "http://patches.dpdk.org/api/series/29473/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29473", "date": "2023-09-11T08:09:53", "name": "[v2] malloc: fix allocation for a specific case with ASAN", "version": 2, "mbox": "http://patches.dpdk.org/series/29473/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/131331/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/131331/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id C992F4256D;\n\tMon, 11 Sep 2023 10:11:06 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 575C3402DD;\n\tMon, 11 Sep 2023 10:11:06 +0200 (CEST)", "from mgamail.intel.com (mgamail.intel.com [134.134.136.126])\n by mails.dpdk.org (Postfix) with ESMTP id 0E891402DA\n for <dev@dpdk.org>; Mon, 11 Sep 2023 10:11:03 +0200 (CEST)", "from fmsmga008.fm.intel.com ([10.253.24.58])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 Sep 2023 01:11:03 -0700", "from apaszkie-mobl2.apaszkie-mobl2 (HELO apaszkie-mobl2.intel.com)\n ([10.213.3.219])\n by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 Sep 2023 01:11:01 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1694419864; x=1725955864;\n h=from:to:cc:subject:date:message-id:mime-version:\n content-transfer-encoding;\n bh=9kxSNgxePtcoJaUdSQMApx0cp8yJ/KIbpQ3ssI+qWF4=;\n b=X/7/y8GWexdaZ6LZ86/en/x+SDkrruBBOfc9KHYRkUaYGxgPH68rSd8j\n wtmLNtPO7pgbak/gfCvDoirJWmXAzPoGlg+W3uhnGGK7X2p/WXPfElolm\n HVtyXst5MhUAx55MNFLmsKA0WLRFmVU0CfbtFAh63+PALIBSBUxokSPTY\n jNfTrswjT+2Fbnl9jWednu//qu8j3cChRlU0Gj/tYWvTmeOPibZyHb6nY\n 5xethiBIpQ0NXuBVZbH1blP3UDgNoRvGkC7MRvKEuEx7Ud+65YNGrBaHj\n fRo4MmMnM0setBom0nngUHNJQUAeTSd2Ptt9VaixKZdarOi9/heGfnqYh A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10829\"; a=\"363047923\"", "E=Sophos;i=\"6.02,243,1688454000\"; d=\"scan'208\";a=\"363047923\"", "E=McAfee;i=\"6600,9927,10829\"; a=\"808750482\"", "E=Sophos;i=\"6.02,243,1688454000\"; d=\"scan'208\";a=\"808750482\"" ], "X-ExtLoop1": "1", "From": "Artur Paszkiewicz <artur.paszkiewicz@intel.com>", "To": "dev@dpdk.org", "Cc": "anatoly.burakov@intel.com, Artur Paszkiewicz <artur.paszkiewicz@intel.com>", "Subject": "[PATCH v2] malloc: fix allocation for a specific case with ASAN", "Date": "Mon, 11 Sep 2023 10:09:53 +0200", "Message-Id": "<20230911080953.10355-1-artur.paszkiewicz@intel.com>", "X-Mailer": "git-send-email 2.35.3", "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 <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Allocation would fail with ASAN enabled if the size and alignment was\nequal to half of the page size, e.g.:\n\nsize_t pg_sz = 2 * (1 << 20);\nrte_malloc(NULL, pg_sz / 2, pg_sz / 2);\n\nIn such case, try_expand_heap_primary() only allocated one page but it\nis not enough to fit this allocation with such alignment and\nMALLOC_ELEM_TRAILER_LEN > 0, as correctly checked by\nmalloc_elem_can_hold().\n\nSigned-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>\n---\nv2: \n- fix commit message typo\n\n lib/eal/common/malloc_heap.c | 4 ++--\n lib/eal/common/malloc_mp.c | 4 ++--\n 2 files changed, 4 insertions(+), 4 deletions(-)", "diff": "diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c\nindex 6b6cf9174c..bb7da0d2ef 100644\n--- a/lib/eal/common/malloc_heap.c\n+++ b/lib/eal/common/malloc_heap.c\n@@ -402,8 +402,8 @@ try_expand_heap_primary(struct malloc_heap *heap, uint64_t pg_sz,\n \tint n_segs;\n \tbool callback_triggered = false;\n \n-\talloc_sz = RTE_ALIGN_CEIL(RTE_ALIGN_CEIL(elt_size, align) +\n-\t\t\tMALLOC_ELEM_OVERHEAD, pg_sz);\n+\talloc_sz = RTE_ALIGN_CEIL(RTE_MAX(MALLOC_ELEM_HEADER_LEN, align) +\n+\t\t\telt_size + MALLOC_ELEM_TRAILER_LEN, pg_sz);\n \tn_segs = alloc_sz / pg_sz;\n \n \t/* we can't know in advance how many pages we'll need, so we malloc */\ndiff --git a/lib/eal/common/malloc_mp.c b/lib/eal/common/malloc_mp.c\nindex 7270c2ec90..62deaca9eb 100644\n--- a/lib/eal/common/malloc_mp.c\n+++ b/lib/eal/common/malloc_mp.c\n@@ -250,8 +250,8 @@ handle_alloc_request(const struct malloc_mp_req *m,\n \t\treturn -1;\n \t}\n \n-\talloc_sz = RTE_ALIGN_CEIL(RTE_ALIGN_CEIL(ar->elt_size, ar->align) +\n-\t\t\tMALLOC_ELEM_OVERHEAD, ar->page_sz);\n+\talloc_sz = RTE_ALIGN_CEIL(RTE_MAX(MALLOC_ELEM_HEADER_LEN, ar->align) +\n+\t\t\tar->elt_size + MALLOC_ELEM_TRAILER_LEN, ar->page_sz);\n \tn_segs = alloc_sz / ar->page_sz;\n \n \t/* we can't know in advance how many pages we'll need, so we malloc */\n", "prefixes": [ "v2" ] }{ "id": 131331, "url": "