get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/101185/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 101185,
    "url": "http://patches.dpdk.org/api/patches/101185/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211012094318.1154727-1-zhihongx.peng@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": "<20211012094318.1154727-1-zhihongx.peng@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211012094318.1154727-1-zhihongx.peng@intel.com",
    "date": "2021-10-12T09:43:16",
    "name": "[v9,1/3] Enable ASan for memory detector on DPDK",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "f377241db1ef813600c5c598622ae6832eafab59",
    "submitter": {
        "id": 1643,
        "url": "http://patches.dpdk.org/api/people/1643/?format=api",
        "name": "Peng, ZhihongX",
        "email": "zhihongx.peng@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/20211012094318.1154727-1-zhihongx.peng@intel.com/mbox/",
    "series": [
        {
            "id": 19549,
            "url": "http://patches.dpdk.org/api/series/19549/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19549",
            "date": "2021-10-12T09:43:16",
            "name": "[v9,1/3] Enable ASan for memory detector on DPDK",
            "version": 9,
            "mbox": "http://patches.dpdk.org/series/19549/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/101185/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/101185/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 7884AA0C47;\n\tTue, 12 Oct 2021 11:54:18 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id F079540E0F;\n\tTue, 12 Oct 2021 11:54:17 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by mails.dpdk.org (Postfix) with ESMTP id 4E4B44003C\n for <dev@dpdk.org>; Tue, 12 Oct 2021 11:54:16 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 12 Oct 2021 02:54:14 -0700",
            "from unknown (HELO localhost.localdomain) ([10.240.183.65])\n by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 12 Oct 2021 02:54:11 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10134\"; a=\"224519239\"",
            "E=Sophos;i=\"5.85,367,1624345200\"; d=\"scan'208\";a=\"224519239\"",
            "E=Sophos;i=\"5.85,367,1624345200\"; d=\"scan'208\";a=\"490894964\""
        ],
        "From": "zhihongx.peng@intel.com",
        "To": "david.marchand@redhat.com, anatoly.burakov@intel.com,\n konstantin.ananyev@intel.com, stephen@networkplumber.org",
        "Cc": "dev@dpdk.org, xueqin.lin@intel.com, Zhihong Peng <zhihongx.peng@intel.com>",
        "Date": "Tue, 12 Oct 2021 09:43:16 +0000",
        "Message-Id": "<20211012094318.1154727-1-zhihongx.peng@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211011062810.422220-1-zhihongx.peng@intel.com>",
        "References": "<20211011062810.422220-1-zhihongx.peng@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v9 1/3] Enable ASan for memory detector on DPDK",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Zhihong Peng <zhihongx.peng@intel.com>\n\n`AddressSanitizer\n<https://github.com/google/sanitizers/wiki/AddressSanitizer>` (ASan)\nis a widely-used debugging tool to detect memory access errors.\nIt helps detect issues like use-after-free, various kinds of buffer\noverruns in C/C++ programs, and other similar errors, as well as\nprinting out detailed debug information whenever an error is detected.\n\nDPDK ASan functionality is currently only supported Linux x86_64.\nSupport other platforms, need to define ASAN_SHADOW_OFFSET value\naccording to google ASan document, and configure meson\n(config/meson.build).\n\nHere is an example of heap-buffer-overflow bug:\n        ......\n        char *p = rte_zmalloc(NULL, 7, 0);\n        p[7] = 'a';\n        ......\n\nHere is an example of use-after-free bug:\n        ......\n        char *p = rte_zmalloc(NULL, 7, 0);\n        rte_free(p);\n        *p = 'a';\n        ......\n\nWe can enable ASan by adding below compilation options:\n-Dbuildtype=debug -Db_lundef=false -Db_sanitize=address\n\"-Dbuildtype=debug\": This is a non-essential option. When this option\nis added, if a memory error occurs, ASan can clearly show where the\ncode is wrong.\n\"-Db_lundef=false\": When use clang to compile DPDK, this option must\nbe added.\n\nSigned-off-by: Xueqin Lin <xueqin.lin@intel.com>\nSigned-off-by: Zhihong Peng <zhihongx.peng@intel.com>\n---\nv7: 1) Split doc and code into two.\n    2) Modify asan.rst doc\nv8: No change.\nv9: 1) Add the check of libasan library.\n    2) Add release notes.\n---\n config/meson.build                     | 10 +++\n devtools/words-case.txt                |  1 +\n doc/guides/prog_guide/asan.rst         | 97 ++++++++++++++++++++++++++\n doc/guides/prog_guide/index.rst        |  1 +\n doc/guides/rel_notes/release_21_11.rst |  9 +++\n 5 files changed, 118 insertions(+)\n create mode 100644 doc/guides/prog_guide/asan.rst",
    "diff": "diff --git a/config/meson.build b/config/meson.build\nindex 4cdf589e20..5170b79fed 100644\n--- a/config/meson.build\n+++ b/config/meson.build\n@@ -411,6 +411,16 @@ if get_option('b_lto')\n     endif\n endif\n \n+if get_option('b_sanitize') == 'address'\n+    if cc.get_id() == 'gcc'\n+        asan_dep = cc.find_library('asan', required: true)\n+        if (not cc.links('int main(int argc, char *argv[]) { return 0; }',\n+                    dependencies: asan_dep))\n+            error('broken dependency, \"libasan\"')\n+        endif\n+    endif\n+endif\n+\n if get_option('default_library') == 'both'\n     error( '''\n  Unsupported value \"both\" for \"default_library\" option.\ndiff --git a/devtools/words-case.txt b/devtools/words-case.txt\nindex 0bbad48626..ada6910fa0 100644\n--- a/devtools/words-case.txt\n+++ b/devtools/words-case.txt\n@@ -5,6 +5,7 @@ API\n Arm\n armv7\n armv8\n+ASan\n BAR\n CRC\n DCB\ndiff --git a/doc/guides/prog_guide/asan.rst b/doc/guides/prog_guide/asan.rst\nnew file mode 100644\nindex 0000000000..627675ef46\n--- /dev/null\n+++ b/doc/guides/prog_guide/asan.rst\n@@ -0,0 +1,97 @@\n+.. Copyright (c) <2021>, Intel Corporation\n+   All rights reserved.\n+\n+Memory error detect standard tool - AddressSanitizer(ASan)\n+==========================================================\n+\n+`AddressSanitizer\n+<https://github.com/google/sanitizers/wiki/AddressSanitizer>` (ASan)\n+is a widely-used debugging tool to detect memory access errors.\n+It helps detect issues like use-after-free, various kinds of buffer\n+overruns in C/C++ programs, and other similar errors, as well as\n+printing out detailed debug information whenever an error is detected.\n+\n+AddressSanitizer is a part of LLVM (3.1+) and GCC (4.8+).\n+\n+DPDK ASan functionality is currently only supported Linux x86_64.\n+Support other platforms, need to define ASAN_SHADOW_OFFSET value\n+according to google ASan document, and configure meson\n+(config/meson.build).\n+\n+Example heap-buffer-overflow error\n+----------------------------------\n+\n+Following error was reported when ASan was enabled::\n+\n+    Applied 9 bytes of memory, but accessed the 10th byte of memory,\n+    so heap-buffer-overflow appeared.\n+\n+Below code results in this error::\n+\n+    Add code to helloworld:\n+    char *p = rte_zmalloc(NULL, 9, 0);\n+    if (!p) {\n+        printf(\"rte_zmalloc error.\");\n+        return -1;\n+    }\n+    p[9] = 'a';\n+\n+The error log::\n+\n+    ==369953==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fb17f465809 at pc 0x5652e6707b84 bp 0x7ffea70eea20 sp 0x7ffea70eea10 WRITE of size 1 at 0x7fb17f465809 thread T0\n+    #0 0x5652e6707b83 in main ../examples/helloworld/main.c:47\n+    #1 0x7fb94953c0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)\n+    #2 0x5652e67079bd in _start (/home/pzh/asan_test/x86_64-native-linuxapp-gcc/examples/dpdk-helloworld+0x8329bd)\n+\n+    Address 0x7fb17f465809 is a wild pointer.\n+    SUMMARY: AddressSanitizer: heap-buffer-overflow ../examples/helloworld/main.c:47 in main\n+\n+Example use-after-free error\n+----------------------------\n+\n+Following error was reported when ASan was enabled::\n+\n+    Applied for 9 bytes of memory, and accessed the first byte after\n+    released, so heap-use-after-free appeared.\n+\n+Below code results in this error::\n+\n+    Add code to helloworld:\n+    char *p = rte_zmalloc(NULL, 9, 0);\n+    if (!p) {\n+        printf(\"rte_zmalloc error.\");\n+        return -1;\n+    }\n+    rte_free(p);\n+    *p = 'a';\n+\n+The error log::\n+\n+    ==417048==ERROR: AddressSanitizer: heap-use-after-free on address 0x7fc83f465800 at pc 0x564308a39b89 bp 0x7ffc8c85bf50 sp 0x7ffc8c85bf40 WRITE of size 1 at 0x7fc83f465800 thread T0\n+    #0 0x564308a39b88 in main ../examples/helloworld/main.c:48\n+    #1 0x7fd0079c60b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)\n+    #2 0x564308a399bd in _start (/home/pzh/asan_test/x86_64-native-linuxapp-gcc/examples/dpdk-helloworld+0x8329bd)\n+\n+    Address 0x7fc83f465800 is a wild pointer.\n+    SUMMARY: AddressSanitizer: heap-use-after-free ../examples/helloworld/main.c:48 in main\n+\n+Usage\n+-----\n+\n+meson build\n+^^^^^^^^^^^\n+\n+To enable ASan in meson build system, use following meson build command:\n+\n+Example usage::\n+\n+ meson build -Dbuildtype=debug -Db_lundef=false -Db_sanitize=address\n+ ninja -C build\n+\n+.. Note::\n+\n+  a) Some of the features of ASan (for example, 'Display memory application location, currently\n+     displayed as a wild pointer') are not currently supported by DPDK's implementation.\n+  b) DPDK test has been completed in ubuntu18.04/ubuntu20.04/redhat8.3. To compile with gcc in\n+     centos, libasan needs to be installed separately.\n+  c) If the program uses cmdline, when a memory bug occurs, need to execute the \"stty echo\" command.\ndiff --git a/doc/guides/prog_guide/index.rst b/doc/guides/prog_guide/index.rst\nindex 2dce507f46..df8a4b93e1 100644\n--- a/doc/guides/prog_guide/index.rst\n+++ b/doc/guides/prog_guide/index.rst\n@@ -71,3 +71,4 @@ Programmer's Guide\n     lto\n     profile_app\n     glossary\n+    asan\ndiff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst\nindex 5036641842..58c6377148 100644\n--- a/doc/guides/rel_notes/release_21_11.rst\n+++ b/doc/guides/rel_notes/release_21_11.rst\n@@ -141,6 +141,15 @@ New Features\n   * Added tests to validate packets hard expiry.\n   * Added tests to verify tunnel header verification in IPsec inbound.\n \n+* **Enable ASan for memory detector on DPDK.**\n+\n+  `AddressSanitizer\n+  <https://github.com/google/sanitizers/wiki/AddressSanitizer>` (ASan)\n+  is a widely-used debugging tool to detect memory access errors.\n+  It helps detect issues like use-after-free, various kinds of buffer\n+  overruns in C/C++ programs, and other similar errors, as well as\n+  printing out detailed debug information whenever an error is detected.\n+\n \n Removed Items\n -------------\n",
    "prefixes": [
        "v9",
        "1/3"
    ]
}