1. 08 8月, 2016 7 次提交
  2. 05 8月, 2016 18 次提交
  3. 04 8月, 2016 15 次提交
    • P
      linux-user: Handle brk() attempts with very large sizes · ef4330c2
      Peter Maydell 提交于
      In do_brk(), we were inadvertently truncating the size
      of a requested brk() from the guest by putting it into an
      'int' variable. This meant that we would incorrectly report
      success back to the guest rather than a failed allocation,
      typically resulting in the guest then segfaulting. Use
      abi_ulong instead.
      
      This fixes a crash in the '31370.cc' test in the gcc libstdc++ test
      suite (the test case starts by trying to allocate a very large
      size and reduces the size until the allocation succeeds).
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      ef4330c2
    • P
      linux-user: Fix target_semid_ds structure definition · 005eb2ae
      Peter Maydell 提交于
      The target_semid_ds structure is not correct for all
      architectures: the padding fields should only exist for:
       * 32-bit ABIs
       * x86
      
      It is also misnamed, since it is following the kernel
      semid64_ds structure (QEMU doesn't support the legacy
      semid_ds structure at all). Rename the struct, provide
      a correct generic definition and allow the oddball x86
      architecture to provide its own version.
      
      This fixes broken SYSV semaphores for all our 64-bit
      architectures except x86 and ppc.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      005eb2ae
    • P
      linux-user: Don't write off end of new_utsname buffer · 332c9781
      Peter Maydell 提交于
      Use g_strlcpy() rather than strcpy() to copy the uname string
      into the structure we return to the guest for the uname syscall.
      This avoids overrunning the buffer if the user passed us an
      overlong string via the QEMU command line.
      
      We fix a comment typo while we're in the neighbourhood.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      332c9781
    • P
      linux-user: Fix memchr() argument in open_self_cmdline() · ba4b3f66
      Peter Maydell 提交于
      In open_self_cmdline() we look for a 0 in the buffer we read
      from /prc/self/cmdline. We were incorrectly passing the length
      of our buf[] array to memchr() as the length to search, rather
      than the number of bytes we actually read into it, which could
      be shorter. This was spotted by Coverity (because it could
      result in our trying to pass a negative length argument to
      write()).
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      ba4b3f66
    • P
      linux-user: Use correct alignment for long long on i386 guests · d9fe91d8
      Peter Maydell 提交于
      For i386, the ABI specifies that 'long long' (8 byte values)
      need only be 4 aligned, but we were requiring them to be
      8-aligned. This meant we were laying out the target_epoll_event
      structure wrongly. Add a suitable ifdef to abitypes.h to
      specify the i386-specific alignment requirement.
      Reported-by: NIcenowy Zheng <icenowy@aosc.xyz>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      d9fe91d8
    • P
      Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging · 09704e6d
      Peter Maydell 提交于
      * xsetbv fix (x86 targets TCG)
      * remove unused functions
      * qht segfault and memory leak fixes
      * NBD fixes
      * Fix for non-power-of-2 discard granularity
      * Memory hotplug fixes
      * Migration regressions
      * IOAPIC fixes and (disabled by default) EOI register support
      * Various other small fixes
      
      # gpg: Signature made Wed 03 Aug 2016 18:01:05 BST
      # gpg:                using RSA key 0xBFFBD25F78C7AE83
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
      # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
      #      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83
      
      * remotes/bonzini/tags/for-upstream: (25 commits)
        util: Fix assertion in iov_copy() upon zero 'bytes' and non-zero 'offset'
        qdev: Fix use after free in qdev_init_nofail error path
        Reorganize help output of '-display' option
        x86: ioapic: add support for explicit EOI
        x86: ioapic: ignore level irq during processing
        apic: fix broken migration for kvm-apic
        fw_cfg: Make base type "fw_cfg" abstract
        block: Cater to iscsi with non-power-of-2 discard
        osdep: Document differences in rounding macros
        nbd: Limit nbdflags to 16 bits
        nbd: Fix bad flag detection on server
        i2c: fix migration regression introduced by broadcast support
        mptsas: really fix migration compatibility
        qdist: return "(empty)" instead of NULL when printing an empty dist
        qdist: use g_renew and g_new instead of g_realloc and g_malloc.
        qdist: fix memory leak during binning
        target-i386: fix typo in xsetbv implementation
        qht: do not segfault when gathering stats from an uninitialized qht
        util: Drop inet_listen()
        util: drop unix_nonblocking_connect()
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      09704e6d
    • P
      Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20160803-1' into staging · 29b2517a
      Peter Maydell 提交于
      vnc: fixes for "-vnc none".
      
      # gpg: Signature made Wed 03 Aug 2016 16:33:07 BST
      # gpg:                using RSA key 0x4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/pull-vnc-20160803-1:
        vnc: ensure connection sharing/limits is always configured
        vnc: fix crash when vnc_server_info_get has an error
        vnc: don't crash getting server info if lsock is NULL
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      29b2517a
    • S
      util: Fix assertion in iov_copy() upon zero 'bytes' and non-zero 'offset' · e911765c
      Shmulik Ladkani 提交于
      In cases where iov_copy() is passed with zero 'bytes' argument and a
      non-zero 'offset' argument, nothing gets copied - as expected.
      
      However no copy iterations are performed, so 'offset' is left
      unaltered, leading to the final assert(offset == 0) to fail.
      
      Instead, change the loop condition to continue as long as 'offset || bytes',
      similar to other iov_* functions.
      
      This ensures 'offset' gets zeroed (even if no actual copy is made),
      unless it is beyond end of source iov - which is asserted.
      Signed-off-by: NShmulik Ladkani <shmulik.ladkani@ravellosystems.com>
      Message-Id: <1470130880-1050-1-git-send-email-shmulik.ladkani@oracle.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e911765c
    • F
      qdev: Fix use after free in qdev_init_nofail error path · 0d4104e5
      Fam Zheng 提交于
      Since 69382d8b (qdev: Fix object reference leak in case device.realize()
      fails), object_property_set_bool could release the object. The error
      path wants the type name, so hold an reference before realizing it.
      
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Message-Id: <1470109301-12966-1-git-send-email-famz@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0d4104e5
    • R
      Reorganize help output of '-display' option · f04ec5af
      Robert Ho 提交于
      The '-display' help information is not very correct. This patch sort
      it a little.
      Also, in its help information, reveals what implicit display option
      will be chosen if no definition.
      Signed-off-by: NRobert Ho <robert.hu@intel.com>
      Message-Id: <1469528231-26206-1-git-send-email-robert.hu@intel.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f04ec5af
    • P
      x86: ioapic: add support for explicit EOI · 20fd4b7b
      Peter Xu 提交于
      Some old Linux kernels (upstream before v4.0), or any released RHEL
      kernels has problem in sending APIC EOI when IR is enabled. Meanwhile,
      many of them only support explicit EOI for IOAPIC, which is only
      introduced in IOAPIC version 0x20. This patch provide a way to boost
      QEMU IOAPIC to version 0x20, in order for QEMU to correctly receive EOI
      messages.
      
      Without boosting IOAPIC version to 0x20, kernels before commit d32932d
      ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces")
      will have trouble enabling both IR and level-triggered interrupt devices
      (like e1000).
      
      To upgrade IOAPIC to version 0x20, we need to specify:
      
        -global ioapic.version=0x20
      
      To be compatible with old systems, 0x11 will still be the default IOAPIC
      version. Here 0x11 and 0x20 are the only versions to be supported.
      
      One thing to mention: this patch only applies to emulated IOAPIC. It
      does not affect kernel IOAPIC behavior.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <1470059959-372-1-git-send-email-peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      20fd4b7b
    • P
      x86: ioapic: ignore level irq during processing · f99b86b9
      Peter Xu 提交于
      For level triggered interrupts, we will get Remote IRR bit cleared after
      guest kernel finished processing specific request. Before that, we
      should ignore the same interrupt from triggering again.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <1469974685-4144-1-git-send-email-peterx@redhat.com>
      [Push new "if" up so that it covers KVM split irqchip as well. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f99b86b9
    • I
      apic: fix broken migration for kvm-apic · 7298d4fd
      Igor Mammedov 提交于
      commit f6e98444 (apic: Use apic_id as apic's migration instance_id)
      breaks migration when in kernel irqchip is used for 2.6 and older
      machine types.
      
      It applies compat property only for userspace 'apic' type
      instead of applying it to all apic types inherited from
      'apic-common' type as it was supposed to do.
      
      Fix it by setting compat property 'legacy-instance-id' for
      'apic-common' type which affects inherited types (i.e. not
      only 'apic' but also 'kvm-apic' types)
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1469800542-11402-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7298d4fd
    • M
      fw_cfg: Make base type "fw_cfg" abstract · e061fa3c
      Markus Armbruster 提交于
      Missed when commit 5712db6a split off "fw_cfg_io" and "fw_cfg_mem".
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1469777353-9383-1-git-send-email-armbru@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e061fa3c
    • E
      block: Cater to iscsi with non-power-of-2 discard · b8d0a980
      Eric Blake 提交于
      Dell Equallogic iSCSI SANs have a very unusual advertised geometry:
      
      $ iscsi-inq -e 1 -c $((0xb0)) iscsi://XXX/0
      wsnz:0
      maximum compare and write length:1
      optimal transfer length granularity:0
      maximum transfer length:0
      optimal transfer length:0
      maximum prefetch xdread xdwrite transfer length:0
      maximum unmap lba count:30720
      maximum unmap block descriptor count:2
      optimal unmap granularity:30720
      ugavalid:1
      unmap granularity alignment:0
      maximum write same length:30720
      
      which says that both the maximum and the optimal discard size
      is 15M.  It is not immediately apparent if the device allows
      discard requests not aligned to the optimal size, nor if it
      allows discards at a finer granularity than the optimal size.
      
      I tried to find details in the SCSI Commands Reference Manual
      Rev. A on what valid values of maximum and optimal sizes are
      permitted, but while that document mentions a "Block Limits
      VPD Page", I couldn't actually find documentation of that page
      or what values it would have, or if a SCSI device has an
      advertisement of its minimal unmap granularity.  So it is not
      obvious to me whether the Dell Equallogic device is compliance
      with the SCSI specification.
      
      Fortunately, it is easy enough to support non-power-of-2 sizing,
      even if it means we are less efficient than truly possible when
      targetting that device (for example, it means that we refuse to
      unmap anything that is not a multiple of 15M and aligned to a
      15M boundary, even if the device truly does support a smaller
      granularity where unmapping actually works).
      Reported-by: NPeter Lieven <pl@kamp.de>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1469129688-22848-5-git-send-email-eblake@redhat.com>
      Acked-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b8d0a980