• Markus Armbruster's avatar
    Revert "hostmem: fix QEMU crash by 'info memdev'" · 658ae5a7
    Markus Armbruster authored
    This reverts commit 1454d33f.
    
    The string input visitor regression fixed in the previous commit made
    visit_type_uint16List() fail on empty input.  query_memdev() calls it
    via object_property_get_uint16List().  Because it doesn't expect it to
    fail, it passes &error_abort, and duly crashes.
    
    Commit 1454d33f "fixes" this crash by making
    host_memory_backend_get_host_nodes() return a list containing just
    MAX_NODES instead of the empty list.  Papers over the regression, and
    leads to bogus "info memdev" output, as shown below; revert.
    
    I suspect that if we had bisected the crash back then, we would have
    found and fixed the actual bug instead of papering over it.
    
    To reproduce, run HMP command "info memdev" with
    
        $ qemu-system-x86_64 --nodefaults -S -display none -monitor stdio -object memory-backend-ram,id=mem1,size=4k
    
    With this commit, "info memdev" prints
    
        memory backend: mem1
          size:  4096
          merge: true
          dump: true
          prealloc: false
          policy: default
          host nodes:
    
    exactly like before commit 74f24cb6.
    
    Between commit 1454d33f and this commit, it prints
    
        memory backend: mem1
          size:  4096
          merge: true
          dump: true
          prealloc: false
          policy: default
          host nodes: 128
    
    The last line is bogus.
    
    Between commit 74f24cb6 and 1454d33f, it crashes like this:
    
        Unexpected error in parse_str() at /work/armbru/tmp/qemu/qapi/string-input-visitor.c:126:
        Parameter 'null' expects an int64 value or range
        Aborted (core dumped)
    
    Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: 's avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <1490026424-11330-3-git-send-email-armbru@redhat.com>
    Reviewed-by: 's avatarMichael Roth <mdroth@linux.vnet.ibm.com>
    Reviewed-by: 's avatarEric Blake <eblake@redhat.com>
    658ae5a7
Name
Last commit
Last update
..
Makefile.objs Loading commit data...
baum.c Loading commit data...
cryptodev-builtin.c Loading commit data...
cryptodev.c Loading commit data...
hostmem-file.c Loading commit data...
hostmem-ram.c Loading commit data...
hostmem.c Loading commit data...
msmouse.c Loading commit data...
rng-egd.c Loading commit data...
rng-random.c Loading commit data...
rng.c Loading commit data...
testdev.c Loading commit data...
tpm.c Loading commit data...
trace-events Loading commit data...
wctablet.c Loading commit data...