get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 812445,
    "url": "http://patchwork.ozlabs.org/api/patches/812445/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911165929.2791-5-marcandre.lureau@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170911165929.2791-5-marcandre.lureau@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-11T16:59:26",
    "name": "[v6,4/7] dump: update phys_base header field based on VMCOREINFO content",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "af8eb46c2caf10aa1fed32432ac681b99ee61730",
    "submitter": {
        "id": 66774,
        "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api",
        "name": "Marc-André Lureau",
        "email": "marcandre.lureau@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911165929.2791-5-marcandre.lureau@redhat.com/mbox/",
    "series": [
        {
            "id": 2525,
            "url": "http://patchwork.ozlabs.org/api/series/2525/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2525",
            "date": "2017-09-11T16:59:22",
            "name": "KASLR kernel dump support",
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/2525/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812445/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812445/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=marcandre.lureau@redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xrZ41619gz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 03:02:41 +1000 (AEST)",
            "from localhost ([::1]:59163 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drS6Z-0007uX-RA\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 13:02:39 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:57685)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1drS3y-00064B-Am\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 12:59:59 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1drS3v-00078a-6s\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 12:59:58 -0400",
            "from mx1.redhat.com ([209.132.183.28]:50152)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <marcandre.lureau@redhat.com>)\n\tid 1drS3u-00078T-UH\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 12:59:55 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id E3F161101AC\n\tfor <qemu-devel@nongnu.org>; Mon, 11 Sep 2017 16:59:53 +0000 (UTC)",
            "from localhost (ovpn-112-51.ams2.redhat.com [10.36.112.51])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 5991963645;\n\tMon, 11 Sep 2017 16:59:49 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com E3F161101AC",
        "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Mon, 11 Sep 2017 18:59:26 +0200",
        "Message-Id": "<20170911165929.2791-5-marcandre.lureau@redhat.com>",
        "In-Reply-To": "<20170911165929.2791-1-marcandre.lureau@redhat.com>",
        "References": "<20170911165929.2791-1-marcandre.lureau@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tMon, 11 Sep 2017 16:59:54 +0000 (UTC)",
        "Content-Transfer-Encoding": "quoted-printable",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PATCH v6 4/7] dump: update phys_base header field\n\tbased on VMCOREINFO content",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "ehabkost@redhat.com, mst@redhat.com, anderson@redhat.com, =?utf-8?q?Ma?=\n\t=?utf-8?q?rc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n\timammedo@redhat.com, lersek@redhat.com",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "If the guest note is VMCOREINFO, try to get phys_base from it.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n dump.c                    | 56 +++++++++++++++++++++++++++++++++++++++++++++--\n docs/specs/vmcoreinfo.txt |  8 +++++++\n 2 files changed, 62 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/dump.c b/dump.c\nindex 3cec6a8c93..0671a73108 100644\n--- a/dump.c\n+++ b/dump.c\n@@ -780,6 +780,23 @@ static void get_note_sizes(DumpState *s, const void *note,\n     }\n }\n \n+static bool note_name_equal(DumpState *s,\n+                            const uint8_t *note, const char *name)\n+{\n+    int len = strlen(name) + 1;\n+    uint64_t head_size, name_size;\n+\n+    get_note_sizes(s, note, &head_size, &name_size, NULL);\n+    head_size = ROUND_UP(head_size, 4);\n+\n+    if (name_size != len ||\n+        memcmp(note + head_size, \"VMCOREINFO\", len)) {\n+        return false;\n+    }\n+\n+    return true;\n+}\n+\n /* write common header, sub header and elf note to vmcore */\n static void create_header32(DumpState *s, Error **errp)\n {\n@@ -1554,6 +1571,39 @@ static int64_t dump_calculate_size(DumpState *s)\n     return total;\n }\n \n+static void vmcoreinfo_update_phys_base(DumpState *s)\n+{\n+    uint64_t size, note_head_size, name_size, phys_base;\n+    char **lines;\n+    uint8_t *vmci;\n+    size_t i;\n+\n+    if (!note_name_equal(s, s->guest_note, \"VMCOREINFO\")) {\n+        return;\n+    }\n+\n+    get_note_sizes(s, s->guest_note, &note_head_size, &name_size, &size);\n+    note_head_size = ROUND_UP(note_head_size, 4);\n+\n+    vmci = s->guest_note + note_head_size + ROUND_UP(name_size, 4);\n+    *(vmci + size) = '\\0';\n+\n+    lines = g_strsplit((char *)vmci, \"\\n\", -1);\n+    for (i = 0; lines[i]; i++) {\n+        if (g_str_has_prefix(lines[i], \"NUMBER(phys_base)=\")) {\n+            if (qemu_strtou64(lines[i] + 18, NULL, 16,\n+                              &phys_base) < 0) {\n+                warn_report(\"Failed to read NUMBER(phys_base)=\");\n+            } else {\n+                s->dump_info.phys_base = phys_base;\n+            }\n+            break;\n+        }\n+    }\n+\n+    g_strfreev(lines);\n+}\n+\n static void dump_init(DumpState *s, int fd, bool has_format,\n                       DumpGuestMemoryFormat format, bool paging, bool has_filter,\n                       int64_t begin, int64_t length, Error **errp)\n@@ -1631,8 +1681,9 @@ static void dump_init(DumpState *s, int fd, bool has_format,\n     }\n \n     /*\n-     * The goal of this block is to copy the guest note out of\n-     * the guest.  Failure to do so is not fatal for dumping.\n+     * The goal of this block is to (a) update the previously guessed\n+     * phys_base, (b) copy the guest note out of the guest.\n+     * Failure to do so is not fatal for dumping.\n      */\n     if (vmci) {\n         uint64_t addr, note_head_size, name_size, desc_size;\n@@ -1665,6 +1716,7 @@ static void dump_init(DumpState *s, int fd, bool has_format,\n                 g_free(s->guest_note);\n                 s->guest_note = NULL;\n             } else {\n+                vmcoreinfo_update_phys_base(s);\n                 s->note_size += s->guest_note_size;\n             }\n         }\ndiff --git a/docs/specs/vmcoreinfo.txt b/docs/specs/vmcoreinfo.txt\nindex 2868a77142..821261067f 100644\n--- a/docs/specs/vmcoreinfo.txt\n+++ b/docs/specs/vmcoreinfo.txt\n@@ -39,3 +39,11 @@ qemu dumps.\n \n The note format/class must be of the target bitness and the size must\n be less than 1Mb.\n+\n+If the ELF note name is \"VMCOREINFO\", it is expected to be the Linux\n+vmcoreinfo note (see Documentation/ABI/testing/sysfs-kernel-vmcoreinfo\n+in Linux source). In this case, qemu dump code will read the content\n+as a key=value text file, looking for \"NUMBER(phys_base)\" key\n+value. The value is expected to be more accurate than architecture\n+guess of the value. This is useful for KASLR-enabled guest with\n+ancient tools not handling the VMCOREINFO note.\n",
    "prefixes": [
        "v6",
        "4/7"
    ]
}