get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 71962,
    "url": "http://patchwork.dpdk.org/api/patches/71962/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200622111351.101006-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": "<20200622111351.101006-1-haiyue.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200622111351.101006-1-haiyue.wang@intel.com",
    "date": "2020-06-22T11:13:51",
    "name": "[v3] bus/pci: fix VF bus error for memory access",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9c4c8127761aa473fa40caec96523ad44db68de4",
    "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/20200622111351.101006-1-haiyue.wang@intel.com/mbox/",
    "series": [
        {
            "id": 10549,
            "url": "http://patchwork.dpdk.org/api/series/10549/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10549",
            "date": "2020-06-22T11:13:51",
            "name": "[v3] bus/pci: fix VF bus error for memory access",
            "version": 3,
            "mbox": "http://patchwork.dpdk.org/series/10549/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/71962/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/71962/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 DC8C8A0519;\n\tMon, 22 Jun 2020 13:23:25 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 953A31D661;\n\tMon, 22 Jun 2020 13:23:24 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by dpdk.org (Postfix) with ESMTP id 05A211D652;\n Mon, 22 Jun 2020 13:23:21 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Jun 2020 04:23:19 -0700",
            "from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.213])\n by fmsmga006.fm.intel.com with ESMTP; 22 Jun 2020 04:23:17 -0700"
        ],
        "IronPort-SDR": [
            "\n o+8LpqeBu6HrGseNXYR2nqwfTt5WJrR+zQZvjiKCfZ5pjjMhIqsyt/vIENVX4KALvp8QoN7qry\n J1cJRPXylxGA==",
            "\n WCL7Y9KzghvmNjHQrE9uaGbGU3BlKk4QC/6X8KsZoLRy0AuE49xn8hnzOrer6nuYMWAvm/nRJA\n H4DTZrtw411A=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9659\"; a=\"142784244\"",
            "E=Sophos;i=\"5.75,266,1589266800\"; d=\"scan'208\";a=\"142784244\"",
            "E=Sophos;i=\"5.75,266,1589266800\"; d=\"scan'208\";a=\"478352052\""
        ],
        "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 19:13:51 +0800",
        "Message-Id": "<20200622111351.101006-1-haiyue.wang@intel.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200621174035.6858-1-haiyue.wang@intel.com>",
        "References": "<20200621174035.6858-1-haiyue.wang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3] 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:\nhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476\n\nWhen the application opens the vfio PCI device, the vfio-pci module will\nenable the bus memory space through PCI read/write access. According to\nthe PCIe specification, the 'Memory Space Enable' is always zero for VF:\n\n             Table 9-13 Command Register Changes\n\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\nAfterwards the vfio-pci will initialize its own virtual PCI config space\ndata ('vconfig') by reading the VF's physical PCI config space, then the\n'Memory Space Enable' bit in vconfig will always be 0b value. This will\nmake the vfio-pci treat the BAR memory space as disabled, and the SIGBUS\nwill be triggerred if access these BARs.\n\nBy investigation, the VF PCI device *passthrough* into the Guest OS by\nQEMU has the 'Memory Space Enable' with 1b value. That's because every\nPCI driver will start to enable the memory space, and this action will\nbe hooked by vfio-pci virtual PCI read/write to set the 'Memory Space\nEnable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but\nVF runs in host OS has 'Mem-'.\n\nAlign with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI\nbus memory space explicitly to avoid access on disabled memory.\n\nFixes: 33604c31354a (\"vfio: refactor PCI BAR mapping\")\nCc: stable@dpdk.org\n\nSigned-off-by: Haiyue Wang <haiyue.wang@intel.com>\n---\nv3: update the commit log, and fix one debug log with redundant\ndescription.\nv2: Rewrite the commit log, and put the link into it even it is long.\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..ba60e7ce9 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 space */\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!\\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": [
        "v3"
    ]
}