Skip to content
Snippets Groups Projects
  1. Sep 19, 2023
    • David Hildenbrand's avatar
      machine: Improve error message when using default RAM backend id · 41ddcd23
      David Hildenbrand authored
      
      For migration purposes, users might want to reuse the default RAM
      backend id, but specify a different memory backend.
      
      For example, to reuse "pc.ram" on q35, one has to set
          -machine q35,memory-backend=pc.ram
      Only then, can a memory backend with the id "pc.ram" be created
      manually.
      
      Let's improve the error message by improving the hint. Use
      error_append_hint() -- which in turn requires ERRP_GUARD().
      
      Message-ID: <20230906120503.359863-12-david@redhat.com>
      Suggested-by: default avatarThinerLogoer <logoerthiner1@163.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Tested-by: default avatarMario Casquero <mcasquer@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      41ddcd23
    • David Hildenbrand's avatar
      nvdimm: Reject writing label data to ROM instead of crashing QEMU · 3a125839
      David Hildenbrand authored
      
      Currently, when using a true R/O NVDIMM (ROM memory backend) with a label
      area, the VM can easily crash QEMU by trying to write to the label area,
      because the ROM memory is mmap'ed without PROT_WRITE.
      
          [root@vm-0 ~]# ndctl disable-region region0
          disabled 1 region
          [root@vm-0 ~]# ndctl zero-labels nmem0
          -> QEMU segfaults
      
      Let's remember whether we have a ROM memory backend and properly
      reject the write request:
      
          [root@vm-0 ~]# ndctl disable-region region0
          disabled 1 region
          [root@vm-0 ~]# ndctl zero-labels nmem0
          zeroed 0 nmem
      
      In comparison, on a system with a R/W NVDIMM:
      
          [root@vm-0 ~]# ndctl disable-region region0
          disabled 1 region
          [root@vm-0 ~]# ndctl zero-labels nmem0
          zeroed 1 nmem
      
      For ACPI, just return "unsupported", like if no label exists. For spapr,
      return "H_P2", similar to when no label area exists.
      
      Could we rely on the "unarmed" property? Maybe, but it looks cleaner to
      only disallow what certainly cannot work.
      
      After all "unarmed=on" primarily means: cannot accept persistent writes. In
      theory, there might be setups where devices with "unarmed=on" set could
      be used to host non-persistent data (temporary files, system RAM, ...); for
      example, in Linux, admins can overwrite the "readonly" setting and still
      write to the device -- which will work as long as we're not using ROM.
      Allowing writing label data in such configurations can make sense.
      
      Message-ID: <20230906120503.359863-2-david@redhat.com>
      Fixes: dbd730e8 ("nvdimm: check -object memory-backend-file, readonly=on option")
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      3a125839
  2. Sep 12, 2023
  3. Sep 11, 2023
  4. Sep 08, 2023
Loading