get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 34963,
    "url": "http://patches.dpdk.org/api/patches/34963/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180205121642.26428-3-stefanha@redhat.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": "<20180205121642.26428-3-stefanha@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180205121642.26428-3-stefanha@redhat.com",
    "date": "2018-02-05T12:16:36",
    "name": "[dpdk-dev,2/8] vhost: avoid enum fields in VhostUserMsg",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ba6994bdb468baeae337318d9b6aba3e96fa2095",
    "submitter": {
        "id": 933,
        "url": "http://patches.dpdk.org/api/people/933/?format=api",
        "name": "Stefan Hajnoczi",
        "email": "stefanha@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180205121642.26428-3-stefanha@redhat.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/34963/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/34963/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 13ED81B34B;\n\tMon,  5 Feb 2018 13:17:06 +0100 (CET)",
            "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id 9EF961B33B\n\tfor <dev@dpdk.org>; Mon,  5 Feb 2018 13:17:04 +0100 (CET)",
            "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 1242AC036743;\n\tMon,  5 Feb 2018 12:17:04 +0000 (UTC)",
            "from localhost (ovpn-117-200.ams2.redhat.com [10.36.117.200])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1F7E65D6A8;\n\tMon,  5 Feb 2018 12:16:58 +0000 (UTC)"
        ],
        "From": "Stefan Hajnoczi <stefanha@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n\tYuanhan Liu <yliu@fridaylinux.org>, Stefan Hajnoczi <stefanha@redhat.com>",
        "Date": "Mon,  5 Feb 2018 12:16:36 +0000",
        "Message-Id": "<20180205121642.26428-3-stefanha@redhat.com>",
        "In-Reply-To": "<20180205121642.26428-1-stefanha@redhat.com>",
        "References": "<20180205121642.26428-1-stefanha@redhat.com>",
        "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.31]); Mon, 05 Feb 2018 12:17:04 +0000 (UTC)",
        "Subject": "[dpdk-dev] [PATCH 2/8] vhost: avoid enum fields in VhostUserMsg",
        "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The VhostUserMsg struct binary representation must match the vhost-user\nprotocol specification since this struct is read from and written to the\nsocket.\n\nThe VhostUserMsg.request union contains enum fields.  Enum binary\nrepresentation is implementation-defined according to the C standard and\nit is unportable to make assumptions about the representation:\n\n  6.7.2.2 Enumeration specifiers\n  ...\n  Each enumerated type shall be compatible with char, a signed integer\n  type, or an unsigned integer type. The choice of type is\n  implementation-defined, but shall be capable of representing the\n  values of all the members of the enumeration.\n\nAdditionally, librte_vhost relies on the enum type being unsigned when\nvalidating untrusted inputs:\n\n  if (ret <= 0 || msg.request.master >= VHOST_USER_MAX) {\n\nIf msg.request.master is signed then negative values pass this check!\n\nEven if we assume gcc on x86_64 (SysV amd64 ABI) and don't care about\nportability, the actual enum constants still affect the final type.  For\nexample, if we add a negative constant then its type changes to signed\nint:\n\n  typedef enum VhostUserRequest {\n      ...\n      VHOST_USER_INVALID = -1,\n  };\n\nThis is very fragile and it's unlikely that anyone changing the code\nwould remember this.  A security hole can be introduced accidentally.\n\nThis patch switches VhostUserMsg.request fields to uint32_t to avoid the\nportability and potential security issues.\n\nSigned-off-by: Stefan Hajnoczi <stefanha@redhat.com>\n---\n lib/librte_vhost/vhost_user.h | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h\nindex d4bd604b9..0fafbe6e0 100644\n--- a/lib/librte_vhost/vhost_user.h\n+++ b/lib/librte_vhost/vhost_user.h\n@@ -81,8 +81,8 @@ typedef struct VhostUserLog {\n \n typedef struct VhostUserMsg {\n \tunion {\n-\t\tVhostUserRequest master;\n-\t\tVhostUserSlaveRequest slave;\n+\t\tuint32_t master; /* a VhostUserRequest value */\n+\t\tuint32_t slave;  /* a VhostUserSlaveRequest value*/\n \t} request;\n \n #define VHOST_USER_VERSION_MASK     0x3\n",
    "prefixes": [
        "dpdk-dev",
        "2/8"
    ]
}