get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 71850,
    "url": "http://patchwork.dpdk.org/api/patches/71850/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200621174035.6858-1-haiyue.wang@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": "<20200621174035.6858-1-haiyue.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200621174035.6858-1-haiyue.wang@intel.com",
    "date": "2020-06-21T17:40:35",
    "name": "[v1] bus/pci: fix VF bus error for memory access",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "031d0dc29a72af5f9a6522c4d8cfe88c562ba954",
    "submitter": {
        "id": 1044,
        "url": "http://patchwork.dpdk.org/api/people/1044/?format=api",
        "name": "Wang, Haiyue",
        "email": "haiyue.wang@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patchwork.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20200621174035.6858-1-haiyue.wang@intel.com/mbox/",
    "series": [
        {
            "id": 10536,
            "url": "http://patchwork.dpdk.org/api/series/10536/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10536",
            "date": "2020-06-21T17:40:35",
            "name": "[v1] bus/pci: fix VF bus error for memory access",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/10536/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/71850/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/71850/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 1691BA0350;\n\tSun, 21 Jun 2020 19:50:05 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 69BCC1C10D;\n\tSun, 21 Jun 2020 19:50:04 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by dpdk.org (Postfix) with ESMTP id E0F851C0BD;\n Sun, 21 Jun 2020 19:50:02 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Jun 2020 10:50:01 -0700",
            "from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.213])\n by fmsmga008.fm.intel.com with ESMTP; 21 Jun 2020 10:50:00 -0700"
        ],
        "IronPort-SDR": [
            "\n 74xQ7+43DJ1OHql54O5TXwoJSRJ0XkQtBfYIJTEdvEjyn1LxEzwPGGS8VySJjw8dwADf8neJYs\n 6i8w9WSIE74w==",
            "\n D3RS9yo3+sIRYajc3f2sm7sDfuKeqM1SywpaShz8FvHsW8zBzVwKKWob2FyrZMdd4wehS8mLD/\n iVpxbL5I6P/A=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9659\"; a=\"141099784\"",
            "E=Sophos;i=\"5.75,263,1589266800\"; d=\"scan'208\";a=\"141099784\"",
            "E=Sophos;i=\"5.75,263,1589266800\"; d=\"scan'208\";a=\"264319707\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Haiyue Wang <haiyue.wang@intel.com>",
        "To": "dev@dpdk.org,\n\tanatoly.burakov@intel.com",
        "Cc": "Haiyue Wang <haiyue.wang@intel.com>,\n\tstable@dpdk.org",
        "Date": "Mon, 22 Jun 2020 01:40:35 +0800",
        "Message-Id": "<20200621174035.6858-1-haiyue.wang@intel.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v1] bus/pci: fix VF bus error for memory access",
        "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 <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": "To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps\nand block MMIO access on disabled memory, it will send a SIGBUS to the\napplication.\n\nIn fact, vfio-pci will enable the memory command when openning the PCI\ndevice, but according to the PCIe specification, this enablement by real\nPCI write command doesn't have effect, it still has 0 value:\n\n    Table 9-13 Command Register Changes\nBit Location | PF and VF Register Differences | PF         | VF\n             | From Base                      | Attributes | Attributes\n-------------+--------------------------------+------------+-----------\n             | Memory Space Enable - Does not |            |\n             | apply to VFs. Must be hardwired|  Base      |  0b\n     1       | to 0b for VFs. VF Memory Space |            |\n             | is controlled by the VF MSE bit|            |\n             | in the VF Control register.    |            |\n-------------+--------------------------------+------------+-----------\n\nSo that when the vfio-pci initializes its own PCI configuration space\ndata called 'vconfig' by reading the VF's real configuration space, it\nwill have the memory command with 0b value, then, the vfio-pci finds the\nBAR memory is disabled by checking the its vconfig space, and the SIGBUS\nwill be triggerred.\n\nSo it needs to enable PCI bus memory command explicitly to avoid access\non disabled memory, which will call vfio-pci ioctl to change the memory\ncommand in vconfig space to 1b.\n\nFixes: 33604c31354a (\"vfio: refactor PCI BAR mapping\")\nCc: stable@dpdk.org\n\nSigned-off-by: Haiyue Wang <haiyue.wang@intel.com>\n---\nPut the long link here, since the patch doesn't support to add so long\nline.\nhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476\n---\n drivers/bus/pci/linux/pci_vfio.c | 37 ++++++++++++++++++++++++++++++++\n 1 file changed, 37 insertions(+)",
    "diff": "diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex 64cd84a68..9b6e45da5 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)\n \treturn 0;\n }\n \n+/* enable PCI bus memory command */\n+static int\n+pci_vfio_enable_bus_memory(int dev_fd)\n+{\n+\tuint16_t cmd;\n+\tint ret;\n+\n+\tret = pread64(dev_fd, &cmd, sizeof(cmd),\n+\t\t      VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +\n+\t\t      PCI_COMMAND);\n+\n+\tif (ret != sizeof(cmd)) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot read command from PCI config space!\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (cmd & PCI_COMMAND_MEMORY)\n+\t\treturn 0;\n+\n+\tcmd |= PCI_COMMAND_MEMORY;\n+\tret = pwrite64(dev_fd, &cmd, sizeof(cmd),\n+\t\t       VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +\n+\t\t       PCI_COMMAND);\n+\n+\tif (ret != sizeof(cmd)) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot write command to PCI config space!\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* set PCI bus mastering */\n static int\n pci_vfio_set_bus_master(int dev_fd, bool op)\n@@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)\n \t\treturn -1;\n \t}\n \n+\tif (pci_vfio_enable_bus_memory(vfio_dev_fd)) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot enable bus memory command!\\n\");\n+\t\treturn -1;\n+\t}\n+\n \t/* set bus mastering for the device */\n \tif (pci_vfio_set_bus_master(vfio_dev_fd, true)) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot set up bus mastering!\\n\");\n",
    "prefixes": [
        "v1"
    ]
}