Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/45065/?format=api
http://patchwork.dpdk.org/api/patches/45065/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/2f0bea6a3860143bfbcf31142440a0e4db7c7933.1537521888.git.anatoly.burakov@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<2f0bea6a3860143bfbcf31142440a0e4db7c7933.1537521888.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/2f0bea6a3860143bfbcf31142440a0e4db7c7933.1537521888.git.anatoly.burakov@intel.com", "date": "2018-09-21T09:27:22", "name": "[v3] mem: fix undefined behavior in NUMA code", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "61d4da859fac2411b14e36e2f769df8d7c9091a9", "submitter": { "id": 4, "url": "http://patchwork.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/2f0bea6a3860143bfbcf31142440a0e4db7c7933.1537521888.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 1433, "url": "http://patchwork.dpdk.org/api/series/1433/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=1433", "date": "2018-09-21T09:27:22", "name": "[v3] mem: fix undefined behavior in NUMA code", "version": 3, "mbox": "http://patchwork.dpdk.org/series/1433/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/45065/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/45065/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D2CE81DA4;\n\tFri, 21 Sep 2018 11:27:28 +0200 (CEST)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 6819D1B19;\n\tFri, 21 Sep 2018 11:27:25 +0200 (CEST)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t21 Sep 2018 02:27:24 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga003.jf.intel.com with ESMTP; 21 Sep 2018 02:27:23 -0700", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw8L9RMjx003750; Fri, 21 Sep 2018 10:27:22 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w8L9RMql030439;\n\tFri, 21 Sep 2018 10:27:22 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w8L9RMlp030432;\n\tFri, 21 Sep 2018 10:27:22 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.54,284,1534834800\"; d=\"scan'208\";a=\"85416524\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "solal.pirelli@gmail.com, i.maximets@samsung.com, stable@dpdk.org", "Date": "Fri, 21 Sep 2018 10:27:22 +0100", "Message-Id": "<2f0bea6a3860143bfbcf31142440a0e4db7c7933.1537521888.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": "<7e4178219213303b982e505ae4cb4387d9d3814a.1537447684.git.anatoly.burakov@intel.com>", "References": "<7e4178219213303b982e505ae4cb4387d9d3814a.1537447684.git.anatoly.burakov@intel.com>", "Subject": "[dpdk-dev] [PATCH v3] mem: fix undefined behavior in NUMA code", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "When NUMA-aware hugepages config option is set, we rely on\nlibnuma to tell the kernel to allocate hugepages on a specific\nNUMA node. However, we allocate node mask before we check if\nNUMA is available in the first place, which, according to\nthe manpage [1], causes undefined behaviour.\n\nFix by only using nodemask when we have NUMA available.\n\n[1] https://linux.die.net/man/3/numa_alloc_onnode\n\nBugzilla ID: 20\n\nFixes: 1b72605d2416 (\"mem: balanced allocation of hugepages\")\nCc: i.maximets@samsung.com\nCc: stable@dpdk.org\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n v3:\n - Fix potential memory leak if socket-mem was not specified\n \n v2:\n - Improve readability as per Ilya's comment\n\n lib/librte_eal/linuxapp/eal/eal_memory.c | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)", "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c\nindex dbf19499e..7747ee6df 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memory.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c\n@@ -263,7 +263,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,\n \tint node_id = -1;\n \tint essential_prev = 0;\n \tint oldpolicy;\n-\tstruct bitmask *oldmask = numa_allocate_nodemask();\n+\tstruct bitmask *oldmask = NULL;\n \tbool have_numa = true;\n \tunsigned long maxnode = 0;\n \n@@ -275,6 +275,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,\n \n \tif (have_numa) {\n \t\tRTE_LOG(DEBUG, EAL, \"Trying to obtain current memory policy.\\n\");\n+\t\toldmask = numa_allocate_nodemask();\n \t\tif (get_mempolicy(&oldpolicy, oldmask->maskp,\n \t\t\t\t oldmask->size + 1, 0, 0) < 0) {\n \t\t\tRTE_LOG(ERR, EAL,\n@@ -402,7 +403,8 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,\n \t\t\tnuma_set_localalloc();\n \t\t}\n \t}\n-\tnuma_free_cpumask(oldmask);\n+\tif (oldmask != NULL)\n+\t\tnuma_free_cpumask(oldmask);\n #endif\n \treturn i;\n }\n", "prefixes": [ "v3" ] }{ "id": 45065, "url": "