)]}'
{
  "commit": "72d41eb4b8f923de91e8f06dc20aa86b0a9155fb",
  "tree": "f7983fc765558472fc89962142374e4c6f286869",
  "parents": [
    "41a2635124117d1fac7e45b3cafa2c1ac68417fd"
  ],
  "author": {
    "name": "Stefan Hajnoczi",
    "email": "stefanha@redhat.com",
    "time": "Fri Aug 30 10:30:56 2019 +0100"
  },
  "committer": {
    "name": "Paolo Bonzini",
    "email": "pbonzini@redhat.com",
    "time": "Mon Sep 16 12:32:21 2019 +0200"
  },
  "message": "memory: fetch pmem size in get_file_size()\n\nNeither stat(2) nor lseek(2) report the size of Linux devdax pmem\ncharacter device nodes.  Commit 314aec4a6e06844937f1677f6cba21981005f389\n(\"hostmem-file: reject invalid pmem file sizes\") added code to\nhostmem-file.c to fetch the size from sysfs and compare against the\nuser-provided size\u003dNUM parameter:\n\n  if (backend-\u003esize \u003e size) {\n      error_setg(errp, \"size property %\" PRIu64 \" is larger than \"\n                 \"pmem file \\\"%s\\\" size %\" PRIu64, backend-\u003esize,\n                 fb-\u003emem_path, size);\n      return;\n  }\n\nIt turns out that exec.c:qemu_ram_alloc_from_fd() already has an\nequivalent size check but it skips devdax pmem character devices because\nlseek(2) returns 0:\n\n  if (file_size \u003e 0 \u0026\u0026 file_size \u003c size) {\n      error_setg(errp, \"backing store %s size 0x%\" PRIx64\n                 \" does not match \u0027size\u0027 option 0x\" RAM_ADDR_FMT,\n                 mem_path, file_size, size);\n      return NULL;\n  }\n\nThis patch moves the devdax pmem file size code into get_file_size() so\nthat we check the memory size in a single place:\nqemu_ram_alloc_from_fd().  This simplifies the code and makes it more\ngeneral.\n\nThis also fixes the problem that hostmem-file only checks the devdax\npmem file size when the pmem\u003don parameter is given.  An unchecked\nsize\u003dNUM parameter can lead to SIGBUS in QEMU so we must always fetch\nthe file size for Linux devdax pmem character device nodes.\n\nSigned-off-by: Stefan Hajnoczi \u003cstefanha@redhat.com\u003e\nMessage-Id: \u003c20190830093056.12572-1-stefanha@redhat.com\u003e\nReviewed-by: Eduardo Habkost \u003cehabkost@redhat.com\u003e\nSigned-off-by: Paolo Bonzini \u003cpbonzini@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ecc15e3eb044e5193f4920b6a43355bd21d22617",
      "old_mode": 33188,
      "old_path": "backends/hostmem-file.c",
      "new_id": "be64020746d100f84e7353cf84849689bac3bb15",
      "new_mode": 33188,
      "new_path": "backends/hostmem-file.c"
    },
    {
      "type": "modify",
      "old_id": "b9511be096686db0faa23ff5dbe82b94f38c55d6",
      "old_mode": 33188,
      "old_path": "exec.c",
      "new_id": "8b998974f8995042c8a56537c8c8cc235e3349d2",
      "new_mode": 33188,
      "new_path": "exec.c"
    },
    {
      "type": "modify",
      "old_id": "af2b91f0b873ed0249c0a9c44f826a145ebc591c",
      "old_mode": 33188,
      "old_path": "include/qemu/osdep.h",
      "new_id": "c7d242f4760781146b32a6dab3c7463cc27c654e",
      "new_mode": 33188,
      "new_path": "include/qemu/osdep.h"
    },
    {
      "type": "modify",
      "old_id": "5fda67dedf30b9b785da09010f96a14d94f4debd",
      "old_mode": 33188,
      "old_path": "util/oslib-posix.c",
      "new_id": "f8693384fc6e6f8e8e0a26cdd5bfc31d88a96496",
      "new_mode": 33188,
      "new_path": "util/oslib-posix.c"
    },
    {
      "type": "modify",
      "old_id": "9583fb4ca4e8299a9694ed2cc2638adab3c659ac",
      "old_mode": 33188,
      "old_path": "util/oslib-win32.c",
      "new_id": "c62cd4328c520130536bab00dc772264b51a37ea",
      "new_mode": 33188,
      "new_path": "util/oslib-win32.c"
    }
  ]
}
