Skip to content
  • Christian Borntraeger's avatar
    qemu: Use valgrind annotations to mark kvm guest memory as defined · 62fe8331
    Christian Borntraeger authored
    
    
    valgrind with kvm produces a big amount of false positives regarding
    "Conditional jump or move depends on uninitialised value(s)". This
    happens because the guest memory is allocated with qemu_vmalloc which
    boils down posix_memalign etc. This function is (correctly) considered
    by valgrind as returning undefined memory.
    
    Since valgrind is based on jitting code, it will not be able to see
    changes made by the guest to guest memory if this is done by KVM_RUN,
    thus keeping most of the guest memory undefined.
    
    Now lots of places in qemu will then use guest memory to change behaviour.
    To avoid the flood of these messages, lets declare the whole guest
    memory as defined. This will reduce the noise and allows us to see real
    problems.
    
    In the future we might want to make this conditional, since there
    is actually something that we can use those false positives for:
    These messages will point to code that depends on guest memory, so
    we can use these backtraces to actually make an audit that is focussed
    only at those code places. For normal development we dont want to
    see those messages, though.
    
    Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
    62fe8331