Revision 720db5deeb852b61e40007989c1390295ceece32 authored by Fam Zheng on 01 June 2018, 09:26:40 UTC, committed by Michael Roth on 21 June 2018, 01:45:04 UTC
We don't verify the request range against s->size in the I/O callbacks
except for raw_co_pwritev. This is inconsistent (especially for
raw_co_pwrite_zeroes and raw_co_pdiscard), so fix them, in the meanwhile
make the helper reusable by the coming new callbacks.

Note that in most cases the block layer already verifies the request
byte range against our reported image length, before invoking the driver
callbacks.  The exception is during image creating, after
blk_set_allow_write_beyond_eof(blk, true) is called. But in that case,
the requests are not directly from the user or guest. So there is no
visible behavior change in adding the check code.

The int64_t -> uint64_t inconsistency, as shown by the type casting, is
pre-existing due to the interface.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 20180601092648.24614-3-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 384455385248762e74a080978f18f0c8f74757fe)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
1 parent 979e7ea
Raw File
create_config
#!/bin/sh

echo "/* Automatically generated by create_config - do not modify */"

while read line; do

case $line in
 VERSION=*) # configuration
    version=${line#*=}
    major=$(echo "$version" | cut -d. -f1)
    minor=$(echo "$version" | cut -d. -f2)
    micro=$(echo "$version" | cut -d. -f3)
    echo "#define QEMU_VERSION \"$version\""
    echo "#define QEMU_VERSION_MAJOR $major"
    echo "#define QEMU_VERSION_MINOR $minor"
    echo "#define QEMU_VERSION_MICRO $micro"
    ;;
 qemu_*dir=* | qemu_*path=*) # qemu-specific directory configuration
    name=${line%=*}
    value=${line#*=}
    define_name=$(echo $name | LC_ALL=C tr '[a-z]' '[A-Z]')
    eval "define_value=\"$value\""
    echo "#define CONFIG_$define_name \"$define_value\""
    # save for the next definitions
    eval "$name=\$define_value"
    ;;
 prefix=*)
    # save for the next definitions
    prefix=${line#*=}
    ;;
 IASL=*) # iasl executable
    value=${line#*=}
    echo "#define CONFIG_IASL $value"
    ;;
 CONFIG_AUDIO_DRIVERS=*)
    drivers=${line#*=}
    echo "#define CONFIG_AUDIO_DRIVERS \\"
    for drv in $drivers; do
      echo "    &${drv}_audio_driver,\\"
    done
    echo ""
    ;;
 CONFIG_BDRV_RW_WHITELIST=*)
    echo "#define CONFIG_BDRV_RW_WHITELIST\\"
    for drv in ${line#*=}; do
      echo "    \"${drv}\",\\"
    done
    echo "    NULL"
    ;;
 CONFIG_BDRV_RO_WHITELIST=*)
    echo "#define CONFIG_BDRV_RO_WHITELIST\\"
    for drv in ${line#*=}; do
      echo "    \"${drv}\",\\"
    done
    echo "    NULL"
    ;;
 CONFIG_*='$(CONFIG_SOFTMMU)'|CONFIG_*=y) # configuration
    name=${line%=*}
    echo "#define $name 1"
    ;;
 CONFIG_*=*) # configuration
    name=${line%=*}
    value=${line#*=}
    echo "#define $name $value"
    ;;
 HAVE_*=y) # configuration
    name=${line%=*}
    echo "#define $name 1"
    ;;
 HAVE_*=*) # configuration
    name=${line%=*}
    value=${line#*=}
    echo "#define $name $value"
    ;;
 ARCH=*) # configuration
    arch=${line#*=}
    arch_name=$(echo $arch | LC_ALL=C tr '[a-z]' '[A-Z]')
    echo "#define HOST_$arch_name 1"
    ;;
 HOST_USB=*)
    # do nothing
    ;;
 HOST_CC=*)
    # do nothing
    ;;
 HOST_*=y) # configuration
    name=${line%=*}
    echo "#define $name 1"
    ;;
 HOST_*=*) # configuration
    name=${line%=*}
    value=${line#*=}
    echo "#define $name $value"
    ;;
 TARGET_BASE_ARCH=*) # configuration
    target_base_arch=${line#*=}
    base_arch_name=$(echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]')
    echo "#define TARGET_$base_arch_name 1"
    ;;
 TARGET_XML_FILES=*)
    # do nothing
    ;;
 TARGET_ABI_DIR=*)
    # do nothing
    ;;
 TARGET_NAME=*)
    target_name=${line#*=}
    echo "#define TARGET_NAME \"$target_name\""
    ;;
 TARGET_DIRS=*)
    # do nothing
    ;;
 TARGET_*=y) # configuration
    name=${line%=*}
    echo "#define $name 1"
    ;;
 TARGET_*=*) # configuration
    name=${line%=*}
    value=${line#*=}
    echo "#define $name $value"
    ;;
 DSOSUF=*)
    echo "#define HOST_DSOSUF \"${line#*=}\""
    ;;
esac

done # read
back to top