Skip to content

Commits

Permalink
stable-3.1-sta…
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Commits on Oct 1, 2019

  1. slrip: ip_reass: Fix use after free

    Using ip_deq after m_free might read pointers from an allocation reuse.
    
    This would be difficult to exploit, but that is still related with
    CVE-2019-14378 which generates fragmented IP packets that would trigger this
    issue and at least produce a DoS.
    
    Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    (from libslirp.git commit c59279437eda91841b9d26079c70b8a540d41204)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    mdroth committed Oct 1, 2019
    Copy the full SHA
    9efdbc0 View commit details
    Browse the repository at this point in the history
  2. slirp: Fix heap overflow in ip_reass on big packet input

    When the first fragment does not fit in the preallocated buffer, q will
    already be pointing to the ext buffer, so we mustn't try to update it.
    
    Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    (from libslirp.git commit 126c04acbabd7ad32c2b018fe10dfac2a3bc1210)
    (from libslirp.git commit e0be80430c390bce181ea04dfcdd6ea3dfa97de1)
    *squash in e0be80 (clarifying comments)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    mdroth committed Oct 1, 2019
    Copy the full SHA
    28c1dde View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2019

  1. pvrdma: Fix compilation error

      In function ‘create_qp’:
      hw/rdma/vmw/pvrdma_cmd.c:517:16: error: ‘rc’ undeclared
    
    The backport of 509f57c in 41dd30f mishandled the conflict
    
    Signed-off-by: Cole Robinson <crobinso@redhat.com>
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    crobinso authored and mdroth committed Sep 19, 2019
    Copy the full SHA
    ab630a0 View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2019

  1. Update version for 3.1.1 release

    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    mdroth committed Aug 2, 2019
    Copy the full SHA
    71049d2 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2019

  1. qemu-bridge-helper: restrict interface name to IFNAMSIZ

    The network interface name in Linux is defined to be of size
    IFNAMSIZ(=16), including the terminating null('\0') byte.
    The same is applied to interface names read from 'bridge.conf'
    file to form ACL rules. If user supplied '--br=bridge' name
    is not restricted to the same length, it could lead to ACL bypass
    issue. Restrict interface name to IFNAMSIZ, including null byte.
    
    Reported-by: Riccardo Schirone <rschiron@redhat.com>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit 6f5d867)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    03d7712 View commit details
    Browse the repository at this point in the history
  2. block: Fix hangs in synchronous APIs with iothreads

    In the block layer, synchronous APIs are often implemented by creating a
    coroutine that calls the asynchronous coroutine-based implementation and
    then waiting for completion with BDRV_POLL_WHILE().
    
    For this to work with iothreads (more specifically, when the synchronous
    API is called in a thread that is not the home thread of the block
    device, so that the coroutine will run in a different thread), we must
    make sure to call aio_wait_kick() at the end of the operation. Many
    places are missing this, so that BDRV_POLL_WHILE() keeps hanging even if
    the condition has long become false.
    
    Note that bdrv_dec_in_flight() involves an aio_wait_kick() call. This
    corresponds to the BDRV_POLL_WHILE() in the drain functions, but it is
    generally not enough for most other operations because they haven't set
    the return value in the coroutine entry stub yet. To avoid race
    conditions there, we need to kick after setting the return value.
    
    The race window is small enough that the problem doesn't usually surface
    in the common path. However, it does surface and causes easily
    reproducible hangs if the operation can return early before even calling
    bdrv_inc/dec_in_flight, which many of them do (trivial error or no-op
    success paths).
    
    The bug in bdrv_truncate(), bdrv_check() and bdrv_invalidate_cache() is
    slightly different: These functions even neglected to schedule the
    coroutine in the home thread of the node. This avoids the hang, but is
    obviously wrong, too. Fix those to schedule the coroutine in the right
    AioContext in addition to adding aio_wait_kick() calls.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 4720cbe)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Kevin Wolf authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    4482258 View commit details
    Browse the repository at this point in the history
  3. pvrdma: release ring object in case of an error

    create_cq and create_qp routines allocate ring object, but it's
    not released in case of an error, leading to memory leakage.
    
    Reported-by: Li Qiang <liq3ea@163.com>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
    Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
    (cherry picked from commit 509f57c)
     Conflicts:
    	hw/rdma/vmw/pvrdma_cmd.c
    *drop dependency on 0917821
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    41dd30f View commit details
    Browse the repository at this point in the history
  4. pvrdma: check return value from pvrdma_idx_ring_has_ routines

    pvrdma_idx_ring_has_[data/space] routines also return invalid
    index PVRDMA_INVALID_IDX[=-1], if ring has no data/space. Check
    return value from these routines to avoid plausible infinite loops.
    
    Reported-by: Li Qiang <liq3ea@163.com>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
    Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
    (cherry picked from commit f1e2e38)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    a100176 View commit details
    Browse the repository at this point in the history
  5. pvrdma: check number of pages when creating rings

    When creating CQ/QP rings, an object can have up to
    PVRDMA_MAX_FAST_REG_PAGES 8 pages. Check 'npages' parameter
    to avoid excessive memory allocation or a null dereference.
    
    Reported-by: Li Qiang <liq3ea@163.com>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
    Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
    (cherry picked from commit 2c858ce)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    2a0e6f1 View commit details
    Browse the repository at this point in the history
  6. device_tree: Fix integer overflowing in load_device_tree()

    If the value of get_image_size() exceeds INT_MAX / 2 - 10000, the
    computation of @dt_size overflows to a negative number, which then
    gets converted to a very large size_t for g_malloc0() and
    load_image_size().  In the (fortunately improbable) case g_malloc0()
    succeeds and load_image_size() survives, we'd assign the negative
    number to *sizep.  What that would do to the callers I can't say, but
    it's unlikely to be good.
    
    Fix by rejecting images whose size would overflow.
    
    Reported-by: Kurtis Miller <kurtis.miller@nccgroup.com>
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    Message-Id: <20190409174018.25798-1-armbru@redhat.com>
    (cherry picked from commit 065e629)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Markus Armbruster authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    017f271 View commit details
    Browse the repository at this point in the history
  7. device_tree.c: Don't use load_image()

    The load_image() function is deprecated, as it does not let the
    caller specify how large the buffer to read the file into is.
    Instead use load_image_size().
    
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Message-id: 20181130151712.2312-9-peter.maydell@linaro.org
    (cherry picked from commit da885fe)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    pm215 authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    5149630 View commit details
    Browse the repository at this point in the history
  8. sun4u: add power_mem_read routine

    Define skeleton 'power_mem_read' routine. Avoid NULL dereference.
    
    Reported-by: Fakhri Zulkifli <mohdfakhrizulkifli@gmail.com>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    (cherry picked from commit ad28055)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    59a8230 View commit details
    Browse the repository at this point in the history
  9. qxl: check release info object

    When releasing spice resources in release_resource() routine,
    if release info object 'ext.info' is null, it leads to null
    pointer dereference. Add check to avoid it.
    
    Reported-by: Bugs SysSec <bugs-syssec@rub.de>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Message-id: 20190425063534.32747-1-ppandit@redhat.com
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    (cherry picked from commit d52680f)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    3be7eb2 View commit details
    Browse the repository at this point in the history
  10. seccomp: don't kill process for resource control syscalls

    The Mesa library tries to set process affinity on some of its threads in
    order to optimize its performance. Currently this results in QEMU being
    immediately terminated when seccomp is enabled.
    
    Mesa doesn't consider failure of the process affinity settings to be
    fatal to its operation, but our seccomp policy gives it no choice in
    gracefully handling this denial.
    
    It is reasonable to consider that malicious code using the resource
    control syscalls to be a less serious attack than if they were trying
    to spawn processes or change UIDs and other such things. Generally
    speaking changing the resource control setting will "merely" affect
    quality of service of processes on the host. With this in mind, rather
    than kill the process, we can relax the policy for these syscalls to
    return the EPERM errno value. This allows callers to detect that QEMU
    does not want them to change resource allocations, and apply some
    reasonable fallback logic.
    
    The main downside to this is for code which uses these syscalls but does
    not check the return value, blindly assuming they will always
    succeeed. Returning an errno could result in sub-optimal behaviour.
    Arguably though such code is already broken & needs fixing regardless.
    
    Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Signed-off-by: Eduardo Otubo <otubo@redhat.com>
    (cherry picked from commit 9a1565a)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    berrange authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    576964b View commit details
    Browse the repository at this point in the history
  11. i2c-ddc: fix oob read

    Suggested-by: Michael Hanselmann <public@hansmi.ch>
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reviewed-by: Michael Hanselmann <public@hansmi.ch>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20190108102301.1957-1-kraxel@redhat.com
    (cherry picked from commit b05b267)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    kraxel authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    4c7f4c4 View commit details
    Browse the repository at this point in the history
  12. slirp: check data length while emulating ident function

    While emulating identification protocol, tcp_emu() does not check
    available space in the 'sc_rcv->sb_data' buffer. It could lead to
    heap buffer overflow issue. Add check to avoid it.
    
    Reported-by: Kira <864786842@qq.com>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    (cherry picked from commit a7104ed)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    4e74e7a View commit details
    Browse the repository at this point in the history
  13. scsi-generic: avoid possible out-of-bounds access to r->buf

    Whenever the allocation length of a SCSI request is shorter than the size of the
    VPD page list, page_idx is used blindly to index into r->buf.  Even though
    the stores in the insertion sort are protected against overflows, the same is not
    true of the reads and the final store of 0xb0.
    
    This basically does the same thing as commit 57dbb58 ("scsi-generic: avoid
    out-of-bounds access to VPD page list", 2018-11-06), except that here the
    allocation length can be chosen by the guest.  Note that according to the SCSI
    standard, the contents of the PAGE LENGTH field are not altered based
    on the allocation length.
    
    The code was introduced by commit 6c219fc ("scsi-generic: keep VPD
    page list sorted", 2018-11-06) but the overflow was already possible before.
    
    Reported-by: Kevin Wolf <kwolf@redhat.com>
    Fixes: a71c775
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit e909ff9)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    bonzini authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    375667a View commit details
    Browse the repository at this point in the history
  14. pvrdma: add uar_read routine

    Define skeleton 'uar_read' routine. Avoid NULL dereference.
    
    Reported-by: Li Qiang <liq3ea@163.com>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
    Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
    (cherry picked from commit 2aa8645)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    bceff52 View commit details
    Browse the repository at this point in the history
  15. pvrdma: release device resources in case of an error

    If during pvrdma device initialisation an error occurs,
    pvrdma_realize() does not release memory resources, leading
    to memory leakage.
    
    Reported-by: Li Qiang <liq3ea@163.com>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Message-Id: <20181212175817.815-1-ppandit@redhat.com>
    Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
    Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
    (cherry picked from commit cce6486)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasad J Pandit authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    1549e3a View commit details
    Browse the repository at this point in the history
  16. gluster: the glfs_io_cbk callback function pointer adds pre/post stat…

    … args
    
    The glfs_*_async() functions do a callback once finished. This callback
    has changed its arguments, pre- and post-stat structures have been
    added. This makes it possible to improve caching, which is useful for
    Samba and NFS-Ganesha, but not so much for QEMU. Gluster 6 is the first
    release that includes these new arguments.
    
    With an additional detection in ./configure, the new arguments can
    conditionally get included in the glfs_io_cbk handler.
    
    Signed-off-by: Niels de Vos <ndevos@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 0e3b891)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    nixpanic authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    86d4f40 View commit details
    Browse the repository at this point in the history
  17. gluster: Handle changed glfs_ftruncate signature

    New versions of Glusters libgfapi.so have an updated glfs_ftruncate()
    function that returns additional 'struct stat' structures to enable
    advanced caching of attributes. This is useful for file servers, not so
    much for QEMU. Nevertheless, the API has changed and needs to be
    adopted.
    
    Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
    Signed-off-by: Niels de Vos <ndevos@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit e014dbe)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Prasanna Kumar Kalever authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    3786721 View commit details
    Browse the repository at this point in the history
  18. hw/block/pflash_cfi01: Add missing DeviceReset() handler

    To avoid incoherent states when the machine resets (see bug report
    below), add the device reset callback.
    
    A "system reset" sets the device state machine in READ_ARRAY mode
    and, after some delay, set the SR.7 READY bit.
    
    Since we do not model timings, we set the SR.7 bit directly.
    
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1678713
    Reported-by: Laszlo Ersek <lersek@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Laszlo Ersek <lersek@redhat.com>
    Tested-by: Laszlo Ersek <lersek@redhat.com>
    [Laszlo Ersek: Regression tested EDK2 OVMF IA32X64, ArmVirtQemu Aarch64
     https://lists.gnu.org/archive/html/qemu-devel/2019-07/msg04373.html]
    Message-Id: <20190718104837.13905-2-philmd@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    (cherry picked from commit 3a28350)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    philmd authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    43a3a1b View commit details
    Browse the repository at this point in the history
  19. hw: Use PFLASH_CFI0{1,2} and TYPE_PFLASH_CFI0{1,2}

    We have two open-coded copies of macro PFLASH_CFI01().  Move the macro
    to the header, so we can ditch the copies.  Move PFLASH_CFI02() to the
    header for symmetry.
    
    We define macros TYPE_PFLASH_CFI01 and TYPE_PFLASH_CFI02 for type name
    strings, then mostly use the strings.  If the macros are worth
    defining, they are worth using.  Replace the strings by the macros.
    
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Laszlo Ersek <lersek@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20190308094610.21210-6-armbru@redhat.com>
    (cherry picked from commit 81c7db7)
    *prereq for 3a28350
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Markus Armbruster authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    ddacb78 View commit details
    Browse the repository at this point in the history
  20. pflash: Rename *CFI_PFLASH* to *PFLASH_CFI*

    pflash_cfi01.c and pflash_cfi02.c start their identifiers with
    pflash_cfi01_ and pflash_cfi02_ respectively, except for
    CFI_PFLASH01(), TYPE_CFI_PFLASH01, CFI_PFLASH02(), TYPE_CFI_PFLASH02.
    Rename for consistency.
    
    Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20190308094610.21210-5-armbru@redhat.com>
    (cherry picked from commit e7b6274)
    *prereq for 3a28350
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Markus Armbruster authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    03f130c View commit details
    Browse the repository at this point in the history
  21. pflash_cfi01: Log use of flawed "write to buffer"

    Our implementation of "write to buffer" (command 0xE8) is flawed.
    LOG_UNIMP its use, and add some FIXME comments.
    
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20190308094610.21210-4-armbru@redhat.com>
    (cherry picked from commit 4dbda93)
    *prereq for 3a28350
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Markus Armbruster authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    10b1d60 View commit details
    Browse the repository at this point in the history
  22. pflash_cfi01: Do not exit() on guest aborting "write to buffer"

    When a guest tries to abort "write to buffer" (command 0xE8), we print
    "PFLASH: Possible BUG - Write block confirm", then exit(1).  Letting
    the guest terminate QEMU is not a good idea.  Instead, LOG_UNIMP we
    screwed up, then reset the device.
    
    Macro PFLASH_BUG() is now unused; delete it.
    
    Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20190308094610.21210-3-armbru@redhat.com>
    (cherry picked from commit 2d93beb)
    *prereq for 3a28350
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Markus Armbruster authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    e634054 View commit details
    Browse the repository at this point in the history
  23. pflash: Rename pflash_t to PFlashCFI01, PFlashCFI02

    flash.h's incomplete struct pflash_t is completed both in
    pflash_cfi01.c and in pflash_cfi02.c.  The complete types are
    incompatible.  This can hide type errors, such as passing a pflash_t
    created with pflash_cfi02_register() to pflash_cfi01_get_memory().
    
    Furthermore, POSIX reserves typedef names ending with _t.
    
    Rename the two structs to PFlashCFI01 and PFlashCFI02.
    
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20190308094610.21210-2-armbru@redhat.com>
    (cherry picked from commit 1643406)
    *prereq for 3a28350
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Markus Armbruster authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    13cb31c View commit details
    Browse the repository at this point in the history
  24. block/pflash_cfi02: Fix memory leak and potential use-after-free

    Don't dynamically allocate the pflash's timer. But do use timer_del in
    an unrealize function to make sure that the timer can't fire after the
    pflash_t has been freed.
    
    Signed-off-by: Stephen Checkoway <stephen.checkoway@oberlin.edu>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Wei Yang <richardw.yang@linux.intel.com>
    Message-Id: <20190219153727.62279-1-stephen.checkoway@oberlin.edu>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit d80cf1e)
    *prereq for 1643406/3a283507
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    stevecheckoway authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    d0cb440 View commit details
    Browse the repository at this point in the history
  25. hw/display/xlnx_dp: Avoid crash when reading empty RX FIFO

    In the previous commit we fixed a crash when the guest read a
    register that pop from an empty FIFO.
    By auditing the repository, we found another similar use with
    an easy way to reproduce:
    
      $ qemu-system-aarch64 -M xlnx-zcu102 -monitor stdio -S
      QEMU 4.0.50 monitor - type 'help' for more information
      (qemu) xp/b 0xfd4a0134
      Aborted (core dumped)
    
      (gdb) bt
      #0  0x00007f6936dea57f in raise () at /lib64/libc.so.6
      #1  0x00007f6936dd4895 in abort () at /lib64/libc.so.6
      #2  0x0000561ad32975ec in xlnx_dp_aux_pop_rx_fifo (s=0x7f692babee70) at hw/display/xlnx_dp.c:431
      #3  0x0000561ad3297dc0 in xlnx_dp_read (opaque=0x7f692babee70, offset=77, size=4) at hw/display/xlnx_dp.c:667
      #4  0x0000561ad321b896 in memory_region_read_accessor (mr=0x7f692babf620, addr=308, value=0x7ffe05c1db88, size=4, shift=0, mask=4294967295, attrs=...) at memory.c:439
      #5  0x0000561ad321bd70 in access_with_adjusted_size (addr=308, value=0x7ffe05c1db88, size=1, access_size_min=4, access_size_max=4, access_fn=0x561ad321b858 <memory_region_read_accessor>, mr=0x7f692babf620, attrs=...) at memory.c:569
      #6  0x0000561ad321e9d5 in memory_region_dispatch_read1 (mr=0x7f692babf620, addr=308, pval=0x7ffe05c1db88, size=1, attrs=...) at memory.c:1420
      #7  0x0000561ad321ea9d in memory_region_dispatch_read (mr=0x7f692babf620, addr=308, pval=0x7ffe05c1db88, size=1, attrs=...) at memory.c:1447
      #8  0x0000561ad31bd742 in flatview_read_continue (fv=0x561ad69c04f0, addr=4249485620, attrs=..., buf=0x7ffe05c1dcf0 "\020\335\301\005\376\177", len=1, addr1=308, l=1, mr=0x7f692babf620) at exec.c:3385
      #9  0x0000561ad31bd895 in flatview_read (fv=0x561ad69c04f0, addr=4249485620, attrs=..., buf=0x7ffe05c1dcf0 "\020\335\301\005\376\177", len=1) at exec.c:3423
      #10 0x0000561ad31bd90b in address_space_read_full (as=0x561ad5bb3020, addr=4249485620, attrs=..., buf=0x7ffe05c1dcf0 "\020\335\301\005\376\177", len=1) at exec.c:3436
      #11 0x0000561ad33b1c42 in address_space_read (len=1, buf=0x7ffe05c1dcf0 "\020\335\301\005\376\177", attrs=..., addr=4249485620, as=0x561ad5bb3020) at include/exec/memory.h:2131
      #12 0x0000561ad33b1c42 in memory_dump (mon=0x561ad59c4530, count=1, format=120, wsize=1, addr=4249485620, is_physical=1) at monitor/misc.c:723
      #13 0x0000561ad33b1fc1 in hmp_physical_memory_dump (mon=0x561ad59c4530, qdict=0x561ad6c6fd00) at monitor/misc.c:795
      #14 0x0000561ad37b4a9f in handle_hmp_command (mon=0x561ad59c4530, cmdline=0x561ad59d0f22 "/b 0x00000000fd4a0134") at monitor/hmp.c:1082
    
    Fix by checking the FIFO is not empty before popping from it.
    
    The datasheet is not clear about the reset value of this register,
    we choose to return '0'.
    
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-id: 20190709113715.7761-4-philmd@redhat.com
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit a09ef50)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    philmd authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    21e5c69 View commit details
    Browse the repository at this point in the history
  26. hw/ssi/mss-spi: Avoid crash when reading empty RX FIFO

    Reading the RX_DATA register when the RX_FIFO is empty triggers
    an abort. This can be easily reproduced:
    
      $ qemu-system-arm -M emcraft-sf2 -monitor stdio -S
      QEMU 4.0.50 monitor - type 'help' for more information
      (qemu) x 0x40001010
      Aborted (core dumped)
    
      (gdb) bt
      #1  0x00007f035874f895 in abort () at /lib64/libc.so.6
      #2  0x00005628686591ff in fifo8_pop (fifo=0x56286a9a4c68) at util/fifo8.c:66
      #3  0x00005628683e0b8e in fifo32_pop (fifo=0x56286a9a4c68) at include/qemu/fifo32.h:137
      #4  0x00005628683e0efb in spi_read (opaque=0x56286a9a4850, addr=4, size=4) at hw/ssi/mss-spi.c:168
      #5  0x0000562867f96801 in memory_region_read_accessor (mr=0x56286a9a4b60, addr=16, value=0x7ffeecb0c5c8, size=4, shift=0, mask=4294967295, attrs=...) at memory.c:439
      #6  0x0000562867f96cdb in access_with_adjusted_size (addr=16, value=0x7ffeecb0c5c8, size=4, access_size_min=1, access_size_max=4, access_fn=0x562867f967c3 <memory_region_read_accessor>, mr=0x56286a9a4b60, attrs=...) at memory.c:569
      #7  0x0000562867f99940 in memory_region_dispatch_read1 (mr=0x56286a9a4b60, addr=16, pval=0x7ffeecb0c5c8, size=4, attrs=...) at memory.c:1420
      #8  0x0000562867f99a08 in memory_region_dispatch_read (mr=0x56286a9a4b60, addr=16, pval=0x7ffeecb0c5c8, size=4, attrs=...) at memory.c:1447
      #9  0x0000562867f38721 in flatview_read_continue (fv=0x56286aec6360, addr=1073745936, attrs=..., buf=0x7ffeecb0c7c0 "\340ǰ\354\376\177", len=4, addr1=16, l=4, mr=0x56286a9a4b60) at exec.c:3385
      #10 0x0000562867f38874 in flatview_read (fv=0x56286aec6360, addr=1073745936, attrs=..., buf=0x7ffeecb0c7c0 "\340ǰ\354\376\177", len=4) at exec.c:3423
      #11 0x0000562867f388ea in address_space_read_full (as=0x56286aa3e890, addr=1073745936, attrs=..., buf=0x7ffeecb0c7c0 "\340ǰ\354\376\177", len=4) at exec.c:3436
      #12 0x0000562867f389c5 in address_space_rw (as=0x56286aa3e890, addr=1073745936, attrs=..., buf=0x7ffeecb0c7c0 "\340ǰ\354\376\177", len=4, is_write=false) at exec.c:3466
      #13 0x0000562867f3bdd7 in cpu_memory_rw_debug (cpu=0x56286aa19d00, addr=1073745936, buf=0x7ffeecb0c7c0 "\340ǰ\354\376\177", len=4, is_write=0) at exec.c:3976
      #14 0x000056286811ed51 in memory_dump (mon=0x56286a8c32d0, count=1, format=120, wsize=4, addr=1073745936, is_physical=0) at monitor/misc.c:730
      #15 0x000056286811eff1 in hmp_memory_dump (mon=0x56286a8c32d0, qdict=0x56286b15c400) at monitor/misc.c:785
      #16 0x00005628684740ee in handle_hmp_command (mon=0x56286a8c32d0, cmdline=0x56286a8caeb2 "0x40001010") at monitor/hmp.c:1082
    
    From the datasheet "Actel SmartFusion Microcontroller Subsystem
    User's Guide" Rev.1, Table 13-3 "SPI Register Summary", this
    register has a reset value of 0.
    
    Check the FIFO is not empty before accessing it, else log an
    error message.
    
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-id: 20190709113715.7761-3-philmd@redhat.com
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit c0bccee)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    philmd authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    e2ec206 View commit details
    Browse the repository at this point in the history
  27. hw/ssi/xilinx_spips: Avoid out-of-bound access to lqspi_buf[]

    Both lqspi_read() and lqspi_load_cache() expect a 32-bit
    aligned address.
    
    >From UG1085 datasheet [*] chapter on 'Quad-SPI Controller':
    
      Transfer Size Limitations
    
        Because of the 32-bit wide TX, RX, and generic FIFO, all
        APB/AXI transfers must be an integer multiple of 4-bytes.
        Shorter transfers are not possible.
    
    Set MemoryRegionOps.impl values to force 32-bit accesses,
    this way we are sure we do not access the lqspi_buf[] array
    out of bound.
    
    [*] https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf
    
    Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
    Tested-by: Francisco Iglesias <frasse.iglesias@gmail.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 526668c)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    philmd authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    1f30e35 View commit details
    Browse the repository at this point in the history
  28. target/m68k: Fix a tcg_temp leak

    The function gen_get_ccr() returns a tcg_temp created with
    tcg_temp_new(). Free it with tcg_temp_free().
    
    Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20190310003428.11723-4-f4bug@amsat.org>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 44c64e9)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    philmd authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    19f55e7 View commit details
    Browse the repository at this point in the history
  29. virtio-balloon: free pbp more aggressively

    Previous patches switched to a temporary pbp but that does not go far
    enough: after device uses a buffer, guest is free to reuse it, so
    tracking the page and freeing it later is wrong.
    
    Free and reset the pbp after we push each element.
    
    Fixes: ed48c59 ("virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host page size")
    Cc: qemu-stable@nongnu.org #v4.0.0
    Cc: David Hildenbrand <david@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 1b47b37)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    mstsirkin authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    c6b77a6 View commit details
    Browse the repository at this point in the history
  30. virtio-balloon: don't track subpages for the PBP

    As ramblocks cannot get removed/readded while we are processing a bulk
    of inflation requests, there is no more need to track the page size
    in form of the number of subpages.
    
    Suggested-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20190725113638.4702-8-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 9a7ca8a)
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    davidhildenbrand authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    0965d55 View commit details
    Browse the repository at this point in the history
  31. virtio-balloon: Use temporary PBP only

    We still have multiple issues in the current code
    - The PBP is not freed during unrealize()
    - The PBP is not reset on device resets: After a reset, the PBP is stale.
    - We are not indicating VIRTIO_BALLOON_F_MUST_TELL_HOST, therefore
      guests (esp. legacy guests) will reuse pages without deflating,
      turning the PBP stale. Adding that would require compat handling.
    
    Instead, let's use the PBP only temporarily, when processing one bulk of
    inflation requests. This will keep guest_page_size > 4k working (with
    Linux guests). There is nothing to do for deflation requests anymore.
    The pbp is only used for a limited amount of time.
    
    Fixes: ed48c59 ("virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host page size")
    Cc: qemu-stable@nongnu.org #v4.0.0
    Suggested-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20190722134108.22151-7-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: David Gibson <david@gibson.dropbear.id.au>
    (cherry picked from commit a8cd64d)
    *drop context dependency on qemu_4_0_config_size changes
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    davidhildenbrand authored and mdroth committed Jul 30, 2019
    Copy the full SHA
    14d9028 View commit details
    Browse the repository at this point in the history
Older