• This patch makes the range checks for block requests more strict: It fixes a
    potential integer overflow and checks for negative offsets. Also, it adds the
    check for compressed writes.
    
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Kevin Wolf authored
     
    Browse Code »

  • this patch adds a buffer_alignment field to BlockDriverState and
    implements a qemu_blockalign function that uses that field to allocate a
    memory aligned buffer to be used by the block driver.
    buffer_alignment is initialized to 512 but each block driver can set
    a different value (at the moment none of them do).
    This patch modifies ide.c, block-qcow.c, block-qcow2.c and block.c to
    use qemu_blockalign instead of qemu_memalign.
    There is only one place left that still uses qemu_memalign to allocate
    buffers used by block drivers that is posix-aio-compat:handle_aiocb_rw
    because it is not possible to get the BlockDriverState from that
    function. However I think it is not important because posix-aio-compat
    already deals with driver specific code so it is supposed to know its
    own needs.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7229 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »






  • Added a backing_format field to BlockDriverState.
    Added bdrv_create2 and drv->bdrv_create2 to create an image with
    a known backing file format.
    Upon bdrv_open2 if backing format is known use it, instead of
    probing the (backing) image.
    
    Signed-off-by: Uri Lublin <uril@redhat.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6908 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »
  • Okay, I started looking into how to handle scsi-generic I/O in the
    new world order.
    
    I think the best is to use the SG_IO ioctl instead of the read/write
    interface as that allows us to support scsi passthrough on disk/cdrom
    devices, too.  See Hannes patch on the kvm list from August for an
    example.
    
    Now that we always do ioctls we don't need another abstraction than
    bdrv_ioctl for the synchronous requests for now, and for asynchronous
    requests I've added a aio_ioctl abstraction keeping it simple.
    
    Long-term we might want to move the ops to a higher-level abstraction
    and let the low-level code fill out the request header, but I'm lazy
    enough to leave that to the people trying to support scsi-passthrough
    on a non-Linux OS.
    
    Tested lightly by issuing various sg_ commands from sg3-utils in a guest
    to a host CDROM device.
    
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6895 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »
  • If a bounced vectored aio fails immediately (the inner aio submission
    returning NULL) then the bounce handler erronously returns an aio
    request which will never be completed (and which crashes when cancelled).
    
    Fix by detecting that the inner request has failed and propagating the
    error.
    
    Signed-off-by: Avi Kivity <avi@redhat.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6892 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »






  • Refactor the monitor API and prepare it for decoupled terminals:
    term_print functions are renamed to monitor_* and all monitor services
    gain a new parameter (mon) that will once refer to the monitor instance
    the output is supposed to appear on. However, the argument remains
    unused for now. All monitor command callbacks are also extended by a mon
    parameter so that command handlers are able to pass an appropriate
    reference to monitor output services.
    
    For the case that monitor outputs so far happen without clearly
    identifiable context, the global variable cur_mon is introduced that
    shall once provide a pointer either to the current active monitor (while
    processing commands) or to the default one. On the mid or long term,
    those use case will be obsoleted so that this variable can be removed
    again.
    
    Due to the broad usage of the monitor interface, this patch mostly deals
    with converting users of the monitor API. A few of them are already
    extended to pass 'mon' from the command handler further down to internal
    functions that invoke monitor_printf.
    
    At this chance, monitor-related prototypes are moved from console.h to
    a new monitor.h. The same is done for the readline API.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »
  • Currently, waiting for the user to type in some password blocks the
    whole VM because monitor_readline starts its own I/O loop. And this loop
    also screws up reading passwords from virtual console.
    
    Patch below fixes the shortcomings by using normal I/O processing also
    for waiting on a password. To keep to modal property for the monitor
    terminal, the command handler is temporarily replaced by a password
    handler and a callback infrastructure is established to process the
    result before switching back to command mode.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6710 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »
  • Reading the passwords for encrypted hard disks during early startup is
    broken (I guess for quiet a while now):
     - No monitor terminal is ready for input at this point
     - Forcing all mux'ed terminals into monitor mode can confuse other
       users of that channels
    
    To overcome these issues and to lay the ground for a clean decoupling of
    monitor terminals, this patch changes the initial password inquiry as
    follows:
     - Prevent autostart if there is some encrypted disk
     - Once the user tries to resume the VM, prompt for all missing
       passwords
     - Only resume if all passwords were accepted
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6707 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • If the backing file is encrypted, 'info block' currently does not report
    the disk as encrypted. Fix this by using the standard API to check disk
    encryption mode. Moreover, switch to a canonical output format.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6706 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • Introduce bdrv_get_encrypted_filename service to allow more informative
    password prompting.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6704 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • Make bdrv_iterate more useful by passing the BlockDriverState to the
    iterator instead of the device name.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6703 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • Make sure that we always delete temporary disk images on error, remove
    obsolete malloc error checks and return proper error codes.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6702 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »

  • Introduce a growable flag that's set by bdrv_file_open().  Block devices should
    never be growable, only files that are being used by block devices.
    
    I went through Fabrice's early comments about the patch that was first applied.
    While I disagree with that patch, I also disagree with Fabrice's suggestion.
    
    There's no good reason to do the checks in the block drivers themselves.  It
    just increases the possibility that this bug could show up again.  Since we're
    calling bdrv_getlength() to determine the length, we're giving the block drivers
    a chance to chime in and let us know what range is valid.
    
    Basically, this patch makes the BlockDriver API guarantee that all requests are
    within 0..bdrv_getlength() which to me seems like a Good Thing.
    
    What do others think?
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6677 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »
  • Signed-off-by: Alex Ivanov <void@aleksoft.net>
    Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6674 c046a42c-6fe2-441c-8c8c-71466251a162
    aurel32 authored
     
    Browse Code »