1. 05 5月, 2017 8 次提交
    • D
      checkpatch: Disallow glib asserts in main code · 6e938956
      Dr. David Alan Gilbert 提交于
      Glib commit a6a875068779 (from 2013) made many of the glib assert
      macros non-fatal if a flag is set.
      This causes two problems:
        a) Compilers moan that your code is unsafe even though you've
           put an assert in before the point of use.
        b) Someone evil could, in a library, call
           g_test_set_nonfatal_assertions() and cause our assertions in
           important places not to fail and potentially allow memory overruns.
      
      Ban most of the glib assertion functions (basically everything except
      g_assert and g_assert_not_reached) except in tests/
      
      This makes checkpatch gives an error such as:
      
        ERROR: Use g_assert or g_assert_not_reached
        #77: FILE: vl.c:4725:
        +    g_assert_cmpstr("Chocolate", >, "Cheese");
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20170427165526.19836-1-dgilbert@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6e938956
    • J
      trace: add qemu mutex lock and unlock trace events · 31f5a726
      Jose Ricardo Ziviani 提交于
      These trace events were very useful to help me to understand and find a
      reordering issue in vfio, for example:
      
      qemu_mutex_lock locked mutex 0x10905ad8
        vfio_region_write  (0001:03:00.0:region1+0xc0, 0x2020c, 4)
      qemu_mutex_unlock unlocked mutex 0x10905ad8
      qemu_mutex_lock locked mutex 0x10905ad8
        vfio_region_write  (0001:03:00.0:region1+0xc4, 0xa0000, 4)
      qemu_mutex_unlock unlocked mutex 0x10905ad8
      
      that also helped me to see the desired result after the fix:
      
      qemu_mutex_lock locked mutex 0x10905ad8
        vfio_region_write  (0001:03:00.0:region1+0xc0, 0x2000c, 4)
        vfio_region_write  (0001:03:00.0:region1+0xc4, 0xb0000, 4)
      qemu_mutex_unlock unlocked mutex 0x10905ad8
      
      So it could be a good idea to have these traces implemented. It's worth
      mentioning that they should be surgically enabled during the debugging,
      otherwise it can flood the trace logs with lock/unlock messages.
      
      How to use it:
      trace-event qemu_mutex_lock on|off
      trace-event qemu_mutex_unlock on|off
      or
      trace-event qemu_mutex* on|off
      Signed-off-by: NJose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
      Message-Id: <1493054398-26013-1-git-send-email-joserz@linux.vnet.ibm.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      [Also handle trylock, cond_wait and win32; trace "unlocked" while still
       in the critical section, so that "unlocked" always comes before the
       next "locked" tracepoint. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      31f5a726
    • P
      vmw_pvscsi: check message ring page count at initialisation · f6882698
      P J P 提交于
      A guest could set the message ring page count to zero, resulting in
      infinite loop. Add check to avoid it.
      Reported-by: NYY Z <bigbird475958471@gmail.com>
      Signed-off-by: NP J P <ppandit@redhat.com>
      Message-Id: <20170425130623.3649-1-ppandit@redhat.com>
      Reviewed-by: NDmitry Fleytman <dmitry@daynix.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f6882698
    • P
      sgabios: update for "fix wrong video attrs for int 10h,ah==13h" · c8c33fca
      Paolo Bonzini 提交于
      Update the submodule and rebuild the binary.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c8c33fca
    • P
      scsi: avoid an off-by-one error in megasas_mmio_write · 24dfa9fa
      Prasad J Pandit 提交于
      While reading magic sequence(MFI_SEQ) in megasas_mmio_write,
      an off-by-one error could occur as 's->adp_reset' index is not
      reset after reading the last sequence.
      Reported-by: NYY Z <bigbird475958471@gmail.com>
      Signed-off-by: NPrasad J Pandit <pjp@fedoraproject.org>
      Message-Id: <20170424120634.12268-1-ppandit@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      24dfa9fa
    • T
      vl: deprecate the "-hdachs" option · aab9e87e
      Thomas Huth 提交于
      If the user needs to specify the disk geometry, the corresponding
      parameters of the "-device ide-hd" option should be used instead.
      "-hdachs" is considered as deprecated and might be removed soon.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1493270454-1448-1-git-send-email-thuth@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      aab9e87e
    • A
      use _Static_assert in QEMU_BUILD_BUG_ON · 49e00a18
      Andreas Grapentin 提交于
      QEMU_BUILD_BUG_ON should use C11's _Static_assert, if the compiler supports it,
      to provide more readable messages on failure.
      
      We check for _Static_assert in configure, and set CONFIG_STATIC_ASSERT
      accordingly. QEMU_BUILD_BUG_ON invokes _Static_assert if CONFIG_STATIC_ASSERT
      is defined, and reverts to the old way otherwise.
      
      That way, systems without C11 conforming compiler will still have the old
      messages, as verified by intentionally breaking the configure check.
      
      the following example output was generated by inverting the condition in
      QEMU_BUILD_BUG_ON:
      
      without _Static_assert:
      
      > In file included from /qemu/include/qemu/osdep.h:36:0,
      >                  from /qemu/qga/commands.c:13:
      > /qemu/qga/commands.c: In function ‘qmp_guest_exec_status’:
      > /qemu/include/qemu/compiler.h:89:12: error: negative width in bit-field ‘<anonymous>’
      >      struct { \
      >             ^
      > /qemu/include/qemu/compiler.h:96:38: note: in expansion of macro  QEMU_BUILD_BUG_ON_STRUCT’
      >  #define QEMU_BUILD_BUG_ON(x) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \
      >                                       ^~~~~~~~~~~~~~~~~~~~~~~~
      > /qemu/include/qemu/atomic.h:146:5: note: in expansion of macro ‘QEMU_BUILD_BUG_ON’
      >      QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *));   \
      >      ^~~~~~~~~~~~~~~~~
      > /qemu/include/qemu/atomic.h:417:5: note: in expansion of macro ‘atomic_load_acquire’
      >      atomic_load_acquire(ptr)
      >      ^~~~~~~~~~~~~~~~~~~
      > /qemu/qga/commands.c:160:21: note: in expansion of macro ‘atomic_mb_read’
      >      bool finished = atomic_mb_read(&gei->finished);
      >                      ^~~~~~~~~~~~~~
      
      with _Static_assert:
      
      > In file included from /qemu/include/qemu/osdep.h:36:0,
      >                  from /qemu/qga/commands.c:13:
      > /qemu/qga/commands.c: In function ‘qmp_guest_exec_status’:
      > /qemu/include/qemu/compiler.h:94:30: error: static assertion failed: "not expecting: sizeof(*&gei->finished) > sizeof(void *)"
      >  #define QEMU_BUILD_BUG_ON(x) _Static_assert((x), #x)
      >                               ^
      > /qemu/include/qemu/atomic.h:146:5: note: in expansion of macro ‘QEMU_BUILD_BUG_ON’
      >      QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *));   \
      >      ^~~~~~~~~~~~~~~~~
      > /qemu/include/qemu/atomic.h:417:5: note: in expansion of macro ‘atomic_load_acquire’
      >      atomic_load_acquire(ptr)
      >      ^~~~~~~~~~~~~~~~~~~
      > /qemu/qga/commands.c:160:21: note: in expansion of macro ‘atomic_mb_read’
      >      bool finished = atomic_mb_read(&gei->finished);
      >                      ^~~~~~~~~~~~~~
      Signed-off-by: NAndreas Grapentin <andreas@grapentin.org>
      Message-Id: <20170314165953.18506-1-andreas@grapentin.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      49e00a18
    • A
      target/i386: Add GDB XML register description support · 00fcd100
      Abdallah Bouassida 提交于
      This patch implements XML target description support for X86 and X86-64
      architectures in the GDB stub, as the way with ARM and PowerPC:
      - gdb-xml/32bit-core.xml & gdb-xml/64bit-core.xml: Adding the XML target
        description files, these files are picked from GDB source code.
      - configure: Define gdb_xml_files for X86 targets.
      - target/i386/cpu.c: Define gdb_core_xml_file and gdb_arch_name to add
        XML awareness for this architecture, modify the gdb_num_core_regs to
        fit the registers number defined in each XML file.
      Signed-off-by: NAbdallah Bouassida <abdallah.bouassida@lauterbach.com>
      Message-Id: <2b3c8119-1602-28c7-eab4-296593877103@lauterbach.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      00fcd100
  2. 03 5月, 2017 3 次提交
    • Z
      char: Fix removing wrong GSource that be found by fd_in_tag · b19456dd
      zhanghailiang 提交于
      We use fd_in_tag to find a GSource, fd_in_tag is return value of
      g_source_attach(GSource *source, GMainContext *context), the return
      value is unique only in the same context, so we may get the same
      values with different 'context' parameters.
      
      It is no problem to find the right fd_in_tag by using
       g_main_context_find_source_by_id(GMainContext *context, guint source_id)
      while there is only one default main context.
      
      But colo-compare tries to create/use its own context, and if we pass wrong
      'context' parameter with right fd_in_tag, we will find a wrong GSource to handle.
      We tried to fix the related codes in commit b43decb0,
      but it didn't fix the bug completely, because we still have some codes didn't pass
      *right* context parameter for remove_fd_in_watch().
      
      Let's fix it by record the GSource directly instead of fd_in_tag.
      Signed-off-by: Nzhanghailiang <zhang.zhanghailiang@huawei.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1492564532-91680-1-git-send-email-zhang.zhanghailiang@huawei.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b19456dd
    • P
      hw/i386: Build-time assertion on pc/q35 reset register being identical. · 6103451a
      Phil Dennis-Jordan 提交于
      This adds a clarifying comment and build time assert to the FADT reset register field initialisation: the reset register is the same on both machine types.
      Signed-off-by: NPhil Dennis-Jordan <phil@philjordan.eu>
      Message-Id: <1489558827-28971-3-git-send-email-phil@philjordan.eu>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6103451a
    • P
      hw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support. · 77af8a2b
      Phil Dennis-Jordan 提交于
      This updates the FADT generated for x86/64 machine types from Revision 1 to 3. (Based on ACPI standard 2.0 instead of 1.0) The intention is to expose the reset register information to guest operating systems which require it, specifically OS X/macOS. Revision 1 FADTs do not contain the fields relating to the reset register.
      
      The new layout and contents remains backwards-compatible with operating systems which only support ACPI 1.0, as the existing fields are not modified by this change, as the 64-bit and 32-bit variants are allowed to co-exist according to the ACPI 2.0 standard. No regressions became apparent in tests with a range of Windows (XP-10) and Linux versions.
      
      The BIOS tables test suite's FADT checksum test has also been updated to reflect the new FADT layout and content.
      Signed-off-by: NPhil Dennis-Jordan <phil@philjordan.eu>
      Message-Id: <1489558827-28971-2-git-send-email-phil@philjordan.eu>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      77af8a2b
  3. 02 5月, 2017 1 次提交
    • S
      Merge remote-tracking branch 'sthibault/tags/samuel-thibault' into staging · e619b147
      Stefan Hajnoczi 提交于
      slirp updates
      
      # gpg: Signature made Sat 29 Apr 2017 05:45:24 PM BST
      # gpg:                using RSA key 0xB0A51BF58C9179C5
      # gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>"
      # gpg:                 aka "Samuel Thibault <sthibault@debian.org>"
      # gpg:                 aka "Samuel Thibault <samuel.thibault@gnu.org>"
      # gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>"
      # gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>"
      # gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>"
      # gpg:                 aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>"
      # Primary key fingerprint: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
      #      Subkey fingerprint: AEBF 7448 FAB9 453A 4552  390E B0A5 1BF5 8C91 79C5
      
      * sthibault/tags/samuel-thibault:
        slirp: VMStatify remaining except for loop
        slirp: VMStatify socket level
        slirp: Common lhost/fhost union
        slirp: VMStatify sbuf
        slirp: VMState conversion; tcpcb
        slirp: fix pinging the virtual ipv4 DNS server
        slirp: tftp, copy sockaddr_size
        slirp/smb: Replace constant strings by glib string
        slirp: allow host port 0 for hostfwd
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      e619b147
  4. 30 4月, 2017 9 次提交
  5. 28 4月, 2017 3 次提交
    • M
      replication: Make --disable-replication compile again · 38bb54f3
      Markus Armbruster 提交于
      Broken in commit daa33c52.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NZhang Chen <zhangchen.fnst@cn.fujitsu.com>
      Message-id: 1493298053-17140-1-git-send-email-armbru@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      38bb54f3
    • G
      configure: fix trace backend list for out-of-tree builds · 64a6047d
      Greg Kurz 提交于
      Since commit "c53eeaf7 configure: eliminate Python dependency for
      --help", configure --help fails to produce the list of available trace
      backends if invoked out-of-tree. It also spits the following error:
      
      grep: scripts/tracetool/backend/*.py: No such file or directory
      
      This patch simply adds the missing $source_path to fix it.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-id: 149321376763.7874.12797658801011614451.stgit@bahia
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      64a6047d
    • S
      Merge remote-tracking branch 'mdroth/tags/qga-pull-2017-04-25-v2-tag' into staging · 7ad691ec
      Stefan Hajnoczi 提交于
      qemu-ga patch queue
      
      * new commands: guest-get-timezone, guest-get-users, guest-get-host-name
      * fix hang on w32 when stopping qemu-ga service while fs frozen
      * fix missing setting of can-offline in guest-get-vcpus
      * make qemu-ga VSS w32 service on-demand rather than on-startup
      * fix unecessary errors to EventLog on w32
      * improvements to fsfreeze documentation
      
      v2:
       * document 'zone' field of guest-get-timezone as informational-only
         (Daniel, Eric)
       * fix build error for glib < 2.32 (Peter)
      
      # gpg: Signature made Thu 27 Apr 2017 06:43:42 AM BST
      # gpg:                using RSA key 0x3353C9CEF108B584
      # gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
      # gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
      # gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"
      # Primary key fingerprint: CEAC C9E1 5534 EBAB B82D  3FA0 3353 C9CE F108 B584
      
      * mdroth/tags/qga-pull-2017-04-25-v2-tag:
        qga: Add `guest-get-timezone` command
        qga: Add 'guest-get-users' command
        qga: improve fsfreeze documentations
        qga: Add 'guest-get-host-name' command
        qga-win: Fix Event Viewer errors caused by qemu-ga
        qga-win: Fix a bug where qemu-ga service is stuck during stop operation
        qga-win: Enable 'can-offline' field in 'guest-get-vcpus' reply
        qemu-ga: Make QGA VSS provider service run only when needed
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7ad691ec
  6. 27 4月, 2017 10 次提交
  7. 26 4月, 2017 6 次提交