* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2015-08-10 11:05 Mike Frysinger
0 siblings, 0 replies; 66+ messages in thread
From: Mike Frysinger @ 2015-08-10 11:05 UTC (permalink / raw
To: gentoo-commits
commit: 03aa7f1902aba68926f08b4e85f95ee9f474910a
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 10 11:04:51 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 11:05:14 2015 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03aa7f19
qemu: fix from upstream for virtio-serial security issue #557206
.../qemu/files/qemu-2.3.0-virtio-serial.patch | 34 ++
app-emulation/qemu/qemu-2.3.0-r6.ebuild | 616 +++++++++++++++++++++
2 files changed, 650 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch b/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch
new file mode 100644
index 0000000..d84797f
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch
@@ -0,0 +1,34 @@
+https://bugs.gentoo.org/557206
+
+From 7882080388be5088e72c425b02223c02e6cb4295 Mon Sep 17 00:00:00 2001
+From: "Michael S. Tsirkin" <mst@redhat.com>
+Date: Thu, 23 Jul 2015 17:52:02 +0300
+Subject: [PATCH] virtio-serial: fix ANY_LAYOUT
+
+Don't assume a specific layout for control messages.
+Required by virtio 1.
+
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Reviewed-by: Amit Shah <amit.shah@redhat.com>
+Reviewed-by: Jason Wang <jasowang@redhat.com>
+---
+ hw/char/virtio-serial-bus.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
+index 78c73e5..929e49c 100644
+--- a/hw/char/virtio-serial-bus.c
++++ b/hw/char/virtio-serial-bus.c
+@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
+ return 0;
+ }
+
+- memcpy(elem.in_sg[0].iov_base, buf, len);
++ /* TODO: detect a buffer that's too short, set NEEDS_RESET */
++ iov_from_buf(elem.in_sg, elem.in_num, 0, buf, len);
+
+ virtqueue_push(vq, &elem, len);
+ virtio_notify(VIRTIO_DEVICE(vser), vq);
+--
+2.4.4
+
diff --git a/app-emulation/qemu/qemu-2.3.0-r6.ebuild b/app-emulation/qemu/qemu-2.3.0-r6.ebuild
new file mode 100644
index 0000000..f558062
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.3.0-r6.ebuild
@@ -0,0 +1,616 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo pax-utils
+
+BACKPORTS=
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
+ ${BACKPORTS:+
+ http://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
+ KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
+gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
+static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
+virtfs +vnc xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Require at least one softmmu or user target.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
+ ${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
+ jpeg? ( virtual/jpeg:=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? ( sys-libs/ncurses[static-libs(+)] )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ tls? ( net-libs/gnutls[static-libs(+)] )
+ usb? ( >=dev-libs/libusb-1.0.18[static-libs(+)] )
+ uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.7.5
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ accessibility? ( app-accessibility/brltty )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ gtk? (
+ gtk2? ( x11-libs/gtk+:2 )
+ !gtk2? ( x11-libs/gtk+:3 )
+ x11-libs/vte:2.90
+ )
+ iscsi? ( net-libs/libiscsi )
+ opengl? ( virtual/opengl )
+ pulseaudio? ( media-sound/pulseaudio )
+ python? ( ${PYTHON_DEPS} )
+ sdl? ( media-libs/libsdl[X] )
+ smartcard? ( dev-libs/nss !app-emulation/libcacard )
+ spice? ( >=app-emulation/spice-protocol-0.12.3 )
+ systemtap? ( dev-util/systemtap )
+ usbredir? ( >=sys-apps/usbredir-0.6 )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'\n
+For Intel CPUs the module is called 'kvm-intel'\n
+Please review /etc/conf.d/modules for how to load these\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+src_prepare() {
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ # Cheap hack to disable gettext .mo generation.
+ use nls || rm -f po/*.po
+
+ epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
+ epatch "${FILESDIR}"/${P}-CVE-2015-3456.patch #549404
+ epatch "${FILESDIR}"/${P}-CVE-2015-3209.patch #551752
+ epatch "${FILESDIR}"/${P}-CVE-2015-5158.patch #555680
+ epatch "${FILESDIR}"/${P}-CVE-2015-3214.patch #556052
+ epatch "${FILESDIR}"/${P}-CVE-2015-5154-1.patch #556050 / #555532
+ epatch "${FILESDIR}"/${P}-CVE-2015-5154-2.patch #556050 / #555532
+ epatch "${FILESDIR}"/${P}-CVE-2015-5154-3.patch #556050 / #555532
+ epatch "${FILESDIR}"/${P}-CVE-2015-5165-1.patch #556304
+ epatch "${FILESDIR}"/${P}-CVE-2015-5165-2.patch #556304
+ epatch "${FILESDIR}"/${P}-CVE-2015-5165-3.patch #556304
+ epatch "${FILESDIR}"/${P}-CVE-2015-5165-4.patch #556304
+ epatch "${FILESDIR}"/${P}-CVE-2015-5165-5.patch #556304
+ epatch "${FILESDIR}"/${P}-CVE-2015-5165-6.patch #556304
+ epatch "${FILESDIR}"/${P}-CVE-2015-5165-7.patch #556304
+ epatch "${FILESDIR}"/${P}-CVE-2015-5166.patch #556304
+ epatch "${FILESDIR}"/${P}-virtio-serial.patch #557206
+ [[ -n ${BACKPORTS} ]] && \
+ EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
+ epatch
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir=$2
+ local static_flag="static-${buildtype}"
+
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard smartcard-nss)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu tls quorum)
+ $(conf_softmmu tls vnc-tls)
+ $(conf_softmmu tls vnc-ws)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu uuid)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --target-list="${user_targets}"
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --target-list="${softmmu_targets}"
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ ;;
+ esac
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ einfo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ [[ -n ${softmmu_targets} ]] && \
+ einfo "Building the following softmmu targets: ${softmmu_targets}"
+
+ [[ -n ${user_targets} ]] && \
+ einfo "Building the following user targets: ${user_targets}"
+
+ if [[ -n ${softmmu_targets} ]]; then
+ mkdir "${S}/softmmu-build"
+ qemu_src_configure "softmmu" "${S}/softmmu-build"
+ fi
+
+ if [[ -n ${user_targets} ]]; then
+ mkdir "${S}/user-build"
+ qemu_src_configure "user" "${S}/user-build"
+ fi
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/kvm_stat"
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_dorules "${FILESDIR}"/65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp/*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
+ ewarn "save states has been removed starting with the 1.6.2 release"
+ ewarn
+ ewarn "It is recommended that you migrate any VMs that may be running"
+ ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
+ ewarn "any saved states with a newer qemu."
+ ewarn
+ ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
+
+ if use x86 || use amd64; then
+ ewarn
+ ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
+ ewarn "installed. In order to use kvm acceleration, pass the flag"
+ ewarn "-enable-kvm when running your system target."
+ fi
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+ if use virtfs && [ -n "${softmmu_targets}" ]; then
+ local virtfs_caps="cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_setgid,cap_mknod,cap_setuid"
+ fcaps ${virtfs_caps} /usr/bin/virtfs-proxy-helper
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version sys-firmware/seabios[binary]; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2015-09-07 5:50 Mike Frysinger
0 siblings, 0 replies; 66+ messages in thread
From: Mike Frysinger @ 2015-09-07 5:50 UTC (permalink / raw
To: gentoo-commits
commit: fec667228a95981586716b7d25004c4d706943e2
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 7 05:47:32 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 7 05:49:18 2015 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fec66722
app-emulation/qemu: various fixes/updates
Sync in the updates from the 9999 ebuild:
- updated seabios pin
- add new targets
- add sanity checks for targets
Add fix from upstream for blockcommit crashes #558396.
Add fix from upstream for CVE-2015-5225 #558416.
Add fix posted upstream (but not yet merged) for e1000 infinite loop #559656.
.../qemu/files/qemu-2.4.0-CVE-2015-5225.patch | 86 ++++++++++++++
.../qemu/files/qemu-2.4.0-block-mirror-crash.patch | 124 +++++++++++++++++++++
.../qemu/files/qemu-2.4.0-e1000-loop.patch | 39 +++++++
.../{qemu-2.4.0.ebuild => qemu-2.4.0-r1.ebuild} | 31 +++++-
4 files changed, 277 insertions(+), 3 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch
new file mode 100644
index 0000000..de7090d
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch
@@ -0,0 +1,86 @@
+https://bugs.gentoo.org/558416
+
+fix from upstream git
+
+From eb8934b0418b3b1d125edddc4fc334a54334a49b Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Mon, 17 Aug 2015 19:56:53 +0200
+Subject: [PATCH] vnc: fix memory corruption (CVE-2015-5225)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The _cmp_bytes variable added by commit "bea60dd ui/vnc: fix potential
+memory corruption issues" can become negative. Result is (possibly
+exploitable) memory corruption. Reason for that is it uses the stride
+instead of bytes per scanline to apply limits.
+
+For the server surface is is actually fine. vnc creates that itself,
+there is never any padding and thus scanline length always equals stride.
+
+For the guest surface scanline length and stride are typically identical
+too, but it doesn't has to be that way. So add and use a new variable
+(guest_ll) for the guest scanline length. Also rename min_stride to
+line_bytes to make more clear what it actually is. Finally sprinkle
+in an assert() to make sure we never use a negative _cmp_bytes again.
+
+Reported-by: 范祚至(库特) <zuozhi.fzz@alibaba-inc.com>
+Reviewed-by: P J P <ppandit@redhat.com>
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+---
+ ui/vnc.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/ui/vnc.c b/ui/vnc.c
+index e26973a..caf82f5 100644
+--- a/ui/vnc.c
++++ b/ui/vnc.c
+@@ -2872,7 +2872,7 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
+ pixman_image_get_width(vd->server));
+ int height = MIN(pixman_image_get_height(vd->guest.fb),
+ pixman_image_get_height(vd->server));
+- int cmp_bytes, server_stride, min_stride, guest_stride, y = 0;
++ int cmp_bytes, server_stride, line_bytes, guest_ll, guest_stride, y = 0;
+ uint8_t *guest_row0 = NULL, *server_row0;
+ VncState *vs;
+ int has_dirty = 0;
+@@ -2891,17 +2891,21 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
+ * Update server dirty map.
+ */
+ server_row0 = (uint8_t *)pixman_image_get_data(vd->server);
+- server_stride = guest_stride = pixman_image_get_stride(vd->server);
++ server_stride = guest_stride = guest_ll =
++ pixman_image_get_stride(vd->server);
+ cmp_bytes = MIN(VNC_DIRTY_PIXELS_PER_BIT * VNC_SERVER_FB_BYTES,
+ server_stride);
+ if (vd->guest.format != VNC_SERVER_FB_FORMAT) {
+ int width = pixman_image_get_width(vd->server);
+ tmpbuf = qemu_pixman_linebuf_create(VNC_SERVER_FB_FORMAT, width);
+ } else {
++ int guest_bpp =
++ PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
+ guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
+ guest_stride = pixman_image_get_stride(vd->guest.fb);
++ guest_ll = pixman_image_get_width(vd->guest.fb) * ((guest_bpp + 7) / 8);
+ }
+- min_stride = MIN(server_stride, guest_stride);
++ line_bytes = MIN(server_stride, guest_ll);
+
+ for (;;) {
+ int x;
+@@ -2932,9 +2936,10 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
+ if (!test_and_clear_bit(x, vd->guest.dirty[y])) {
+ continue;
+ }
+- if ((x + 1) * cmp_bytes > min_stride) {
+- _cmp_bytes = min_stride - x * cmp_bytes;
++ if ((x + 1) * cmp_bytes > line_bytes) {
++ _cmp_bytes = line_bytes - x * cmp_bytes;
+ }
++ assert(_cmp_bytes >= 0);
+ if (memcmp(server_ptr, guest_ptr, _cmp_bytes) == 0) {
+ continue;
+ }
+--
+2.5.0
+
diff --git a/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch b/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch
new file mode 100644
index 0000000..ad4051e
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch
@@ -0,0 +1,124 @@
+https://bugs.gentoo.org/558396
+
+fix from upstream git
+
+From e424aff5f307227b1c2512bbb8ece891bb895cef Mon Sep 17 00:00:00 2001
+From: Kevin Wolf <kwolf@redhat.com>
+Date: Thu, 13 Aug 2015 10:41:50 +0200
+Subject: [PATCH] mirror: Fix coroutine reentrance
+
+This fixes a regression introduced by commit dcfb3beb ("mirror: Do zero
+write on target if sectors not allocated"), which was reported to cause
+aborts with the message "Co-routine re-entered recursively".
+
+The cause for this bug is the following code in mirror_iteration_done():
+
+ if (s->common.busy) {
+ qemu_coroutine_enter(s->common.co, NULL);
+ }
+
+This has always been ugly because - unlike most places that reenter - it
+doesn't have a specific yield that it pairs with, but is more
+uncontrolled. What we really mean here is "reenter the coroutine if
+it's in one of the four explicit yields in mirror.c".
+
+This used to be equivalent with s->common.busy because neither
+mirror_run() nor mirror_iteration() call any function that could yield.
+However since commit dcfb3beb this doesn't hold true any more:
+bdrv_get_block_status_above() can yield.
+
+So what happens is that bdrv_get_block_status_above() wants to take a
+lock that is already held, so it adds itself to the queue of waiting
+coroutines and yields. Instead of being woken up by the unlock function,
+however, it gets woken up by mirror_iteration_done(), which is obviously
+wrong.
+
+In most cases the code actually happens to cope fairly well with such
+cases, but in this specific case, the unlock must already have scheduled
+the coroutine for wakeup when mirror_iteration_done() reentered it. And
+then the coroutine happened to process the scheduled restarts and tried
+to reenter itself recursively.
+
+This patch fixes the problem by pairing the reenter in
+mirror_iteration_done() with specific yields instead of abusing
+s->common.busy.
+
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Kevin Wolf <kwolf@redhat.com>
+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
+Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
+Reviewed-by: Jeff Cody <jcody@redhat.com>
+Message-id: 1439455310-11263-1-git-send-email-kwolf@redhat.com
+Signed-off-by: Jeff Cody <jcody@redhat.com>
+---
+ block/mirror.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/block/mirror.c b/block/mirror.c
+index 0841964..9474443 100644
+--- a/block/mirror.c
++++ b/block/mirror.c
+@@ -60,6 +60,7 @@ typedef struct MirrorBlockJob {
+ int sectors_in_flight;
+ int ret;
+ bool unmap;
++ bool waiting_for_io;
+ } MirrorBlockJob;
+
+ typedef struct MirrorOp {
+@@ -114,11 +115,7 @@ static void mirror_iteration_done(MirrorOp *op, int ret)
+ qemu_iovec_destroy(&op->qiov);
+ g_slice_free(MirrorOp, op);
+
+- /* Enter coroutine when it is not sleeping. The coroutine sleeps to
+- * rate-limit itself. The coroutine will eventually resume since there is
+- * a sleep timeout so don't wake it early.
+- */
+- if (s->common.busy) {
++ if (s->waiting_for_io) {
+ qemu_coroutine_enter(s->common.co, NULL);
+ }
+ }
+@@ -203,7 +200,9 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
+ /* Wait for I/O to this cluster (from a previous iteration) to be done. */
+ while (test_bit(next_chunk, s->in_flight_bitmap)) {
+ trace_mirror_yield_in_flight(s, sector_num, s->in_flight);
++ s->waiting_for_io = true;
+ qemu_coroutine_yield();
++ s->waiting_for_io = false;
+ }
+
+ do {
+@@ -239,7 +238,9 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
+ */
+ while (nb_chunks == 0 && s->buf_free_count < added_chunks) {
+ trace_mirror_yield_buf_busy(s, nb_chunks, s->in_flight);
++ s->waiting_for_io = true;
+ qemu_coroutine_yield();
++ s->waiting_for_io = false;
+ }
+ if (s->buf_free_count < nb_chunks + added_chunks) {
+ trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight);
+@@ -337,7 +338,9 @@ static void mirror_free_init(MirrorBlockJob *s)
+ static void mirror_drain(MirrorBlockJob *s)
+ {
+ while (s->in_flight > 0) {
++ s->waiting_for_io = true;
+ qemu_coroutine_yield();
++ s->waiting_for_io = false;
+ }
+ }
+
+@@ -510,7 +513,9 @@ static void coroutine_fn mirror_run(void *opaque)
+ if (s->in_flight == MAX_IN_FLIGHT || s->buf_free_count == 0 ||
+ (cnt == 0 && s->in_flight > 0)) {
+ trace_mirror_yield(s, s->in_flight, s->buf_free_count, cnt);
++ s->waiting_for_io = true;
+ qemu_coroutine_yield();
++ s->waiting_for_io = false;
+ continue;
+ } else if (cnt != 0) {
+ delay_ns = mirror_iteration(s);
+--
+2.5.0
+
diff --git a/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch b/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch
new file mode 100644
index 0000000..f2538a7
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch
@@ -0,0 +1,39 @@
+https://bugs.gentoo.org/559656
+
+https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01199.html
+
+From: Stefan Hajnoczi <stefanha@redhat.com>
+Subject: [PATCH] e1000: Avoid infinite loop in processing transmit descriptor
+Newsgroups: gmane.comp.emulators.qemu
+Date: 2015-09-04 16:21:06 GMT (2 days, 12 hours and 51 minutes ago)
+From: P J P <pjp@fedoraproject.org>
+
+While processing transmit descriptors, it could lead to an infinite
+loop if 'bytes' was to become zero; Add a check to avoid it.
+
+[The guest can force 'bytes' to 0 by setting the hdr_len and mss
+descriptor fields to 0.
+--Stefan]
+
+Signed-off-by: P J P <pjp@fedoraproject.org>
+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
+---
+ hw/net/e1000.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/hw/net/e1000.c b/hw/net/e1000.c
+index 5c6bcd0..09c9e9d 100644
+--- a/hw/net/e1000.c
++++ b/hw/net/e1000.c
+@@ -740,7 +740,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
+ memmove(tp->data, tp->header, tp->hdr_len);
+ tp->size = tp->hdr_len;
+ }
+- } while (split_size -= bytes);
++ split_size -= bytes;
++ } while (bytes && split_size);
+ } else if (!tp->tse && tp->cptse) {
+ // context descriptor TSE is not set, while data descriptor TSE is set
+ DBGOUT(TXERR, "TCP segmentation error\n");
+--
+2.4.3
diff --git a/app-emulation/qemu/qemu-2.4.0.ebuild b/app-emulation/qemu/qemu-2.4.0-r1.ebuild
similarity index 95%
rename from app-emulation/qemu/qemu-2.4.0.ebuild
rename to app-emulation/qemu/qemu-2.4.0-r1.ebuild
index 0dfa27f..13c15ad 100644
--- a/app-emulation/qemu/qemu-2.4.0.ebuild
+++ b/app-emulation/qemu/qemu-2.4.0-r1.ebuild
@@ -39,8 +39,8 @@ virtfs +vnc vte xattr xen xfs"
COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
@@ -134,7 +134,7 @@ USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
X86_FIRMWARE_DEPEND="
>=sys-firmware/ipxe-1.0.0_p20130624
pin-upstream-blobs? (
- ~sys-firmware/seabios-1.7.5
+ ~sys-firmware/seabios-1.8.2
~sys-firmware/sgabios-0.1_pre8
~sys-firmware/vgabios-0.7a
)
@@ -268,7 +268,29 @@ pkg_setup() {
enewgroup kvm 78
}
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
# Alter target makefiles to accept CFLAGS set via flag-o
sed -i -r \
-e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
@@ -278,6 +300,9 @@ src_prepare() {
use nls || rm -f po/*.po
epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
+ epatch "${FILESDIR}"/${P}-block-mirror-crash.patch #558396
+ epatch "${FILESDIR}"/${P}-CVE-2015-5225.patch #558416
+ epatch "${FILESDIR}"/${PN}-2.4.0-e1000-loop.patch #559656
[[ -n ${BACKPORTS} ]] && \
EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
epatch
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2015-10-10 0:59 Mike Frysinger
0 siblings, 0 replies; 66+ messages in thread
From: Mike Frysinger @ 2015-10-10 0:59 UTC (permalink / raw
To: gentoo-commits
commit: 4703b062bb7d0c6ebdf91827a3396435e6dea74a
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 00:57:32 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 00:57:58 2015 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4703b062
app-emulation/qemu: version bump to 2.4.0.1 #562594
This also includes security fixes for #560760 #560550 #560422.
app-emulation/qemu/Manifest | 1 +
.../qemu/files/qemu-2.4.0-CVE-2015-6855.patch | 146 +++++
.../qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch | 58 ++
.../qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch | 54 ++
.../qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch | 47 ++
app-emulation/qemu/qemu-2.4.0.1.ebuild | 643 +++++++++++++++++++++
6 files changed, 949 insertions(+)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index dd9b756..fe4fd4c 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,3 +1,4 @@
DIST qemu-2.3.0.tar.bz2 24683085 SHA256 b6bab7f763d5be73e7cb5ee7d4c8365b7a8df2972c52fa5ded18893bd8281588 SHA512 7a40d213c5696b27784abd2a3119e49d42c38c923be431826c73a8f14c19074435d7f1a652686c53baf08e81f5a3005b2ddc92d67c32f6a2b19659ab627e9eaa WHIRLPOOL 9dad6e342027c3be512b4e0b40e810e0a6f1dc84a16847aa5aac74d97f7a347e60d42e770335a090f83e90a1614294f86552a84edc1faafc7093d3e32602f5de
DIST qemu-2.3.1.tar.bz2 24692020 SHA256 661d029809421cae06b4b1bc74ac0e560cb4ed47c9523c676ff277fa26dca15f SHA512 309e6df7dcc0a064d1a17c7dac2f60398700dfa8c6b60b66e4202966248097cbc49af75aa97725bc34773151be6fd75836810e9f0741ba65cdc208414fa78f6b WHIRLPOOL 26750ee00513daa99cdcd585c4b8407b8258a9c3559ae6335266d7754cb6679e7c10c56f8d12ae0ef2b5cd5d6a9a6a536213f8e86e81ced37e46205c796a773e
+DIST qemu-2.4.0.1.tar.bz2 25068555 SHA256 ecfe8b88037e41e817d72c460c56c6a0b573d540d6ba38b162d0de4fd22d1bdb SHA512 08eabe92fa9096386ef00f8e9d99eeec1508d15e5a98431e043a729cbaca2d96d6e3afc612e7c4a0fe5a6bba80006276185f1066b4c73105b2ea24b7e9133b84 WHIRLPOOL 1daaec23d6ada6af8bf4902e590fb96375e7149d2f53ff6bf6d8fb39722c182a2d2efcc0d40bee673a8316f621983c512daa54202bb4e632b3a4b09f0268cd09
DIST qemu-2.4.0.tar.bz2 25070979 SHA256 72b0b991bbcc540663a019e1e8c4f714053b691dda32c9b9ee80b25f367e6620 SHA512 8740e0fb2c654ed897dff4649f1f83d14d57cfa9cbde723899f115982f93253ce9a2bddd60aab379d241027d2044137770efe4c0b3c83d5b20f3a2a06f05a5dc WHIRLPOOL 8c6cfae096624e01f0d5daeb86aa2dccbeaa86d2aeab626cf55cf20b7edace82d0b0f3a1d85eeb2dc1fd53abaaa9dccf8f0d7ddc657a1f5ffd72fd68301648f1
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch
new file mode 100644
index 0000000..69dd66a
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch
@@ -0,0 +1,146 @@
+https://bugs.gentoo.org/560422
+
+From d9033e1d3aa666c5071580617a57bd853c5d794a Mon Sep 17 00:00:00 2001
+From: John Snow <jsnow@redhat.com>
+Date: Thu, 17 Sep 2015 14:17:05 -0400
+Subject: [PATCH] ide: fix ATAPI command permissions
+
+We're a little too lenient with what we'll let an ATAPI drive handle.
+Clamp down on the IDE command execution table to remove CD_OK permissions
+from commands that are not and have never been ATAPI commands.
+
+For ATAPI command validity, please see:
+- ATA4 Section 6.5 ("PACKET Command feature set")
+- ATA8/ACS Section 4.3 ("The PACKET feature set")
+- ACS3 Section 4.3 ("The PACKET feature set")
+
+ACS3 has a historical command validity table in Table B.4
+("Historical Command Assignments") that can be referenced to find when
+a command was introduced, deprecated, obsoleted, etc.
+
+The only reference for ATAPI command validity is by checking that
+version's PACKET feature set section.
+
+ATAPI was introduced by T13 into ATA4, all commands retired prior to ATA4
+therefore are assumed to have never been ATAPI commands.
+
+Mandatory commands, as listed in ATA8-ACS3, are:
+
+- DEVICE RESET
+- EXECUTE DEVICE DIAGNOSTIC
+- IDENTIFY DEVICE
+- IDENTIFY PACKET DEVICE
+- NOP
+- PACKET
+- READ SECTOR(S)
+- SET FEATURES
+
+Optional commands as listed in ATA8-ACS3, are:
+
+- FLUSH CACHE
+- READ LOG DMA EXT
+- READ LOG EXT
+- WRITE LOG DMA EXT
+- WRITE LOG EXT
+
+All other commands are illegal to send to an ATAPI device and should
+be rejected by the device.
+
+CD_OK removal justifications:
+
+0x06 WIN_DSM Defined in ACS2. Not valid for ATAPI.
+0x21 WIN_READ_ONCE Retired in ATA5. Not ATAPI in ATA4.
+0x94 WIN_STANDBYNOW2 Retired in ATA4. Did not coexist with ATAPI.
+0x95 WIN_IDLEIMMEDIATE2 Retired in ATA4. Did not coexist with ATAPI.
+0x96 WIN_STANDBY2 Retired in ATA4. Did not coexist with ATAPI.
+0x97 WIN_SETIDLE2 Retired in ATA4. Did not coexist with ATAPI.
+0x98 WIN_CHECKPOWERMODE2 Retired in ATA4. Did not coexist with ATAPI.
+0x99 WIN_SLEEPNOW2 Retired in ATA4. Did not coexist with ATAPI.
+0xE0 WIN_STANDBYNOW1 Not part of ATAPI in ATA4, ACS or ACS3.
+0xE1 WIN_IDLEIMMDIATE Not part of ATAPI in ATA4, ACS or ACS3.
+0xE2 WIN_STANDBY Not part of ATAPI in ATA4, ACS or ACS3.
+0xE3 WIN_SETIDLE1 Not part of ATAPI in ATA4, ACS or ACS3.
+0xE4 WIN_CHECKPOWERMODE1 Not part of ATAPI in ATA4, ACS or ACS3.
+0xE5 WIN_SLEEPNOW1 Not part of ATAPI in ATA4, ACS or ACS3.
+0xF8 WIN_READ_NATIVE_MAX Obsoleted in ACS3. Not ATAPI in ATA4 or ACS.
+
+This patch fixes a divide by zero fault that can be caused by sending
+the WIN_READ_NATIVE_MAX command to an ATAPI drive, which causes it to
+attempt to use zeroed CHS values to perform sector arithmetic.
+
+Reported-by: Qinghao Tang <luodalongde@gmail.com>
+Signed-off-by: John Snow <jsnow@redhat.com>
+Reviewed-by: Markus Armbruster <armbru@redhat.com>
+Message-id: 1441816082-21031-1-git-send-email-jsnow@redhat.com
+CC: qemu-stable@nongnu.org
+---
+ hw/ide/core.c | 30 +++++++++++++++---------------
+ 1 file changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/hw/ide/core.c b/hw/ide/core.c
+index 8ba04df..1cc6945 100644
+--- a/hw/ide/core.c
++++ b/hw/ide/core.c
+@@ -1746,11 +1746,11 @@ static const struct {
+ } ide_cmd_table[0x100] = {
+ /* NOP not implemented, mandatory for CD */
+ [CFA_REQ_EXT_ERROR_CODE] = { cmd_cfa_req_ext_error_code, CFA_OK },
+- [WIN_DSM] = { cmd_data_set_management, ALL_OK },
++ [WIN_DSM] = { cmd_data_set_management, HD_CFA_OK },
+ [WIN_DEVICE_RESET] = { cmd_device_reset, CD_OK },
+ [WIN_RECAL] = { cmd_nop, HD_CFA_OK | SET_DSC},
+ [WIN_READ] = { cmd_read_pio, ALL_OK },
+- [WIN_READ_ONCE] = { cmd_read_pio, ALL_OK },
++ [WIN_READ_ONCE] = { cmd_read_pio, HD_CFA_OK },
+ [WIN_READ_EXT] = { cmd_read_pio, HD_CFA_OK },
+ [WIN_READDMA_EXT] = { cmd_read_dma, HD_CFA_OK },
+ [WIN_READ_NATIVE_MAX_EXT] = { cmd_read_native_max, HD_CFA_OK | SET_DSC },
+@@ -1769,12 +1769,12 @@ static const struct {
+ [CFA_TRANSLATE_SECTOR] = { cmd_cfa_translate_sector, CFA_OK },
+ [WIN_DIAGNOSE] = { cmd_exec_dev_diagnostic, ALL_OK },
+ [WIN_SPECIFY] = { cmd_nop, HD_CFA_OK | SET_DSC },
+- [WIN_STANDBYNOW2] = { cmd_nop, ALL_OK },
+- [WIN_IDLEIMMEDIATE2] = { cmd_nop, ALL_OK },
+- [WIN_STANDBY2] = { cmd_nop, ALL_OK },
+- [WIN_SETIDLE2] = { cmd_nop, ALL_OK },
+- [WIN_CHECKPOWERMODE2] = { cmd_check_power_mode, ALL_OK | SET_DSC },
+- [WIN_SLEEPNOW2] = { cmd_nop, ALL_OK },
++ [WIN_STANDBYNOW2] = { cmd_nop, HD_CFA_OK },
++ [WIN_IDLEIMMEDIATE2] = { cmd_nop, HD_CFA_OK },
++ [WIN_STANDBY2] = { cmd_nop, HD_CFA_OK },
++ [WIN_SETIDLE2] = { cmd_nop, HD_CFA_OK },
++ [WIN_CHECKPOWERMODE2] = { cmd_check_power_mode, HD_CFA_OK | SET_DSC },
++ [WIN_SLEEPNOW2] = { cmd_nop, HD_CFA_OK },
+ [WIN_PACKETCMD] = { cmd_packet, CD_OK },
+ [WIN_PIDENTIFY] = { cmd_identify_packet, CD_OK },
+ [WIN_SMART] = { cmd_smart, HD_CFA_OK | SET_DSC },
+@@ -1788,19 +1788,19 @@ static const struct {
+ [WIN_WRITEDMA] = { cmd_write_dma, HD_CFA_OK },
+ [WIN_WRITEDMA_ONCE] = { cmd_write_dma, HD_CFA_OK },
+ [CFA_WRITE_MULTI_WO_ERASE] = { cmd_write_multiple, CFA_OK },
+- [WIN_STANDBYNOW1] = { cmd_nop, ALL_OK },
+- [WIN_IDLEIMMEDIATE] = { cmd_nop, ALL_OK },
+- [WIN_STANDBY] = { cmd_nop, ALL_OK },
+- [WIN_SETIDLE1] = { cmd_nop, ALL_OK },
+- [WIN_CHECKPOWERMODE1] = { cmd_check_power_mode, ALL_OK | SET_DSC },
+- [WIN_SLEEPNOW1] = { cmd_nop, ALL_OK },
++ [WIN_STANDBYNOW1] = { cmd_nop, HD_CFA_OK },
++ [WIN_IDLEIMMEDIATE] = { cmd_nop, HD_CFA_OK },
++ [WIN_STANDBY] = { cmd_nop, HD_CFA_OK },
++ [WIN_SETIDLE1] = { cmd_nop, HD_CFA_OK },
++ [WIN_CHECKPOWERMODE1] = { cmd_check_power_mode, HD_CFA_OK | SET_DSC },
++ [WIN_SLEEPNOW1] = { cmd_nop, HD_CFA_OK },
+ [WIN_FLUSH_CACHE] = { cmd_flush_cache, ALL_OK },
+ [WIN_FLUSH_CACHE_EXT] = { cmd_flush_cache, HD_CFA_OK },
+ [WIN_IDENTIFY] = { cmd_identify, ALL_OK },
+ [WIN_SETFEATURES] = { cmd_set_features, ALL_OK | SET_DSC },
+ [IBM_SENSE_CONDITION] = { cmd_ibm_sense_condition, CFA_OK | SET_DSC },
+ [CFA_WEAR_LEVEL] = { cmd_cfa_erase_sectors, HD_CFA_OK | SET_DSC },
+- [WIN_READ_NATIVE_MAX] = { cmd_read_native_max, ALL_OK | SET_DSC },
++ [WIN_READ_NATIVE_MAX] = { cmd_read_native_max, HD_CFA_OK | SET_DSC },
+ };
+
+ static bool ide_cmd_permitted(IDEState *s, uint32_t cmd)
+--
+2.6.0.rc2.230.g3dd15c0
+
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch
new file mode 100644
index 0000000..4ee46e1
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch
@@ -0,0 +1,58 @@
+https://bugs.gentoo.org/560760
+
+From ce317461573bac12b10d67699b4ddf1f97cf066c Mon Sep 17 00:00:00 2001
+From: Jason Wang <jasowang@redhat.com>
+Date: Fri, 25 Sep 2015 13:21:28 +0800
+Subject: [PATCH 1/3] virtio: introduce virtqueue_unmap_sg()
+
+Factor out sg unmapping logic. This will be reused by the patch that
+can discard descriptor.
+
+Cc: Michael S. Tsirkin <mst@redhat.com>
+Cc: Andrew James <andrew.james@hpe.com>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+---
+ hw/virtio/virtio.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
+index 7504f8b..6f2b96c 100644
+--- a/hw/virtio/virtio.c
++++ b/hw/virtio/virtio.c
+@@ -244,14 +244,12 @@ int virtio_queue_empty(VirtQueue *vq)
+ return vring_avail_idx(vq) == vq->last_avail_idx;
+ }
+
+-void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
+- unsigned int len, unsigned int idx)
++static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem,
++ unsigned int len)
+ {
+ unsigned int offset;
+ int i;
+
+- trace_virtqueue_fill(vq, elem, len, idx);
+-
+ offset = 0;
+ for (i = 0; i < elem->in_num; i++) {
+ size_t size = MIN(len - offset, elem->in_sg[i].iov_len);
+@@ -267,6 +265,14 @@ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
+ cpu_physical_memory_unmap(elem->out_sg[i].iov_base,
+ elem->out_sg[i].iov_len,
+ 0, elem->out_sg[i].iov_len);
++}
++
++void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
++ unsigned int len, unsigned int idx)
++{
++ trace_virtqueue_fill(vq, elem, len, idx);
++
++ virtqueue_unmap_sg(vq, elem, len);
+
+ idx = (idx + vring_used_idx(vq)) % vq->vring.num;
+
+--
+2.6.0.rc2.230.g3dd15c0
+
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch
new file mode 100644
index 0000000..8c73fcb
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch
@@ -0,0 +1,54 @@
+https://bugs.gentoo.org/560760
+
+From 29b9f5efd78ae0f9cc02dd169b6e80d2c404bade Mon Sep 17 00:00:00 2001
+From: Jason Wang <jasowang@redhat.com>
+Date: Fri, 25 Sep 2015 13:21:29 +0800
+Subject: [PATCH 2/3] virtio: introduce virtqueue_discard()
+
+This patch introduces virtqueue_discard() to discard a descriptor and
+unmap the sgs. This will be used by the patch that will discard
+descriptor when packet is truncated.
+
+Cc: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+---
+ hw/virtio/virtio.c | 7 +++++++
+ include/hw/virtio/virtio.h | 2 ++
+ 2 files changed, 9 insertions(+)
+
+diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
+index 6f2b96c..d0bc72e 100644
+--- a/hw/virtio/virtio.c
++++ b/hw/virtio/virtio.c
+@@ -267,6 +267,13 @@ static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem,
+ 0, elem->out_sg[i].iov_len);
+ }
+
++void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
++ unsigned int len)
++{
++ vq->last_avail_idx--;
++ virtqueue_unmap_sg(vq, elem, len);
++}
++
+ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
+ unsigned int len, unsigned int idx)
+ {
+diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
+index 6201ee8..9d09115 100644
+--- a/include/hw/virtio/virtio.h
++++ b/include/hw/virtio/virtio.h
+@@ -146,6 +146,8 @@ void virtio_del_queue(VirtIODevice *vdev, int n);
+ void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
+ unsigned int len);
+ void virtqueue_flush(VirtQueue *vq, unsigned int count);
++void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
++ unsigned int len);
+ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
+ unsigned int len, unsigned int idx);
+
+--
+2.6.0.rc2.230.g3dd15c0
+
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch
new file mode 100644
index 0000000..96981e9
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch
@@ -0,0 +1,47 @@
+https://bugs.gentoo.org/560760
+
+From 0cf33fb6b49a19de32859e2cdc6021334f448fb3 Mon Sep 17 00:00:00 2001
+From: Jason Wang <jasowang@redhat.com>
+Date: Fri, 25 Sep 2015 13:21:30 +0800
+Subject: [PATCH 3/3] virtio-net: correctly drop truncated packets
+
+When packet is truncated during receiving, we drop the packets but
+neither discard the descriptor nor add and signal used
+descriptor. This will lead several issues:
+
+- sg mappings are leaked
+- rx will be stalled if a lots of packets were truncated
+
+In order to be consistent with vhost, fix by discarding the descriptor
+in this case.
+
+Cc: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+---
+ hw/net/virtio-net.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
+index d388c55..a877614 100644
+--- a/hw/net/virtio-net.c
++++ b/hw/net/virtio-net.c
+@@ -1094,13 +1094,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t
+ * must have consumed the complete packet.
+ * Otherwise, drop it. */
+ if (!n->mergeable_rx_bufs && offset < size) {
+-#if 0
+- error_report("virtio-net truncated non-mergeable packet: "
+- "i %zd mergeable %d offset %zd, size %zd, "
+- "guest hdr len %zd, host hdr len %zd",
+- i, n->mergeable_rx_bufs,
+- offset, size, n->guest_hdr_len, n->host_hdr_len);
+-#endif
++ virtqueue_discard(q->rx_vq, &elem, total);
+ return size;
+ }
+
+--
+2.6.0.rc2.230.g3dd15c0
+
diff --git a/app-emulation/qemu/qemu-2.4.0.1.ebuild b/app-emulation/qemu/qemu-2.4.0.1.ebuild
new file mode 100644
index 0000000..306d772
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.4.0.1.ebuild
@@ -0,0 +1,643 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo pax-utils
+
+BACKPORTS=
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
+ ${BACKPORTS:+
+ https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
+ KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
+gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
+static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
+virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? ( app-accessibility/brltty[static-libs(+)] )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.90 )
+ )
+ )
+ infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gles2]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( dev-libs/nss !app-emulation/libcacard )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ tls? ( net-libs/gnutls[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.8.2
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xen? ( app-emulation/xen-tools )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'\n
+For Intel CPUs the module is called 'kvm-intel'\n
+Please review /etc/conf.d/modules for how to load these\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ # Cheap hack to disable gettext .mo generation.
+ use nls || rm -f po/*.po
+
+ epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
+ epatch "${FILESDIR}"/${PN}-2.4.0-block-mirror-crash.patch #558396
+ epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-7295-{1,2,3}.patch #560760
+ epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-6855.patch #560422
+ [[ -n ${BACKPORTS} ]] && \
+ EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
+ epatch
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+ local static_flag="static-${buildtype}"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard smartcard-nss)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu tls vnc-tls)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu uuid)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu vte)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ )
+ static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/kvm_stat"
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_dorules "${FILESDIR}"/65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp/*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+ if use virtfs && [ -n "${softmmu_targets}" ]; then
+ local virtfs_caps="cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_setgid,cap_mknod,cap_setuid"
+ fcaps ${virtfs_caps} /usr/bin/virtfs-proxy-helper
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2015-10-15 20:24 Markos Chandras
0 siblings, 0 replies; 66+ messages in thread
From: Markos Chandras @ 2015-10-15 20:24 UTC (permalink / raw
To: gentoo-commits
commit: 177c849e4ac330d8b4e16fc8326493bd7c32114a
Author: Markos Chandras <hwoarang <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 15 20:22:39 2015 +0000
Commit: Markos Chandras <hwoarang <AT> gentoo <DOT> org>
CommitDate: Thu Oct 15 20:23:59 2015 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=177c849e
app-emulation/qemu: Backport a few MIPS patches. Bug #563162
Package-Manager: portage-2.2.23
.../qemu/files/qemu-2.4-mips-fix-mtc0.patch | 78 +++
.../qemu/files/qemu-2.4-mips-fix-rdhwr.patch | 44 ++
.../qemu-2.4-mips-move-interrupts-new-func.patch | 89 +++
.../qemu/files/qemu-2.4-mips-wake-up-on-irq.patch | 29 +
app-emulation/qemu/qemu-2.4.0.1-r1.ebuild | 648 +++++++++++++++++++++
5 files changed, 888 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.4-mips-fix-mtc0.patch b/app-emulation/qemu/files/qemu-2.4-mips-fix-mtc0.patch
new file mode 100644
index 0000000..07c2be5
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4-mips-fix-mtc0.patch
@@ -0,0 +1,78 @@
+From d54a299b83a07642c85a22bfe19b69ca4def9ec4 Mon Sep 17 00:00:00 2001
+From: Leon Alrae <leon.alrae@imgtec.com>
+Date: Wed, 9 Sep 2015 12:44:25 +0100
+Subject: [PATCH] target-mips: correct MTC0 instruction on MIPS64
+
+MTC0 on a 64-bit processor should move entire 64-bit GPR content to CP0
+register.
+
+Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
+Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
+---
+ target-mips/translate.c | 18 +++++++-----------
+ 1 files changed, 7 insertions(+), 11 deletions(-)
+
+diff --git a/target-mips/translate.c b/target-mips/translate.c
+index 0883782..a59b670 100644
+--- a/target-mips/translate.c
++++ b/target-mips/translate.c
+@@ -4765,12 +4765,6 @@ static inline void gen_mtc0_store32 (TCGv arg, target_ulong off)
+ tcg_temp_free_i32(t0);
+ }
+
+-static inline void gen_mtc0_store64 (TCGv arg, target_ulong off)
+-{
+- tcg_gen_ext32s_tl(arg, arg);
+- tcg_gen_st_tl(arg, cpu_env, off);
+-}
+-
+ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
+ {
+ const char *rn = "invalid";
+@@ -5629,12 +5623,14 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
+ break;
+ case 5:
+ CP0_CHECK(ctx->insn_flags & ASE_MT);
+- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_VPESchedule));
++ tcg_gen_st_tl(arg, cpu_env,
++ offsetof(CPUMIPSState, CP0_VPESchedule));
+ rn = "VPESchedule";
+ break;
+ case 6:
+ CP0_CHECK(ctx->insn_flags & ASE_MT);
+- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_VPEScheFBack));
++ tcg_gen_st_tl(arg, cpu_env,
++ offsetof(CPUMIPSState, CP0_VPEScheFBack));
+ rn = "VPEScheFBack";
+ break;
+ case 7:
+@@ -5884,7 +5880,7 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
+ case 14:
+ switch (sel) {
+ case 0:
+- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_EPC));
++ tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EPC));
+ rn = "EPC";
+ break;
+ default:
+@@ -6057,7 +6053,7 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
+ switch (sel) {
+ case 0:
+ /* EJTAG support */
+- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_DEPC));
++ tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_DEPC));
+ rn = "DEPC";
+ break;
+ default:
+@@ -6160,7 +6156,7 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
+ case 30:
+ switch (sel) {
+ case 0:
+- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_ErrorEPC));
++ tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_ErrorEPC));
+ rn = "ErrorEPC";
+ break;
+ default:
+--
+1.7.0.4
+
diff --git a/app-emulation/qemu/files/qemu-2.4-mips-fix-rdhwr.patch b/app-emulation/qemu/files/qemu-2.4-mips-fix-rdhwr.patch
new file mode 100644
index 0000000..998ec66
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4-mips-fix-rdhwr.patch
@@ -0,0 +1,44 @@
+From cdfcad788394ff53e317043e07b8e34f4987c659 Mon Sep 17 00:00:00 2001
+From: Alex Smith <alex.smith@imgtec.com>
+Date: Tue, 8 Sep 2015 11:34:11 +0100
+Subject: [PATCH 1/1] target-mips: Fix RDHWR on CP0.Count
+
+For RDHWR on the CP0.Count register, env->CP0_Count was being returned.
+This value is a delta against the QEMU_CLOCK_VIRTUAL clock, not the
+correct current value of CP0.Count. Use cpu_mips_get_count() instead.
+
+Signed-off-by: Alex Smith <alex.smith@imgtec.com>
+Cc: Aurelien Jarno <aurelien@aurel32.net>
+Cc: Leon Alrae <leon.alrae@imgtec.com>
+Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
+Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
+Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
+---
+ target-mips/op_helper.c | 9 +++++++--
+ 1 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
+index 1aa9e3c..94de108 100644
+--- a/target-mips/op_helper.c
++++ b/target-mips/op_helper.c
+@@ -2184,10 +2184,15 @@ target_ulong helper_rdhwr_synci_step(CPUMIPSState *env)
+ target_ulong helper_rdhwr_cc(CPUMIPSState *env)
+ {
+ if ((env->hflags & MIPS_HFLAG_CP0) ||
+- (env->CP0_HWREna & (1 << 2)))
++ (env->CP0_HWREna & (1 << 2))) {
++#ifdef CONFIG_USER_ONLY
+ return env->CP0_Count;
+- else
++#else
++ return (int32_t)cpu_mips_get_count(env);
++#endif
++ } else {
+ helper_raise_exception(env, EXCP_RI);
++ }
+
+ return 0;
+ }
+--
+1.7.0.4
+
diff --git a/app-emulation/qemu/files/qemu-2.4-mips-move-interrupts-new-func.patch b/app-emulation/qemu/files/qemu-2.4-mips-move-interrupts-new-func.patch
new file mode 100644
index 0000000..0ea5df5
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4-mips-move-interrupts-new-func.patch
@@ -0,0 +1,89 @@
+Pending upstream inclusion
+
+Link: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg03573.html
+Patchwork: https://patchwork.ozlabs.org/patch/517392/
+X-Gentoo-Bug: 563162
+X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=563162
+
+Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
+
+diff --git a/target-mips/cpu.c b/target-mips/cpu.c
+index 4027d0f..144eea9 100644
+--- a/target-mips/cpu.c
++++ b/target-mips/cpu.c
+@@ -58,7 +58,9 @@ static bool mips_cpu_has_work(CPUState *cs)
+ check for interrupts that can be taken. */
+ if ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
+ cpu_mips_hw_interrupts_pending(env)) {
+- has_work = true;
++ if (cpu_mips_hw_interrupts_enabled(env)) {
++ has_work = true;
++ }
+ }
+
+ /* MIPS-MT has the ability to halt the CPU. */
+diff --git a/target-mips/cpu.h b/target-mips/cpu.h
+index c91883d..210370e 100644
+--- a/target-mips/cpu.h
++++ b/target-mips/cpu.h
+@@ -639,23 +639,24 @@ static inline int cpu_mmu_index (CPUMIPSState *env)
+ return env->hflags & MIPS_HFLAG_KSU;
+ }
+
+-static inline int cpu_mips_hw_interrupts_pending(CPUMIPSState *env)
++static inline bool cpu_mips_hw_interrupts_enabled(CPUMIPSState *env)
+ {
+- int32_t pending;
+- int32_t status;
+- int r;
+-
+- if (!(env->CP0_Status & (1 << CP0St_IE)) ||
+- (env->CP0_Status & (1 << CP0St_EXL)) ||
+- (env->CP0_Status & (1 << CP0St_ERL)) ||
++ return (env->CP0_Status & (1 << CP0St_IE)) &&
++ !(env->CP0_Status & (1 << CP0St_EXL)) &&
++ !(env->CP0_Status & (1 << CP0St_ERL)) &&
++ !(env->hflags & MIPS_HFLAG_DM) &&
+ /* Note that the TCStatus IXMT field is initialized to zero,
+ and only MT capable cores can set it to one. So we don't
+ need to check for MT capabilities here. */
+- (env->active_tc.CP0_TCStatus & (1 << CP0TCSt_IXMT)) ||
+- (env->hflags & MIPS_HFLAG_DM)) {
+- /* Interrupts are disabled */
+- return 0;
+- }
++ !(env->active_tc.CP0_TCStatus & (1 << CP0TCSt_IXMT));
++}
++
++/* Check if there is pending and not masked out interrupt */
++static inline bool cpu_mips_hw_interrupts_pending(CPUMIPSState *env)
++{
++ int32_t pending;
++ int32_t status;
++ bool r;
+
+ pending = env->CP0_Cause & CP0Ca_IP_mask;
+ status = env->CP0_Status & CP0Ca_IP_mask;
+@@ -669,7 +670,7 @@ static inline int cpu_mips_hw_interrupts_pending(CPUMIPSState *env)
+ /* A MIPS configured with compatibility or VInt (Vectored Interrupts)
+ treats the pending lines as individual interrupt lines, the status
+ lines are individual masks. */
+- r = pending & status;
++ r = (pending & status) != 0;
+ }
+ return r;
+ }
+diff --git a/target-mips/helper.c b/target-mips/helper.c
+index 01c4461..2d86323 100644
+--- a/target-mips/helper.c
++++ b/target-mips/helper.c
+@@ -759,7 +759,8 @@ bool mips_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
+ MIPSCPU *cpu = MIPS_CPU(cs);
+ CPUMIPSState *env = &cpu->env;
+
+- if (cpu_mips_hw_interrupts_pending(env)) {
++ if (cpu_mips_hw_interrupts_enabled(env) &&
++ cpu_mips_hw_interrupts_pending(env)) {
+ /* Raise it */
+ cs->exception_index = EXCP_EXT_INTERRUPT;
+ env->error_code = 0;
diff --git a/app-emulation/qemu/files/qemu-2.4-mips-wake-up-on-irq.patch b/app-emulation/qemu/files/qemu-2.4-mips-wake-up-on-irq.patch
new file mode 100644
index 0000000..559a4af
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.4-mips-wake-up-on-irq.patch
@@ -0,0 +1,29 @@
+Pending upstream inclusion
+
+Link: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg03572.html
+Patchwork: https://patchwork.ozlabs.org/patch/517391/
+X-Gentoo-Bug: 563162
+X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=563162
+
+Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
+diff --git a/target-mips/cpu.c b/target-mips/cpu.c
+index 144eea9..cbeca04 100644
+--- a/target-mips/cpu.c
++++ b/target-mips/cpu.c
+@@ -53,12 +53,13 @@ static bool mips_cpu_has_work(CPUState *cs)
+ CPUMIPSState *env = &cpu->env;
+ bool has_work = false;
+
+- /* It is implementation dependent if non-enabled interrupts
+- wake-up the CPU, however most of the implementations only
++ /* Prior to MIPS Release 6 it is implementation dependent if non-enabled
++ interrupts wake-up the CPU, however most of the implementations only
+ check for interrupts that can be taken. */
+ if ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
+ cpu_mips_hw_interrupts_pending(env)) {
+- if (cpu_mips_hw_interrupts_enabled(env)) {
++ if (cpu_mips_hw_interrupts_enabled(env) ||
++ (env->insn_flags & ISA_MIPS32R6)) {
+ has_work = true;
+ }
+ }
diff --git a/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild b/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild
new file mode 100644
index 0000000..7129767
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild
@@ -0,0 +1,648 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo pax-utils
+
+BACKPORTS=
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
+ ${BACKPORTS:+
+ https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
+ KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
+gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
+static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
+virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? ( app-accessibility/brltty[static-libs(+)] )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.90 )
+ )
+ )
+ infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gles2]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( dev-libs/nss !app-emulation/libcacard )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ tls? ( net-libs/gnutls[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.8.2
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xen? ( app-emulation/xen-tools )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'\n
+For Intel CPUs the module is called 'kvm-intel'\n
+Please review /etc/conf.d/modules for how to load these\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ # Cheap hack to disable gettext .mo generation.
+ use nls || rm -f po/*.po
+
+ epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
+ epatch "${FILESDIR}"/${PN}-2.4.0-block-mirror-crash.patch #558396
+ epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-7295-{1,2,3}.patch #560760
+ epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-6855.patch #560422
+ [[ -n ${BACKPORTS} ]] && \
+ EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
+ epatch
+
+ # MIPS specific fixes. Bug #563162
+ for x in "${FILESDIR}"/${PN}-2.4-mips-*; do
+ epatch "${x}"
+ done
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+ local static_flag="static-${buildtype}"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard smartcard-nss)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu tls vnc-tls)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu uuid)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu vte)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ )
+ static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/kvm_stat"
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_dorules "${FILESDIR}"/65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp/*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+ if use virtfs && [ -n "${softmmu_targets}" ]; then
+ local virtfs_caps="cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_setgid,cap_mknod,cap_setuid"
+ fcaps ${virtfs_caps} /usr/bin/virtfs-proxy-helper
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2015-12-17 15:12 Mike Frysinger
0 siblings, 0 replies; 66+ messages in thread
From: Mike Frysinger @ 2015-12-17 15:12 UTC (permalink / raw
To: gentoo-commits
commit: 841a44c7da275802491b0c7adaae009e7821f136
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 17 15:10:17 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Dec 17 15:12:37 2015 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=841a44c7
app-emulation/qemu: drop versions <2.4.1-r2
app-emulation/qemu/Manifest | 4 -
.../qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch | 241 --------
.../qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch | 58 --
.../qemu/files/qemu-2.3.0-CVE-2015-3209.patch | 51 --
.../qemu/files/qemu-2.3.0-CVE-2015-3214.patch | 41 --
.../qemu/files/qemu-2.3.0-CVE-2015-3456.patch | 86 ---
.../qemu/files/qemu-2.3.0-CVE-2015-5154-1.patch | 75 ---
.../qemu/files/qemu-2.3.0-CVE-2015-5154-2.patch | 26 -
.../qemu/files/qemu-2.3.0-CVE-2015-5154-3.patch | 69 ---
.../qemu/files/qemu-2.3.0-CVE-2015-5158.patch | 40 --
.../qemu/files/qemu-2.3.0-CVE-2015-5165-1.patch | 82 ---
.../qemu/files/qemu-2.3.0-CVE-2015-5165-2.patch | 373 ------------
.../qemu/files/qemu-2.3.0-CVE-2015-5165-3.patch | 39 --
.../qemu/files/qemu-2.3.0-CVE-2015-5165-4.patch | 53 --
.../qemu/files/qemu-2.3.0-CVE-2015-5165-5.patch | 34 --
.../qemu/files/qemu-2.3.0-CVE-2015-5165-6.patch | 35 --
.../qemu/files/qemu-2.3.0-CVE-2015-5165-7.patch | 32 -
.../qemu/files/qemu-2.3.0-CVE-2015-5166.patch | 36 --
.../qemu/files/qemu-2.3.0-virtio-serial.patch | 34 --
.../qemu/files/qemu-2.4.0-CVE-2015-5225.patch | 86 ---
.../qemu/files/qemu-2.4.0-CVE-2015-6855.patch | 146 -----
.../qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch | 58 --
.../qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch | 54 --
.../qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch | 47 --
.../qemu/files/qemu-2.4.0-block-mirror-crash.patch | 124 ----
.../qemu/files/qemu-2.4.0-e1000-loop.patch | 39 --
app-emulation/qemu/qemu-2.3.0-r5.ebuild | 611 -------------------
app-emulation/qemu/qemu-2.3.0-r6.ebuild | 612 -------------------
app-emulation/qemu/qemu-2.3.0-r7.ebuild | 612 -------------------
app-emulation/qemu/qemu-2.3.1-r1.ebuild | 598 -------------------
app-emulation/qemu/qemu-2.3.1.ebuild | 598 -------------------
app-emulation/qemu/qemu-2.4.0-r1.ebuild | 640 --------------------
app-emulation/qemu/qemu-2.4.0-r2.ebuild | 640 --------------------
app-emulation/qemu/qemu-2.4.0.1-r1.ebuild | 645 ---------------------
app-emulation/qemu/qemu-2.4.0.1-r2.ebuild | 645 ---------------------
app-emulation/qemu/qemu-2.4.0.1.ebuild | 640 --------------------
app-emulation/qemu/qemu-2.4.1-r1.ebuild | 640 --------------------
app-emulation/qemu/qemu-2.4.1.ebuild | 638 --------------------
38 files changed, 9482 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 91125c9..6269bb7 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,6 +1,2 @@
-DIST qemu-2.3.0.tar.bz2 24683085 SHA256 b6bab7f763d5be73e7cb5ee7d4c8365b7a8df2972c52fa5ded18893bd8281588 SHA512 7a40d213c5696b27784abd2a3119e49d42c38c923be431826c73a8f14c19074435d7f1a652686c53baf08e81f5a3005b2ddc92d67c32f6a2b19659ab627e9eaa WHIRLPOOL 9dad6e342027c3be512b4e0b40e810e0a6f1dc84a16847aa5aac74d97f7a347e60d42e770335a090f83e90a1614294f86552a84edc1faafc7093d3e32602f5de
-DIST qemu-2.3.1.tar.bz2 24692020 SHA256 661d029809421cae06b4b1bc74ac0e560cb4ed47c9523c676ff277fa26dca15f SHA512 309e6df7dcc0a064d1a17c7dac2f60398700dfa8c6b60b66e4202966248097cbc49af75aa97725bc34773151be6fd75836810e9f0741ba65cdc208414fa78f6b WHIRLPOOL 26750ee00513daa99cdcd585c4b8407b8258a9c3559ae6335266d7754cb6679e7c10c56f8d12ae0ef2b5cd5d6a9a6a536213f8e86e81ced37e46205c796a773e
-DIST qemu-2.4.0.1.tar.bz2 25068555 SHA256 ecfe8b88037e41e817d72c460c56c6a0b573d540d6ba38b162d0de4fd22d1bdb SHA512 08eabe92fa9096386ef00f8e9d99eeec1508d15e5a98431e043a729cbaca2d96d6e3afc612e7c4a0fe5a6bba80006276185f1066b4c73105b2ea24b7e9133b84 WHIRLPOOL 1daaec23d6ada6af8bf4902e590fb96375e7149d2f53ff6bf6d8fb39722c182a2d2efcc0d40bee673a8316f621983c512daa54202bb4e632b3a4b09f0268cd09
-DIST qemu-2.4.0.tar.bz2 25070979 SHA256 72b0b991bbcc540663a019e1e8c4f714053b691dda32c9b9ee80b25f367e6620 SHA512 8740e0fb2c654ed897dff4649f1f83d14d57cfa9cbde723899f115982f93253ce9a2bddd60aab379d241027d2044137770efe4c0b3c83d5b20f3a2a06f05a5dc WHIRLPOOL 8c6cfae096624e01f0d5daeb86aa2dccbeaa86d2aeab626cf55cf20b7edace82d0b0f3a1d85eeb2dc1fd53abaaa9dccf8f0d7ddc657a1f5ffd72fd68301648f1
DIST qemu-2.4.1.tar.bz2 25087522 SHA256 e3d5cf4c8b1f9129c9c797329a515bfb6b3b1ded0ab8b394c8a316490fe3a177 SHA512 fde32b71a50d888c1055e61f4e6dfc45bb97e8e9ebee490c545965fbdcbd5ffd859fbf20648abed1f4fa9fcc5635e9b22e1829bbe802fc8aaf989d6013235917 WHIRLPOOL a698cfa5d2d138eeddb3c6bea57e3b89ca5d47165c04ed1cfd66a81647ac59cbdd594c919abef67bf198278da1160c5b9f3a0da84cd73827f3eb19a6e6f05436
DIST qemu-2.5.0.tar.bz2 25464996 SHA256 3443887401619fe33bfa5d900a4f2d6a79425ae2b7e43d5b8c36eb7a683772d4 SHA512 12153f94cc7f834fd6a85f25690c36f2331d88d414426fb8b9ac20a34e6f9222b1eda30b727674af583580fae90dfd6d0614a905dce1567d94cd049d426b9dd3 WHIRLPOOL 8f5717989d8d234ecf1763ee386b2e1f20c3b17918de130c6dae255e4523a230b2b01a759eba25e4b9f604c680d9b868c56f58bd71b7c6c2c22a2e46804435ef
diff --git a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch b/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch
deleted file mode 100644
index 35ef8fd..0000000
--- a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch
+++ /dev/null
@@ -1,241 +0,0 @@
-From a2bebfd6e09d285aa793cae3fb0fc3a39a9fee6e Mon Sep 17 00:00:00 2001
-From: "Daniel P. Berrange" <berrange@redhat.com>
-Date: Mon, 23 Mar 2015 22:58:21 +0000
-Subject: [PATCH] CVE-2015-1779: incrementally decode websocket frames
-
-The logic for decoding websocket frames wants to fully
-decode the frame header and payload, before allowing the
-VNC server to see any of the payload data. There is no
-size limit on websocket payloads, so this allows a
-malicious network client to consume 2^64 bytes in memory
-in QEMU. It can trigger this denial of service before
-the VNC server even performs any authentication.
-
-The fix is to decode the header, and then incrementally
-decode the payload data as it is needed. With this fix
-the websocket decoder will allow at most 4k of data to
-be buffered before decoding and processing payload.
-
-Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-
-[ kraxel: fix frequent spurious disconnects, suggested by Peter Maydell ]
-
- @@ -361,7 +361,7 @@ int vncws_decode_frame_payload(Buffer *input,
- - *payload_size = input->offset;
- + *payload_size = *payload_remain;
-
-[ kraxel: fix 32bit build ]
-
- @@ -306,7 +306,7 @@ struct VncState
- - uint64_t ws_payload_remain;
- + size_t ws_payload_remain;
-
-Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
----
- ui/vnc-ws.c | 105 ++++++++++++++++++++++++++++++++++++++++--------------------
- ui/vnc-ws.h | 9 ++++--
- ui/vnc.h | 2 ++
- 3 files changed, 80 insertions(+), 36 deletions(-)
-
-diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
-index 85dbb7e..0b7de4e 100644
---- a/ui/vnc-ws.c
-+++ b/ui/vnc-ws.c
-@@ -107,7 +107,7 @@ long vnc_client_read_ws(VncState *vs)
- {
- int ret, err;
- uint8_t *payload;
-- size_t payload_size, frame_size;
-+ size_t payload_size, header_size;
- VNC_DEBUG("Read websocket %p size %zd offset %zd\n", vs->ws_input.buffer,
- vs->ws_input.capacity, vs->ws_input.offset);
- buffer_reserve(&vs->ws_input, 4096);
-@@ -117,18 +117,39 @@ long vnc_client_read_ws(VncState *vs)
- }
- vs->ws_input.offset += ret;
-
-- /* make sure that nothing is left in the ws_input buffer */
-+ ret = 0;
-+ /* consume as much of ws_input buffer as possible */
- do {
-- err = vncws_decode_frame(&vs->ws_input, &payload,
-- &payload_size, &frame_size);
-- if (err <= 0) {
-- return err;
-+ if (vs->ws_payload_remain == 0) {
-+ err = vncws_decode_frame_header(&vs->ws_input,
-+ &header_size,
-+ &vs->ws_payload_remain,
-+ &vs->ws_payload_mask);
-+ if (err <= 0) {
-+ return err;
-+ }
-+
-+ buffer_advance(&vs->ws_input, header_size);
- }
-+ if (vs->ws_payload_remain != 0) {
-+ err = vncws_decode_frame_payload(&vs->ws_input,
-+ &vs->ws_payload_remain,
-+ &vs->ws_payload_mask,
-+ &payload,
-+ &payload_size);
-+ if (err < 0) {
-+ return err;
-+ }
-+ if (err == 0) {
-+ return ret;
-+ }
-+ ret += err;
-
-- buffer_reserve(&vs->input, payload_size);
-- buffer_append(&vs->input, payload, payload_size);
-+ buffer_reserve(&vs->input, payload_size);
-+ buffer_append(&vs->input, payload, payload_size);
-
-- buffer_advance(&vs->ws_input, frame_size);
-+ buffer_advance(&vs->ws_input, payload_size);
-+ }
- } while (vs->ws_input.offset > 0);
-
- return ret;
-@@ -265,15 +286,14 @@ void vncws_encode_frame(Buffer *output, const void *payload,
- buffer_append(output, payload, payload_size);
- }
-
--int vncws_decode_frame(Buffer *input, uint8_t **payload,
-- size_t *payload_size, size_t *frame_size)
-+int vncws_decode_frame_header(Buffer *input,
-+ size_t *header_size,
-+ size_t *payload_remain,
-+ WsMask *payload_mask)
- {
- unsigned char opcode = 0, fin = 0, has_mask = 0;
-- size_t header_size = 0;
-- uint32_t *payload32;
-+ size_t payload_len;
- WsHeader *header = (WsHeader *)input->buffer;
-- WsMask mask;
-- int i;
-
- if (input->offset < WS_HEAD_MIN_LEN + 4) {
- /* header not complete */
-@@ -283,7 +303,7 @@ int vncws_decode_frame(Buffer *input, uint8_t **payload,
- fin = (header->b0 & 0x80) >> 7;
- opcode = header->b0 & 0x0f;
- has_mask = (header->b1 & 0x80) >> 7;
-- *payload_size = header->b1 & 0x7f;
-+ payload_len = header->b1 & 0x7f;
-
- if (opcode == WS_OPCODE_CLOSE) {
- /* disconnect */
-@@ -300,40 +320,57 @@ int vncws_decode_frame(Buffer *input, uint8_t **payload,
- return -2;
- }
-
-- if (*payload_size < 126) {
-- header_size = 6;
-- mask = header->u.m;
-- } else if (*payload_size == 126 && input->offset >= 8) {
-- *payload_size = be16_to_cpu(header->u.s16.l16);
-- header_size = 8;
-- mask = header->u.s16.m16;
-- } else if (*payload_size == 127 && input->offset >= 14) {
-- *payload_size = be64_to_cpu(header->u.s64.l64);
-- header_size = 14;
-- mask = header->u.s64.m64;
-+ if (payload_len < 126) {
-+ *payload_remain = payload_len;
-+ *header_size = 6;
-+ *payload_mask = header->u.m;
-+ } else if (payload_len == 126 && input->offset >= 8) {
-+ *payload_remain = be16_to_cpu(header->u.s16.l16);
-+ *header_size = 8;
-+ *payload_mask = header->u.s16.m16;
-+ } else if (payload_len == 127 && input->offset >= 14) {
-+ *payload_remain = be64_to_cpu(header->u.s64.l64);
-+ *header_size = 14;
-+ *payload_mask = header->u.s64.m64;
- } else {
- /* header not complete */
- return 0;
- }
-
-- *frame_size = header_size + *payload_size;
-+ return 1;
-+}
-+
-+int vncws_decode_frame_payload(Buffer *input,
-+ size_t *payload_remain, WsMask *payload_mask,
-+ uint8_t **payload, size_t *payload_size)
-+{
-+ size_t i;
-+ uint32_t *payload32;
-
-- if (input->offset < *frame_size) {
-- /* frame not complete */
-+ *payload = input->buffer;
-+ /* If we aren't at the end of the payload, then drop
-+ * off the last bytes, so we're always multiple of 4
-+ * for purpose of unmasking, except at end of payload
-+ */
-+ if (input->offset < *payload_remain) {
-+ *payload_size = input->offset - (input->offset % 4);
-+ } else {
-+ *payload_size = *payload_remain;
-+ }
-+ if (*payload_size == 0) {
- return 0;
- }
--
-- *payload = input->buffer + header_size;
-+ *payload_remain -= *payload_size;
-
- /* unmask frame */
- /* process 1 frame (32 bit op) */
- payload32 = (uint32_t *)(*payload);
- for (i = 0; i < *payload_size / 4; i++) {
-- payload32[i] ^= mask.u;
-+ payload32[i] ^= payload_mask->u;
- }
- /* process the remaining bytes (if any) */
- for (i *= 4; i < *payload_size; i++) {
-- (*payload)[i] ^= mask.c[i % 4];
-+ (*payload)[i] ^= payload_mask->c[i % 4];
- }
-
- return 1;
-diff --git a/ui/vnc-ws.h b/ui/vnc-ws.h
-index ef229b7..14d4230 100644
---- a/ui/vnc-ws.h
-+++ b/ui/vnc-ws.h
-@@ -83,7 +83,12 @@ long vnc_client_read_ws(VncState *vs);
- void vncws_process_handshake(VncState *vs, uint8_t *line, size_t size);
- void vncws_encode_frame(Buffer *output, const void *payload,
- const size_t payload_size);
--int vncws_decode_frame(Buffer *input, uint8_t **payload,
-- size_t *payload_size, size_t *frame_size);
-+int vncws_decode_frame_header(Buffer *input,
-+ size_t *header_size,
-+ size_t *payload_remain,
-+ WsMask *payload_mask);
-+int vncws_decode_frame_payload(Buffer *input,
-+ size_t *payload_remain, WsMask *payload_mask,
-+ uint8_t **payload, size_t *payload_size);
-
- #endif /* __QEMU_UI_VNC_WS_H */
-diff --git a/ui/vnc.h b/ui/vnc.h
-index e19ac39..3f7c6a9 100644
---- a/ui/vnc.h
-+++ b/ui/vnc.h
-@@ -306,6 +306,8 @@ struct VncState
- #ifdef CONFIG_VNC_WS
- Buffer ws_input;
- Buffer ws_output;
-+ size_t ws_payload_remain;
-+ WsMask ws_payload_mask;
- #endif
- /* current output mode information */
- VncWritePixels *write_pixels;
---
-2.3.5
-
diff --git a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch b/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch
deleted file mode 100644
index c7a8c8b..0000000
--- a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 2cdb5e142fb93e875fa53c52864ef5eb8d5d8b41 Mon Sep 17 00:00:00 2001
-From: "Daniel P. Berrange" <berrange@redhat.com>
-Date: Mon, 23 Mar 2015 22:58:22 +0000
-Subject: [PATCH] CVE-2015-1779: limit size of HTTP headers from websockets
- clients
-
-The VNC server websockets decoder will read and buffer data from
-websockets clients until it sees the end of the HTTP headers,
-as indicated by \r\n\r\n. In theory this allows a malicious to
-trick QEMU into consuming an arbitrary amount of RAM. In practice,
-because QEMU runs g_strstr_len() across the buffered header data,
-it will spend increasingly long burning CPU time searching for
-the substring match and less & less time reading data. So while
-this does cause arbitrary memory growth, the bigger problem is
-that QEMU will be burning 100% of available CPU time.
-
-A novnc websockets client typically sends headers of around
-512 bytes in length. As such it is reasonable to place a 4096
-byte limit on the amount of data buffered while searching for
-the end of HTTP headers.
-
-Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
----
- ui/vnc-ws.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
-index 0b7de4e..62eb97f 100644
---- a/ui/vnc-ws.c
-+++ b/ui/vnc-ws.c
-@@ -81,8 +81,11 @@ void vncws_handshake_read(void *opaque)
- VncState *vs = opaque;
- uint8_t *handshake_end;
- long ret;
-- buffer_reserve(&vs->ws_input, 4096);
-- ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), 4096);
-+ /* Typical HTTP headers from novnc are 512 bytes, so limiting
-+ * total header size to 4096 is easily enough. */
-+ size_t want = 4096 - vs->ws_input.offset;
-+ buffer_reserve(&vs->ws_input, want);
-+ ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), want);
-
- if (!ret) {
- if (vs->csock == -1) {
-@@ -99,6 +102,9 @@ void vncws_handshake_read(void *opaque)
- vncws_process_handshake(vs, vs->ws_input.buffer, vs->ws_input.offset);
- buffer_advance(&vs->ws_input, handshake_end - vs->ws_input.buffer +
- strlen(WS_HANDSHAKE_END));
-+ } else if (vs->ws_input.offset >= 4096) {
-+ VNC_DEBUG("End of headers not found in first 4096 bytes\n");
-+ vnc_client_error(vs);
- }
- }
-
---
-2.3.5
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3209.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3209.patch
deleted file mode 100644
index 885db3b..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3209.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-https://bugs.gentoo.org/551752
-
-From 9f7c594c006289ad41169b854d70f5da6e400a2a Mon Sep 17 00:00:00 2001
-From: Petr Matousek <pmatouse@redhat.com>
-Date: Sun, 24 May 2015 10:53:44 +0200
-Subject: [PATCH] pcnet: force the buffer access to be in bounds during tx
-
-4096 is the maximum length per TMD and it is also currently the size of
-the relay buffer pcnet driver uses for sending the packet data to QEMU
-for further processing. With packet spanning multiple TMDs it can
-happen that the overall packet size will be bigger than sizeof(buffer),
-which results in memory corruption.
-
-Fix this by only allowing to queue maximum sizeof(buffer) bytes.
-
-This is CVE-2015-3209.
-
-[Fixed 3-space indentation to QEMU's 4-space coding standard.
---Stefan]
-
-Signed-off-by: Petr Matousek <pmatouse@redhat.com>
-Reported-by: Matt Tait <matttait@google.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/pcnet.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
-index bdfd38f..68b9981 100644
---- a/hw/net/pcnet.c
-+++ b/hw/net/pcnet.c
-@@ -1241,6 +1241,14 @@ static void pcnet_transmit(PCNetState *s)
- }
-
- bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
-+
-+ /* if multi-tmd packet outsizes s->buffer then skip it silently.
-+ Note: this is not what real hw does */
-+ if (s->xmit_pos + bcnt > sizeof(s->buffer)) {
-+ s->xmit_pos = -1;
-+ goto txdone;
-+ }
-+
- s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
- s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
- s->xmit_pos += bcnt;
---
-2.2.0.rc0.207.ga3a616c
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3214.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3214.patch
deleted file mode 100644
index 7fee8fd..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3214.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From: Petr Matousek <pmatouse@redhat.com>
-Date: Wed, 17 Jun 2015 10:46:11 +0000 (+0200)
-Subject: i8254: fix out-of-bounds memory access in pit_ioport_read()
-X-Git-Tag: v2.4.0-rc0~43^2~9
-X-Git-Url: http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h=d4862a87e31a51de9eb260f25c9e99a75efe3235;hp=9dacf32d2cbd66cbcce7944ebdfd6b2df20e33b8
-
-i8254: fix out-of-bounds memory access in pit_ioport_read()
-
-Due converting PIO to the new memory read/write api we no longer provide
-separate I/O region lenghts for read and write operations. As a result,
-reading from PIT Mode/Command register will end with accessing
-pit->channels with invalid index.
-
-Fix this by ignoring read from the Mode/Command register.
-
-This is CVE-2015-3214.
-
-Reported-by: Matt Tait <matttait@google.com>
-Fixes: 0505bcdec8228d8de39ab1a02644e71999e7c052
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Petr Matousek <pmatouse@redhat.com>
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
-
-diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c
-index 3450c98..9b65a33 100644
---- a/hw/timer/i8254.c
-+++ b/hw/timer/i8254.c
-@@ -196,6 +196,12 @@ static uint64_t pit_ioport_read(void *opaque, hwaddr addr,
- PITChannelState *s;
-
- addr &= 3;
-+
-+ if (addr == 3) {
-+ /* Mode/Command register is write only, read is ignored */
-+ return 0;
-+ }
-+
- s = &pit->channels[addr];
- if (s->status_latched) {
- s->status_latched = 0;
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch
deleted file mode 100644
index 87697d0..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-https://bugs.gentoo.org/549404
-
-From e907746266721f305d67bc0718795fedee2e824c Mon Sep 17 00:00:00 2001
-From: Petr Matousek <pmatouse@redhat.com>
-Date: Wed, 6 May 2015 09:48:59 +0200
-Subject: [PATCH] fdc: force the fifo access to be in bounds of the allocated buffer
-
-During processing of certain commands such as FD_CMD_READ_ID and
-FD_CMD_DRIVE_SPECIFICATION_COMMAND the fifo memory access could
-get out of bounds leading to memory corruption with values coming
-from the guest.
-
-Fix this by making sure that the index is always bounded by the
-allocated memory.
-
-This is CVE-2015-3456.
-
-Signed-off-by: Petr Matousek <pmatouse@redhat.com>
-Reviewed-by: John Snow <jsnow@redhat.com>
-Signed-off-by: John Snow <jsnow@redhat.com>
----
- hw/block/fdc.c | 17 +++++++++++------
- 1 files changed, 11 insertions(+), 6 deletions(-)
-
-diff --git a/hw/block/fdc.c b/hw/block/fdc.c
-index f72a392..d8a8edd 100644
---- a/hw/block/fdc.c
-+++ b/hw/block/fdc.c
-@@ -1497,7 +1497,7 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
- {
- FDrive *cur_drv;
- uint32_t retval = 0;
-- int pos;
-+ uint32_t pos;
-
- cur_drv = get_cur_drv(fdctrl);
- fdctrl->dsr &= ~FD_DSR_PWRDOWN;
-@@ -1506,8 +1506,8 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
- return 0;
- }
- pos = fdctrl->data_pos;
-+ pos %= FD_SECTOR_LEN;
- if (fdctrl->msr & FD_MSR_NONDMA) {
-- pos %= FD_SECTOR_LEN;
- if (pos == 0) {
- if (fdctrl->data_pos != 0)
- if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) {
-@@ -1852,10 +1852,13 @@ static void fdctrl_handle_option(FDCtrl *fdctrl, int direction)
- static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direction)
- {
- FDrive *cur_drv = get_cur_drv(fdctrl);
-+ uint32_t pos;
-
-- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x80) {
-+ pos = fdctrl->data_pos - 1;
-+ pos %= FD_SECTOR_LEN;
-+ if (fdctrl->fifo[pos] & 0x80) {
- /* Command parameters done */
-- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x40) {
-+ if (fdctrl->fifo[pos] & 0x40) {
- fdctrl->fifo[0] = fdctrl->fifo[1];
- fdctrl->fifo[2] = 0;
- fdctrl->fifo[3] = 0;
-@@ -1955,7 +1958,7 @@ static uint8_t command_to_handler[256];
- static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
- {
- FDrive *cur_drv;
-- int pos;
-+ uint32_t pos;
-
- /* Reset mode */
- if (!(fdctrl->dor & FD_DOR_nRESET)) {
-@@ -2004,7 +2007,9 @@ static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
- }
-
- FLOPPY_DPRINTF("%s: %02x\n", __func__, value);
-- fdctrl->fifo[fdctrl->data_pos++] = value;
-+ pos = fdctrl->data_pos++;
-+ pos %= FD_SECTOR_LEN;
-+ fdctrl->fifo[pos] = value;
- if (fdctrl->data_pos == fdctrl->data_len) {
- /* We now have all parameters
- * and will be able to treat the command
---
-1.7.0.4
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-1.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-1.patch
deleted file mode 100644
index 759e403..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-1.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From d2ff85854512574e7209f295e87b0835d5b032c6 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Sun, 26 Jul 2015 23:42:53 -0400
-Subject: [PATCH] ide: Check array bounds before writing to io_buffer
- (CVE-2015-5154)
-
-If the end_transfer_func of a command is called because enough data has
-been read or written for the current PIO transfer, and it fails to
-correctly call the command completion functions, the DRQ bit in the
-status register and s->end_transfer_func may remain set. This allows the
-guest to access further bytes in s->io_buffer beyond s->data_end, and
-eventually overflowing the io_buffer.
-
-One case where this currently happens is emulation of the ATAPI command
-START STOP UNIT.
-
-This patch fixes the problem by adding explicit array bounds checks
-before accessing the buffer instead of relying on end_transfer_func to
-function correctly.
-
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Reviewed-by: John Snow <jsnow@redhat.com>
----
- hw/ide/core.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
-
-diff --git a/hw/ide/core.c b/hw/ide/core.c
-index 122e955..44fcc23 100644
---- a/hw/ide/core.c
-+++ b/hw/ide/core.c
-@@ -2021,6 +2021,10 @@ void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
- }
-
- p = s->data_ptr;
-+ if (p + 2 > s->data_end) {
-+ return;
-+ }
-+
- *(uint16_t *)p = le16_to_cpu(val);
- p += 2;
- s->data_ptr = p;
-@@ -2042,6 +2046,10 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr)
- }
-
- p = s->data_ptr;
-+ if (p + 2 > s->data_end) {
-+ return 0;
-+ }
-+
- ret = cpu_to_le16(*(uint16_t *)p);
- p += 2;
- s->data_ptr = p;
-@@ -2063,6 +2071,10 @@ void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)
- }
-
- p = s->data_ptr;
-+ if (p + 4 > s->data_end) {
-+ return;
-+ }
-+
- *(uint32_t *)p = le32_to_cpu(val);
- p += 4;
- s->data_ptr = p;
-@@ -2084,6 +2096,10 @@ uint32_t ide_data_readl(void *opaque, uint32_t addr)
- }
-
- p = s->data_ptr;
-+ if (p + 4 > s->data_end) {
-+ return 0;
-+ }
-+
- ret = cpu_to_le32(*(uint32_t *)p);
- p += 4;
- s->data_ptr = p;
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-2.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-2.patch
deleted file mode 100644
index 6d7902a..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-2.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 03441c3a4a42beb25460dd11592539030337d0f8 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Sun, 26 Jul 2015 23:42:53 -0400
-Subject: [PATCH] ide/atapi: Fix START STOP UNIT command completion
-
-The command must be completed on all code paths. START STOP UNIT with
-pwrcnd set should succeed without doing anything.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Reviewed-by: John Snow <jsnow@redhat.com>
----
- hw/ide/atapi.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
-index 950e311..79dd167 100644
---- a/hw/ide/atapi.c
-+++ b/hw/ide/atapi.c
-@@ -983,6 +983,7 @@ static void cmd_start_stop_unit(IDEState *s, uint8_t* buf)
-
- if (pwrcnd) {
- /* eject/load only happens for power condition == 0 */
-+ ide_atapi_cmd_ok(s);
- return;
- }
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-3.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-3.patch
deleted file mode 100644
index f6f346f..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-3.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From cb72cba83021fa42719e73a5249c12096a4d1cfc Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Sun, 26 Jul 2015 23:42:53 -0400
-Subject: [PATCH] ide: Clear DRQ after handling all expected accesses
-
-This is additional hardening against an end_transfer_func that fails to
-clear the DRQ status bit. The bit must be unset as soon as the PIO
-transfer has completed, so it's better to do this in a central place
-instead of duplicating the code in all commands (and forgetting it in
-some).
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Reviewed-by: John Snow <jsnow@redhat.com>
----
- hw/ide/core.c | 16 ++++++++++++----
- 1 file changed, 12 insertions(+), 4 deletions(-)
-
-diff --git a/hw/ide/core.c b/hw/ide/core.c
-index 44fcc23..50449ca 100644
---- a/hw/ide/core.c
-+++ b/hw/ide/core.c
-@@ -2028,8 +2028,10 @@ void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
- *(uint16_t *)p = le16_to_cpu(val);
- p += 2;
- s->data_ptr = p;
-- if (p >= s->data_end)
-+ if (p >= s->data_end) {
-+ s->status &= ~DRQ_STAT;
- s->end_transfer_func(s);
-+ }
- }
-
- uint32_t ide_data_readw(void *opaque, uint32_t addr)
-@@ -2053,8 +2055,10 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr)
- ret = cpu_to_le16(*(uint16_t *)p);
- p += 2;
- s->data_ptr = p;
-- if (p >= s->data_end)
-+ if (p >= s->data_end) {
-+ s->status &= ~DRQ_STAT;
- s->end_transfer_func(s);
-+ }
- return ret;
- }
-
-@@ -2078,8 +2082,10 @@ void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)
- *(uint32_t *)p = le32_to_cpu(val);
- p += 4;
- s->data_ptr = p;
-- if (p >= s->data_end)
-+ if (p >= s->data_end) {
-+ s->status &= ~DRQ_STAT;
- s->end_transfer_func(s);
-+ }
- }
-
- uint32_t ide_data_readl(void *opaque, uint32_t addr)
-@@ -2103,8 +2109,10 @@ uint32_t ide_data_readl(void *opaque, uint32_t addr)
- ret = cpu_to_le32(*(uint32_t *)p);
- p += 4;
- s->data_ptr = p;
-- if (p >= s->data_end)
-+ if (p >= s->data_end) {
-+ s->status &= ~DRQ_STAT;
- s->end_transfer_func(s);
-+ }
- return ret;
- }
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5158.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5158.patch
deleted file mode 100644
index 9badc9b..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5158.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-commit c170aad8b057223b1139d72e5ce7acceafab4fa9
-Author: Paolo Bonzini <pbonzini@redhat.com>
-Date: Tue Jul 21 08:59:39 2015 +0200
-
- scsi: fix buffer overflow in scsi_req_parse_cdb (CVE-2015-5158)
-
- This is a guest-triggerable buffer overflow present in QEMU 2.2.0
- and newer. scsi_cdb_length returns -1 as an error value, but the
- caller does not check it.
-
- Luckily, the massive overflow means that QEMU will just SIGSEGV,
- making the impact much smaller.
-
- Reported-by: Zhu Donghai (朱东海) <donghai.zdh@alibaba-inc.com>
- Fixes: 1894df02811f6b79ea3ffbf1084599d96f316173
- Reviewed-by: Fam Zheng <famz@redhat.com>
- Cc: qemu-stable@nongnu.org
- Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-
-diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
-index f50b2f0..f0ae462 100644
---- a/hw/scsi/scsi-bus.c
-+++ b/hw/scsi/scsi-bus.c
-@@ -1239,10 +1239,15 @@ int scsi_cdb_length(uint8_t *buf) {
- int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf)
- {
- int rc;
-+ int len;
-
- cmd->lba = -1;
-- cmd->len = scsi_cdb_length(buf);
-+ len = scsi_cdb_length(buf);
-+ if (len < 0) {
-+ return -1;
-+ }
-
-+ cmd->len = len;
- switch (dev->type) {
- case TYPE_TAPE:
- rc = scsi_req_stream_xfer(cmd, dev, buf);
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-1.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-1.patch
deleted file mode 100644
index 043d189..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-1.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 5e0c290415b9d57077a86e70c8e6a058868334d3 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Jul 2015 18:16:58 +0100
-Subject: [PATCH 1/7] rtl8139: avoid nested ifs in IP header parsing
-
-Transmit offload needs to parse packet headers. If header fields have
-unexpected values the offload processing is skipped.
-
-The code currently uses nested ifs because there is relatively little
-input validation. The next patches will add missing input validation
-and a goto label is more appropriate to avoid deep if statement nesting.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/rtl8139.c | 41 ++++++++++++++++++++++-------------------
- 1 file changed, 22 insertions(+), 19 deletions(-)
-
-diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index 5f0197c..91ba33b 100644
---- a/hw/net/rtl8139.c
-+++ b/hw/net/rtl8139.c
-@@ -2174,28 +2174,30 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
- size_t eth_payload_len = 0;
-
- int proto = be16_to_cpu(*(uint16_t *)(saved_buffer + 12));
-- if (proto == ETH_P_IP)
-+ if (proto != ETH_P_IP)
- {
-- DPRINTF("+++ C+ mode has IP packet\n");
--
-- /* not aligned */
-- eth_payload_data = saved_buffer + ETH_HLEN;
-- eth_payload_len = saved_size - ETH_HLEN;
--
-- ip = (ip_header*)eth_payload_data;
--
-- if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
-- DPRINTF("+++ C+ mode packet has bad IP version %d "
-- "expected %d\n", IP_HEADER_VERSION(ip),
-- IP_HEADER_VERSION_4);
-- ip = NULL;
-- } else {
-- hlen = IP_HEADER_LENGTH(ip);
-- ip_protocol = ip->ip_p;
-- ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
-- }
-+ goto skip_offload;
- }
-
-+ DPRINTF("+++ C+ mode has IP packet\n");
-+
-+ /* not aligned */
-+ eth_payload_data = saved_buffer + ETH_HLEN;
-+ eth_payload_len = saved_size - ETH_HLEN;
-+
-+ ip = (ip_header*)eth_payload_data;
-+
-+ if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
-+ DPRINTF("+++ C+ mode packet has bad IP version %d "
-+ "expected %d\n", IP_HEADER_VERSION(ip),
-+ IP_HEADER_VERSION_4);
-+ goto skip_offload;
-+ }
-+
-+ hlen = IP_HEADER_LENGTH(ip);
-+ ip_protocol = ip->ip_p;
-+ ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
-+
- if (ip)
- {
- if (txdw0 & CP_TX_IPCS)
-@@ -2391,6 +2393,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
- }
- }
-
-+skip_offload:
- /* update tally counter */
- ++s->tally_counters.TxOk;
-
---
-2.1.4
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-2.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-2.patch
deleted file mode 100644
index 7a76a8a..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-2.patch
+++ /dev/null
@@ -1,373 +0,0 @@
-From 2d7d80e8dc160904fa7276cc05da26c062a50066 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Jul 2015 18:16:59 +0100
-Subject: [PATCH 2/7] rtl8139: drop tautologous if (ip) {...} statement
-
-The previous patch stopped using the ip pointer as an indicator that the
-IP header is present. When we reach the if (ip) {...} statement we know
-ip is always non-NULL.
-
-Remove the if statement to reduce nesting.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/rtl8139.c | 305 +++++++++++++++++++++++++++----------------------------
- 1 file changed, 151 insertions(+), 154 deletions(-)
-
-diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index 91ba33b..2f12d42 100644
---- a/hw/net/rtl8139.c
-+++ b/hw/net/rtl8139.c
-@@ -2198,198 +2198,195 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
- ip_protocol = ip->ip_p;
- ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
-
-- if (ip)
-+ if (txdw0 & CP_TX_IPCS)
- {
-- if (txdw0 & CP_TX_IPCS)
-- {
-- DPRINTF("+++ C+ mode need IP checksum\n");
-+ DPRINTF("+++ C+ mode need IP checksum\n");
-
-- if (hlen<sizeof(ip_header) || hlen>eth_payload_len) {/* min header length */
-- /* bad packet header len */
-- /* or packet too short */
-- }
-- else
-- {
-- ip->ip_sum = 0;
-- ip->ip_sum = ip_checksum(ip, hlen);
-- DPRINTF("+++ C+ mode IP header len=%d checksum=%04x\n",
-- hlen, ip->ip_sum);
-- }
-+ if (hlen<sizeof(ip_header) || hlen>eth_payload_len) {/* min header length */
-+ /* bad packet header len */
-+ /* or packet too short */
- }
--
-- if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP)
-+ else
- {
-- int large_send_mss = (txdw0 >> 16) & CP_TC_LGSEN_MSS_MASK;
-+ ip->ip_sum = 0;
-+ ip->ip_sum = ip_checksum(ip, hlen);
-+ DPRINTF("+++ C+ mode IP header len=%d checksum=%04x\n",
-+ hlen, ip->ip_sum);
-+ }
-+ }
-
-- DPRINTF("+++ C+ mode offloaded task TSO MTU=%d IP data %d "
-- "frame data %d specified MSS=%d\n", ETH_MTU,
-- ip_data_len, saved_size - ETH_HLEN, large_send_mss);
-+ if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP)
-+ {
-+ int large_send_mss = (txdw0 >> 16) & CP_TC_LGSEN_MSS_MASK;
-
-- int tcp_send_offset = 0;
-- int send_count = 0;
-+ DPRINTF("+++ C+ mode offloaded task TSO MTU=%d IP data %d "
-+ "frame data %d specified MSS=%d\n", ETH_MTU,
-+ ip_data_len, saved_size - ETH_HLEN, large_send_mss);
-
-- /* maximum IP header length is 60 bytes */
-- uint8_t saved_ip_header[60];
-+ int tcp_send_offset = 0;
-+ int send_count = 0;
-
-- /* save IP header template; data area is used in tcp checksum calculation */
-- memcpy(saved_ip_header, eth_payload_data, hlen);
-+ /* maximum IP header length is 60 bytes */
-+ uint8_t saved_ip_header[60];
-
-- /* a placeholder for checksum calculation routine in tcp case */
-- uint8_t *data_to_checksum = eth_payload_data + hlen - 12;
-- // size_t data_to_checksum_len = eth_payload_len - hlen + 12;
-+ /* save IP header template; data area is used in tcp checksum calculation */
-+ memcpy(saved_ip_header, eth_payload_data, hlen);
-
-- /* pointer to TCP header */
-- tcp_header *p_tcp_hdr = (tcp_header*)(eth_payload_data + hlen);
-+ /* a placeholder for checksum calculation routine in tcp case */
-+ uint8_t *data_to_checksum = eth_payload_data + hlen - 12;
-+ // size_t data_to_checksum_len = eth_payload_len - hlen + 12;
-
-- int tcp_hlen = TCP_HEADER_DATA_OFFSET(p_tcp_hdr);
-+ /* pointer to TCP header */
-+ tcp_header *p_tcp_hdr = (tcp_header*)(eth_payload_data + hlen);
-
-- /* ETH_MTU = ip header len + tcp header len + payload */
-- int tcp_data_len = ip_data_len - tcp_hlen;
-- int tcp_chunk_size = ETH_MTU - hlen - tcp_hlen;
-+ int tcp_hlen = TCP_HEADER_DATA_OFFSET(p_tcp_hdr);
-
-- DPRINTF("+++ C+ mode TSO IP data len %d TCP hlen %d TCP "
-- "data len %d TCP chunk size %d\n", ip_data_len,
-- tcp_hlen, tcp_data_len, tcp_chunk_size);
-+ /* ETH_MTU = ip header len + tcp header len + payload */
-+ int tcp_data_len = ip_data_len - tcp_hlen;
-+ int tcp_chunk_size = ETH_MTU - hlen - tcp_hlen;
-
-- /* note the cycle below overwrites IP header data,
-- but restores it from saved_ip_header before sending packet */
-+ DPRINTF("+++ C+ mode TSO IP data len %d TCP hlen %d TCP "
-+ "data len %d TCP chunk size %d\n", ip_data_len,
-+ tcp_hlen, tcp_data_len, tcp_chunk_size);
-
-- int is_last_frame = 0;
-+ /* note the cycle below overwrites IP header data,
-+ but restores it from saved_ip_header before sending packet */
-
-- for (tcp_send_offset = 0; tcp_send_offset < tcp_data_len; tcp_send_offset += tcp_chunk_size)
-- {
-- uint16_t chunk_size = tcp_chunk_size;
--
-- /* check if this is the last frame */
-- if (tcp_send_offset + tcp_chunk_size >= tcp_data_len)
-- {
-- is_last_frame = 1;
-- chunk_size = tcp_data_len - tcp_send_offset;
-- }
--
-- DPRINTF("+++ C+ mode TSO TCP seqno %08x\n",
-- be32_to_cpu(p_tcp_hdr->th_seq));
--
-- /* add 4 TCP pseudoheader fields */
-- /* copy IP source and destination fields */
-- memcpy(data_to_checksum, saved_ip_header + 12, 8);
--
-- DPRINTF("+++ C+ mode TSO calculating TCP checksum for "
-- "packet with %d bytes data\n", tcp_hlen +
-- chunk_size);
--
-- if (tcp_send_offset)
-- {
-- memcpy((uint8_t*)p_tcp_hdr + tcp_hlen, (uint8_t*)p_tcp_hdr + tcp_hlen + tcp_send_offset, chunk_size);
-- }
--
-- /* keep PUSH and FIN flags only for the last frame */
-- if (!is_last_frame)
-- {
-- TCP_HEADER_CLEAR_FLAGS(p_tcp_hdr, TCP_FLAG_PUSH|TCP_FLAG_FIN);
-- }
--
-- /* recalculate TCP checksum */
-- ip_pseudo_header *p_tcpip_hdr = (ip_pseudo_header *)data_to_checksum;
-- p_tcpip_hdr->zeros = 0;
-- p_tcpip_hdr->ip_proto = IP_PROTO_TCP;
-- p_tcpip_hdr->ip_payload = cpu_to_be16(tcp_hlen + chunk_size);
--
-- p_tcp_hdr->th_sum = 0;
--
-- int tcp_checksum = ip_checksum(data_to_checksum, tcp_hlen + chunk_size + 12);
-- DPRINTF("+++ C+ mode TSO TCP checksum %04x\n",
-- tcp_checksum);
--
-- p_tcp_hdr->th_sum = tcp_checksum;
--
-- /* restore IP header */
-- memcpy(eth_payload_data, saved_ip_header, hlen);
--
-- /* set IP data length and recalculate IP checksum */
-- ip->ip_len = cpu_to_be16(hlen + tcp_hlen + chunk_size);
--
-- /* increment IP id for subsequent frames */
-- ip->ip_id = cpu_to_be16(tcp_send_offset/tcp_chunk_size + be16_to_cpu(ip->ip_id));
--
-- ip->ip_sum = 0;
-- ip->ip_sum = ip_checksum(eth_payload_data, hlen);
-- DPRINTF("+++ C+ mode TSO IP header len=%d "
-- "checksum=%04x\n", hlen, ip->ip_sum);
--
-- int tso_send_size = ETH_HLEN + hlen + tcp_hlen + chunk_size;
-- DPRINTF("+++ C+ mode TSO transferring packet size "
-- "%d\n", tso_send_size);
-- rtl8139_transfer_frame(s, saved_buffer, tso_send_size,
-- 0, (uint8_t *) dot1q_buffer);
--
-- /* add transferred count to TCP sequence number */
-- p_tcp_hdr->th_seq = cpu_to_be32(chunk_size + be32_to_cpu(p_tcp_hdr->th_seq));
-- ++send_count;
-- }
-+ int is_last_frame = 0;
-
-- /* Stop sending this frame */
-- saved_size = 0;
-- }
-- else if (txdw0 & (CP_TX_TCPCS|CP_TX_UDPCS))
-+ for (tcp_send_offset = 0; tcp_send_offset < tcp_data_len; tcp_send_offset += tcp_chunk_size)
- {
-- DPRINTF("+++ C+ mode need TCP or UDP checksum\n");
-+ uint16_t chunk_size = tcp_chunk_size;
-
-- /* maximum IP header length is 60 bytes */
-- uint8_t saved_ip_header[60];
-- memcpy(saved_ip_header, eth_payload_data, hlen);
-+ /* check if this is the last frame */
-+ if (tcp_send_offset + tcp_chunk_size >= tcp_data_len)
-+ {
-+ is_last_frame = 1;
-+ chunk_size = tcp_data_len - tcp_send_offset;
-+ }
-
-- uint8_t *data_to_checksum = eth_payload_data + hlen - 12;
-- // size_t data_to_checksum_len = eth_payload_len - hlen + 12;
-+ DPRINTF("+++ C+ mode TSO TCP seqno %08x\n",
-+ be32_to_cpu(p_tcp_hdr->th_seq));
-
- /* add 4 TCP pseudoheader fields */
- /* copy IP source and destination fields */
- memcpy(data_to_checksum, saved_ip_header + 12, 8);
-
-- if ((txdw0 & CP_TX_TCPCS) && ip_protocol == IP_PROTO_TCP)
-+ DPRINTF("+++ C+ mode TSO calculating TCP checksum for "
-+ "packet with %d bytes data\n", tcp_hlen +
-+ chunk_size);
-+
-+ if (tcp_send_offset)
- {
-- DPRINTF("+++ C+ mode calculating TCP checksum for "
-- "packet with %d bytes data\n", ip_data_len);
-+ memcpy((uint8_t*)p_tcp_hdr + tcp_hlen, (uint8_t*)p_tcp_hdr + tcp_hlen + tcp_send_offset, chunk_size);
-+ }
-
-- ip_pseudo_header *p_tcpip_hdr = (ip_pseudo_header *)data_to_checksum;
-- p_tcpip_hdr->zeros = 0;
-- p_tcpip_hdr->ip_proto = IP_PROTO_TCP;
-- p_tcpip_hdr->ip_payload = cpu_to_be16(ip_data_len);
-+ /* keep PUSH and FIN flags only for the last frame */
-+ if (!is_last_frame)
-+ {
-+ TCP_HEADER_CLEAR_FLAGS(p_tcp_hdr, TCP_FLAG_PUSH|TCP_FLAG_FIN);
-+ }
-
-- tcp_header* p_tcp_hdr = (tcp_header *) (data_to_checksum+12);
-+ /* recalculate TCP checksum */
-+ ip_pseudo_header *p_tcpip_hdr = (ip_pseudo_header *)data_to_checksum;
-+ p_tcpip_hdr->zeros = 0;
-+ p_tcpip_hdr->ip_proto = IP_PROTO_TCP;
-+ p_tcpip_hdr->ip_payload = cpu_to_be16(tcp_hlen + chunk_size);
-
-- p_tcp_hdr->th_sum = 0;
-+ p_tcp_hdr->th_sum = 0;
-
-- int tcp_checksum = ip_checksum(data_to_checksum, ip_data_len + 12);
-- DPRINTF("+++ C+ mode TCP checksum %04x\n",
-- tcp_checksum);
-+ int tcp_checksum = ip_checksum(data_to_checksum, tcp_hlen + chunk_size + 12);
-+ DPRINTF("+++ C+ mode TSO TCP checksum %04x\n",
-+ tcp_checksum);
-
-- p_tcp_hdr->th_sum = tcp_checksum;
-- }
-- else if ((txdw0 & CP_TX_UDPCS) && ip_protocol == IP_PROTO_UDP)
-- {
-- DPRINTF("+++ C+ mode calculating UDP checksum for "
-- "packet with %d bytes data\n", ip_data_len);
-+ p_tcp_hdr->th_sum = tcp_checksum;
-
-- ip_pseudo_header *p_udpip_hdr = (ip_pseudo_header *)data_to_checksum;
-- p_udpip_hdr->zeros = 0;
-- p_udpip_hdr->ip_proto = IP_PROTO_UDP;
-- p_udpip_hdr->ip_payload = cpu_to_be16(ip_data_len);
-+ /* restore IP header */
-+ memcpy(eth_payload_data, saved_ip_header, hlen);
-
-- udp_header *p_udp_hdr = (udp_header *) (data_to_checksum+12);
-+ /* set IP data length and recalculate IP checksum */
-+ ip->ip_len = cpu_to_be16(hlen + tcp_hlen + chunk_size);
-
-- p_udp_hdr->uh_sum = 0;
-+ /* increment IP id for subsequent frames */
-+ ip->ip_id = cpu_to_be16(tcp_send_offset/tcp_chunk_size + be16_to_cpu(ip->ip_id));
-
-- int udp_checksum = ip_checksum(data_to_checksum, ip_data_len + 12);
-- DPRINTF("+++ C+ mode UDP checksum %04x\n",
-- udp_checksum);
-+ ip->ip_sum = 0;
-+ ip->ip_sum = ip_checksum(eth_payload_data, hlen);
-+ DPRINTF("+++ C+ mode TSO IP header len=%d "
-+ "checksum=%04x\n", hlen, ip->ip_sum);
-
-- p_udp_hdr->uh_sum = udp_checksum;
-- }
-+ int tso_send_size = ETH_HLEN + hlen + tcp_hlen + chunk_size;
-+ DPRINTF("+++ C+ mode TSO transferring packet size "
-+ "%d\n", tso_send_size);
-+ rtl8139_transfer_frame(s, saved_buffer, tso_send_size,
-+ 0, (uint8_t *) dot1q_buffer);
-
-- /* restore IP header */
-- memcpy(eth_payload_data, saved_ip_header, hlen);
-+ /* add transferred count to TCP sequence number */
-+ p_tcp_hdr->th_seq = cpu_to_be32(chunk_size + be32_to_cpu(p_tcp_hdr->th_seq));
-+ ++send_count;
- }
-+
-+ /* Stop sending this frame */
-+ saved_size = 0;
-+ }
-+ else if (txdw0 & (CP_TX_TCPCS|CP_TX_UDPCS))
-+ {
-+ DPRINTF("+++ C+ mode need TCP or UDP checksum\n");
-+
-+ /* maximum IP header length is 60 bytes */
-+ uint8_t saved_ip_header[60];
-+ memcpy(saved_ip_header, eth_payload_data, hlen);
-+
-+ uint8_t *data_to_checksum = eth_payload_data + hlen - 12;
-+ // size_t data_to_checksum_len = eth_payload_len - hlen + 12;
-+
-+ /* add 4 TCP pseudoheader fields */
-+ /* copy IP source and destination fields */
-+ memcpy(data_to_checksum, saved_ip_header + 12, 8);
-+
-+ if ((txdw0 & CP_TX_TCPCS) && ip_protocol == IP_PROTO_TCP)
-+ {
-+ DPRINTF("+++ C+ mode calculating TCP checksum for "
-+ "packet with %d bytes data\n", ip_data_len);
-+
-+ ip_pseudo_header *p_tcpip_hdr = (ip_pseudo_header *)data_to_checksum;
-+ p_tcpip_hdr->zeros = 0;
-+ p_tcpip_hdr->ip_proto = IP_PROTO_TCP;
-+ p_tcpip_hdr->ip_payload = cpu_to_be16(ip_data_len);
-+
-+ tcp_header* p_tcp_hdr = (tcp_header *) (data_to_checksum+12);
-+
-+ p_tcp_hdr->th_sum = 0;
-+
-+ int tcp_checksum = ip_checksum(data_to_checksum, ip_data_len + 12);
-+ DPRINTF("+++ C+ mode TCP checksum %04x\n",
-+ tcp_checksum);
-+
-+ p_tcp_hdr->th_sum = tcp_checksum;
-+ }
-+ else if ((txdw0 & CP_TX_UDPCS) && ip_protocol == IP_PROTO_UDP)
-+ {
-+ DPRINTF("+++ C+ mode calculating UDP checksum for "
-+ "packet with %d bytes data\n", ip_data_len);
-+
-+ ip_pseudo_header *p_udpip_hdr = (ip_pseudo_header *)data_to_checksum;
-+ p_udpip_hdr->zeros = 0;
-+ p_udpip_hdr->ip_proto = IP_PROTO_UDP;
-+ p_udpip_hdr->ip_payload = cpu_to_be16(ip_data_len);
-+
-+ udp_header *p_udp_hdr = (udp_header *) (data_to_checksum+12);
-+
-+ p_udp_hdr->uh_sum = 0;
-+
-+ int udp_checksum = ip_checksum(data_to_checksum, ip_data_len + 12);
-+ DPRINTF("+++ C+ mode UDP checksum %04x\n",
-+ udp_checksum);
-+
-+ p_udp_hdr->uh_sum = udp_checksum;
-+ }
-+
-+ /* restore IP header */
-+ memcpy(eth_payload_data, saved_ip_header, hlen);
- }
- }
-
---
-2.1.4
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-3.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-3.patch
deleted file mode 100644
index 5676f46..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-3.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 043d28507ef7c5fdc34866f5e3b27a72bd0cd072 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Jul 2015 18:17:00 +0100
-Subject: [PATCH 3/7] rtl8139: skip offload on short Ethernet/IP header
-
-Transmit offload features access Ethernet and IP headers the packet. If
-the packet is too short we must not attempt to access header fields:
-
- int proto = be16_to_cpu(*(uint16_t *)(saved_buffer + 12));
- ...
- eth_payload_data = saved_buffer + ETH_HLEN;
- ...
- ip = (ip_header*)eth_payload_data;
- if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/rtl8139.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index 2f12d42..d377b6b 100644
---- a/hw/net/rtl8139.c
-+++ b/hw/net/rtl8139.c
-@@ -2164,6 +2164,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
- {
- DPRINTF("+++ C+ mode offloaded task checksum\n");
-
-+ /* Large enough for Ethernet and IP headers? */
-+ if (saved_size < ETH_HLEN + sizeof(ip_header)) {
-+ goto skip_offload;
-+ }
-+
- /* ip packet header */
- ip_header *ip = NULL;
- int hlen = 0;
---
-2.1.4
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-4.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-4.patch
deleted file mode 100644
index 495d8d6..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-4.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 5a75d242fe019d05b46ef9bc330a6892525c84a7 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Jul 2015 18:17:01 +0100
-Subject: [PATCH 4/7] rtl8139: check IP Header Length field
-
-The IP Header Length field was only checked in the IP checksum case, but
-is used in other cases too.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/rtl8139.c | 19 ++++++++-----------
- 1 file changed, 8 insertions(+), 11 deletions(-)
-
-diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index d377b6b..cd5ac05 100644
---- a/hw/net/rtl8139.c
-+++ b/hw/net/rtl8139.c
-@@ -2200,6 +2200,10 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
- }
-
- hlen = IP_HEADER_LENGTH(ip);
-+ if (hlen < sizeof(ip_header) || hlen > eth_payload_len) {
-+ goto skip_offload;
-+ }
-+
- ip_protocol = ip->ip_p;
- ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
-
-@@ -2207,17 +2211,10 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
- {
- DPRINTF("+++ C+ mode need IP checksum\n");
-
-- if (hlen<sizeof(ip_header) || hlen>eth_payload_len) {/* min header length */
-- /* bad packet header len */
-- /* or packet too short */
-- }
-- else
-- {
-- ip->ip_sum = 0;
-- ip->ip_sum = ip_checksum(ip, hlen);
-- DPRINTF("+++ C+ mode IP header len=%d checksum=%04x\n",
-- hlen, ip->ip_sum);
-- }
-+ ip->ip_sum = 0;
-+ ip->ip_sum = ip_checksum(ip, hlen);
-+ DPRINTF("+++ C+ mode IP header len=%d checksum=%04x\n",
-+ hlen, ip->ip_sum);
- }
-
- if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP)
---
-2.1.4
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-5.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-5.patch
deleted file mode 100644
index e633ea6..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-5.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 6c79ea275d72bc1fd88bdcf1e7d231b2c9c865de Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Jul 2015 18:17:02 +0100
-Subject: [PATCH 5/7] rtl8139: check IP Total Length field
-
-The IP Total Length field includes the IP header and data. Make sure it
-is valid and does not exceed the Ethernet payload size.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/rtl8139.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index cd5ac05..ed2b23b 100644
---- a/hw/net/rtl8139.c
-+++ b/hw/net/rtl8139.c
-@@ -2205,7 +2205,12 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
- }
-
- ip_protocol = ip->ip_p;
-- ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
-+
-+ ip_data_len = be16_to_cpu(ip->ip_len);
-+ if (ip_data_len < hlen || ip_data_len > eth_payload_len) {
-+ goto skip_offload;
-+ }
-+ ip_data_len -= hlen;
-
- if (txdw0 & CP_TX_IPCS)
- {
---
-2.1.4
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-6.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-6.patch
deleted file mode 100644
index dd716a6..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-6.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 30aa7be430e7c982e9163f3bcc745d3aa57b6aa4 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Jul 2015 18:17:03 +0100
-Subject: [PATCH 6/7] rtl8139: skip offload on short TCP header
-
-TCP Large Segment Offload accesses the TCP header in the packet. If the
-packet is too short we must not attempt to access header fields:
-
- tcp_header *p_tcp_hdr = (tcp_header*)(eth_payload_data + hlen);
- int tcp_hlen = TCP_HEADER_DATA_OFFSET(p_tcp_hdr);
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/rtl8139.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index ed2b23b..c8f0df9 100644
---- a/hw/net/rtl8139.c
-+++ b/hw/net/rtl8139.c
-@@ -2224,6 +2224,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
-
- if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP)
- {
-+ /* Large enough for the TCP header? */
-+ if (ip_data_len < sizeof(tcp_header)) {
-+ goto skip_offload;
-+ }
-+
- int large_send_mss = (txdw0 >> 16) & CP_TC_LGSEN_MSS_MASK;
-
- DPRINTF("+++ C+ mode offloaded task TSO MTU=%d IP data %d "
---
-2.1.4
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-7.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-7.patch
deleted file mode 100644
index 4c0ad79..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-7.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 9a084807bf6ca7c16d997a236d304111894a6539 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Jul 2015 18:17:04 +0100
-Subject: [PATCH 7/7] rtl8139: check TCP Data Offset field
-
-The TCP Data Offset field contains the length of the header. Make sure
-it is valid and does not exceed the IP data length.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/rtl8139.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index c8f0df9..2df4a51 100644
---- a/hw/net/rtl8139.c
-+++ b/hw/net/rtl8139.c
-@@ -2253,6 +2253,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
-
- int tcp_hlen = TCP_HEADER_DATA_OFFSET(p_tcp_hdr);
-
-+ /* Invalid TCP data offset? */
-+ if (tcp_hlen < sizeof(tcp_header) || tcp_hlen > ip_data_len) {
-+ goto skip_offload;
-+ }
-+
- /* ETH_MTU = ip header len + tcp header len + payload */
- int tcp_data_len = ip_data_len - tcp_hlen;
- int tcp_chunk_size = ETH_MTU - hlen - tcp_hlen;
---
-2.1.4
-
diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5166.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5166.patch
deleted file mode 100644
index fc41d7b..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5166.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
-
-Fix release_drive on unplugged devices (pci_piix3_xen_ide_unplug)
-
-pci_piix3_xen_ide_unplug should completely unhook the unplugged
-IDEDevice from the corresponding BlockBackend, otherwise the next call
-to release_drive will try to detach the drive again.
-
-Suggested-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
-
-diff --git a/hw/ide/piix.c b/hw/ide/piix.c
-index adb6649..5a26c86 100644
---- a/hw/ide/piix.c
-+++ b/hw/ide/piix.c
-@@ -169,6 +169,7 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
- PCIIDEState *pci_ide;
- DriveInfo *di;
- int i;
-+ IDEDevice *idedev;
-
- pci_ide = PCI_IDE(dev);
-
-@@ -181,6 +182,12 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
- blk_detach_dev(blk, ds);
- }
- pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;
-+ if (!(i % 2)) {
-+ idedev = pci_ide->bus[di->bus].master;
-+ } else {
-+ idedev = pci_ide->bus[di->bus].slave;
-+ }
-+ idedev->conf.blk = NULL;
- blk_unref(blk);
- }
- }
diff --git a/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch b/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch
deleted file mode 100644
index d84797f..0000000
--- a/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-https://bugs.gentoo.org/557206
-
-From 7882080388be5088e72c425b02223c02e6cb4295 Mon Sep 17 00:00:00 2001
-From: "Michael S. Tsirkin" <mst@redhat.com>
-Date: Thu, 23 Jul 2015 17:52:02 +0300
-Subject: [PATCH] virtio-serial: fix ANY_LAYOUT
-
-Don't assume a specific layout for control messages.
-Required by virtio 1.
-
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Reviewed-by: Amit Shah <amit.shah@redhat.com>
-Reviewed-by: Jason Wang <jasowang@redhat.com>
----
- hw/char/virtio-serial-bus.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
-index 78c73e5..929e49c 100644
---- a/hw/char/virtio-serial-bus.c
-+++ b/hw/char/virtio-serial-bus.c
-@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
- return 0;
- }
-
-- memcpy(elem.in_sg[0].iov_base, buf, len);
-+ /* TODO: detect a buffer that's too short, set NEEDS_RESET */
-+ iov_from_buf(elem.in_sg, elem.in_num, 0, buf, len);
-
- virtqueue_push(vq, &elem, len);
- virtio_notify(VIRTIO_DEVICE(vser), vq);
---
-2.4.4
-
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch
deleted file mode 100644
index de7090d..0000000
--- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-https://bugs.gentoo.org/558416
-
-fix from upstream git
-
-From eb8934b0418b3b1d125edddc4fc334a54334a49b Mon Sep 17 00:00:00 2001
-From: Gerd Hoffmann <kraxel@redhat.com>
-Date: Mon, 17 Aug 2015 19:56:53 +0200
-Subject: [PATCH] vnc: fix memory corruption (CVE-2015-5225)
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The _cmp_bytes variable added by commit "bea60dd ui/vnc: fix potential
-memory corruption issues" can become negative. Result is (possibly
-exploitable) memory corruption. Reason for that is it uses the stride
-instead of bytes per scanline to apply limits.
-
-For the server surface is is actually fine. vnc creates that itself,
-there is never any padding and thus scanline length always equals stride.
-
-For the guest surface scanline length and stride are typically identical
-too, but it doesn't has to be that way. So add and use a new variable
-(guest_ll) for the guest scanline length. Also rename min_stride to
-line_bytes to make more clear what it actually is. Finally sprinkle
-in an assert() to make sure we never use a negative _cmp_bytes again.
-
-Reported-by: 范祚至(库特) <zuozhi.fzz@alibaba-inc.com>
-Reviewed-by: P J P <ppandit@redhat.com>
-Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
----
- ui/vnc.c | 15 ++++++++++-----
- 1 file changed, 10 insertions(+), 5 deletions(-)
-
-diff --git a/ui/vnc.c b/ui/vnc.c
-index e26973a..caf82f5 100644
---- a/ui/vnc.c
-+++ b/ui/vnc.c
-@@ -2872,7 +2872,7 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
- pixman_image_get_width(vd->server));
- int height = MIN(pixman_image_get_height(vd->guest.fb),
- pixman_image_get_height(vd->server));
-- int cmp_bytes, server_stride, min_stride, guest_stride, y = 0;
-+ int cmp_bytes, server_stride, line_bytes, guest_ll, guest_stride, y = 0;
- uint8_t *guest_row0 = NULL, *server_row0;
- VncState *vs;
- int has_dirty = 0;
-@@ -2891,17 +2891,21 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
- * Update server dirty map.
- */
- server_row0 = (uint8_t *)pixman_image_get_data(vd->server);
-- server_stride = guest_stride = pixman_image_get_stride(vd->server);
-+ server_stride = guest_stride = guest_ll =
-+ pixman_image_get_stride(vd->server);
- cmp_bytes = MIN(VNC_DIRTY_PIXELS_PER_BIT * VNC_SERVER_FB_BYTES,
- server_stride);
- if (vd->guest.format != VNC_SERVER_FB_FORMAT) {
- int width = pixman_image_get_width(vd->server);
- tmpbuf = qemu_pixman_linebuf_create(VNC_SERVER_FB_FORMAT, width);
- } else {
-+ int guest_bpp =
-+ PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
- guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
- guest_stride = pixman_image_get_stride(vd->guest.fb);
-+ guest_ll = pixman_image_get_width(vd->guest.fb) * ((guest_bpp + 7) / 8);
- }
-- min_stride = MIN(server_stride, guest_stride);
-+ line_bytes = MIN(server_stride, guest_ll);
-
- for (;;) {
- int x;
-@@ -2932,9 +2936,10 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
- if (!test_and_clear_bit(x, vd->guest.dirty[y])) {
- continue;
- }
-- if ((x + 1) * cmp_bytes > min_stride) {
-- _cmp_bytes = min_stride - x * cmp_bytes;
-+ if ((x + 1) * cmp_bytes > line_bytes) {
-+ _cmp_bytes = line_bytes - x * cmp_bytes;
- }
-+ assert(_cmp_bytes >= 0);
- if (memcmp(server_ptr, guest_ptr, _cmp_bytes) == 0) {
- continue;
- }
---
-2.5.0
-
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch
deleted file mode 100644
index 69dd66a..0000000
--- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-https://bugs.gentoo.org/560422
-
-From d9033e1d3aa666c5071580617a57bd853c5d794a Mon Sep 17 00:00:00 2001
-From: John Snow <jsnow@redhat.com>
-Date: Thu, 17 Sep 2015 14:17:05 -0400
-Subject: [PATCH] ide: fix ATAPI command permissions
-
-We're a little too lenient with what we'll let an ATAPI drive handle.
-Clamp down on the IDE command execution table to remove CD_OK permissions
-from commands that are not and have never been ATAPI commands.
-
-For ATAPI command validity, please see:
-- ATA4 Section 6.5 ("PACKET Command feature set")
-- ATA8/ACS Section 4.3 ("The PACKET feature set")
-- ACS3 Section 4.3 ("The PACKET feature set")
-
-ACS3 has a historical command validity table in Table B.4
-("Historical Command Assignments") that can be referenced to find when
-a command was introduced, deprecated, obsoleted, etc.
-
-The only reference for ATAPI command validity is by checking that
-version's PACKET feature set section.
-
-ATAPI was introduced by T13 into ATA4, all commands retired prior to ATA4
-therefore are assumed to have never been ATAPI commands.
-
-Mandatory commands, as listed in ATA8-ACS3, are:
-
-- DEVICE RESET
-- EXECUTE DEVICE DIAGNOSTIC
-- IDENTIFY DEVICE
-- IDENTIFY PACKET DEVICE
-- NOP
-- PACKET
-- READ SECTOR(S)
-- SET FEATURES
-
-Optional commands as listed in ATA8-ACS3, are:
-
-- FLUSH CACHE
-- READ LOG DMA EXT
-- READ LOG EXT
-- WRITE LOG DMA EXT
-- WRITE LOG EXT
-
-All other commands are illegal to send to an ATAPI device and should
-be rejected by the device.
-
-CD_OK removal justifications:
-
-0x06 WIN_DSM Defined in ACS2. Not valid for ATAPI.
-0x21 WIN_READ_ONCE Retired in ATA5. Not ATAPI in ATA4.
-0x94 WIN_STANDBYNOW2 Retired in ATA4. Did not coexist with ATAPI.
-0x95 WIN_IDLEIMMEDIATE2 Retired in ATA4. Did not coexist with ATAPI.
-0x96 WIN_STANDBY2 Retired in ATA4. Did not coexist with ATAPI.
-0x97 WIN_SETIDLE2 Retired in ATA4. Did not coexist with ATAPI.
-0x98 WIN_CHECKPOWERMODE2 Retired in ATA4. Did not coexist with ATAPI.
-0x99 WIN_SLEEPNOW2 Retired in ATA4. Did not coexist with ATAPI.
-0xE0 WIN_STANDBYNOW1 Not part of ATAPI in ATA4, ACS or ACS3.
-0xE1 WIN_IDLEIMMDIATE Not part of ATAPI in ATA4, ACS or ACS3.
-0xE2 WIN_STANDBY Not part of ATAPI in ATA4, ACS or ACS3.
-0xE3 WIN_SETIDLE1 Not part of ATAPI in ATA4, ACS or ACS3.
-0xE4 WIN_CHECKPOWERMODE1 Not part of ATAPI in ATA4, ACS or ACS3.
-0xE5 WIN_SLEEPNOW1 Not part of ATAPI in ATA4, ACS or ACS3.
-0xF8 WIN_READ_NATIVE_MAX Obsoleted in ACS3. Not ATAPI in ATA4 or ACS.
-
-This patch fixes a divide by zero fault that can be caused by sending
-the WIN_READ_NATIVE_MAX command to an ATAPI drive, which causes it to
-attempt to use zeroed CHS values to perform sector arithmetic.
-
-Reported-by: Qinghao Tang <luodalongde@gmail.com>
-Signed-off-by: John Snow <jsnow@redhat.com>
-Reviewed-by: Markus Armbruster <armbru@redhat.com>
-Message-id: 1441816082-21031-1-git-send-email-jsnow@redhat.com
-CC: qemu-stable@nongnu.org
----
- hw/ide/core.c | 30 +++++++++++++++---------------
- 1 file changed, 15 insertions(+), 15 deletions(-)
-
-diff --git a/hw/ide/core.c b/hw/ide/core.c
-index 8ba04df..1cc6945 100644
---- a/hw/ide/core.c
-+++ b/hw/ide/core.c
-@@ -1746,11 +1746,11 @@ static const struct {
- } ide_cmd_table[0x100] = {
- /* NOP not implemented, mandatory for CD */
- [CFA_REQ_EXT_ERROR_CODE] = { cmd_cfa_req_ext_error_code, CFA_OK },
-- [WIN_DSM] = { cmd_data_set_management, ALL_OK },
-+ [WIN_DSM] = { cmd_data_set_management, HD_CFA_OK },
- [WIN_DEVICE_RESET] = { cmd_device_reset, CD_OK },
- [WIN_RECAL] = { cmd_nop, HD_CFA_OK | SET_DSC},
- [WIN_READ] = { cmd_read_pio, ALL_OK },
-- [WIN_READ_ONCE] = { cmd_read_pio, ALL_OK },
-+ [WIN_READ_ONCE] = { cmd_read_pio, HD_CFA_OK },
- [WIN_READ_EXT] = { cmd_read_pio, HD_CFA_OK },
- [WIN_READDMA_EXT] = { cmd_read_dma, HD_CFA_OK },
- [WIN_READ_NATIVE_MAX_EXT] = { cmd_read_native_max, HD_CFA_OK | SET_DSC },
-@@ -1769,12 +1769,12 @@ static const struct {
- [CFA_TRANSLATE_SECTOR] = { cmd_cfa_translate_sector, CFA_OK },
- [WIN_DIAGNOSE] = { cmd_exec_dev_diagnostic, ALL_OK },
- [WIN_SPECIFY] = { cmd_nop, HD_CFA_OK | SET_DSC },
-- [WIN_STANDBYNOW2] = { cmd_nop, ALL_OK },
-- [WIN_IDLEIMMEDIATE2] = { cmd_nop, ALL_OK },
-- [WIN_STANDBY2] = { cmd_nop, ALL_OK },
-- [WIN_SETIDLE2] = { cmd_nop, ALL_OK },
-- [WIN_CHECKPOWERMODE2] = { cmd_check_power_mode, ALL_OK | SET_DSC },
-- [WIN_SLEEPNOW2] = { cmd_nop, ALL_OK },
-+ [WIN_STANDBYNOW2] = { cmd_nop, HD_CFA_OK },
-+ [WIN_IDLEIMMEDIATE2] = { cmd_nop, HD_CFA_OK },
-+ [WIN_STANDBY2] = { cmd_nop, HD_CFA_OK },
-+ [WIN_SETIDLE2] = { cmd_nop, HD_CFA_OK },
-+ [WIN_CHECKPOWERMODE2] = { cmd_check_power_mode, HD_CFA_OK | SET_DSC },
-+ [WIN_SLEEPNOW2] = { cmd_nop, HD_CFA_OK },
- [WIN_PACKETCMD] = { cmd_packet, CD_OK },
- [WIN_PIDENTIFY] = { cmd_identify_packet, CD_OK },
- [WIN_SMART] = { cmd_smart, HD_CFA_OK | SET_DSC },
-@@ -1788,19 +1788,19 @@ static const struct {
- [WIN_WRITEDMA] = { cmd_write_dma, HD_CFA_OK },
- [WIN_WRITEDMA_ONCE] = { cmd_write_dma, HD_CFA_OK },
- [CFA_WRITE_MULTI_WO_ERASE] = { cmd_write_multiple, CFA_OK },
-- [WIN_STANDBYNOW1] = { cmd_nop, ALL_OK },
-- [WIN_IDLEIMMEDIATE] = { cmd_nop, ALL_OK },
-- [WIN_STANDBY] = { cmd_nop, ALL_OK },
-- [WIN_SETIDLE1] = { cmd_nop, ALL_OK },
-- [WIN_CHECKPOWERMODE1] = { cmd_check_power_mode, ALL_OK | SET_DSC },
-- [WIN_SLEEPNOW1] = { cmd_nop, ALL_OK },
-+ [WIN_STANDBYNOW1] = { cmd_nop, HD_CFA_OK },
-+ [WIN_IDLEIMMEDIATE] = { cmd_nop, HD_CFA_OK },
-+ [WIN_STANDBY] = { cmd_nop, HD_CFA_OK },
-+ [WIN_SETIDLE1] = { cmd_nop, HD_CFA_OK },
-+ [WIN_CHECKPOWERMODE1] = { cmd_check_power_mode, HD_CFA_OK | SET_DSC },
-+ [WIN_SLEEPNOW1] = { cmd_nop, HD_CFA_OK },
- [WIN_FLUSH_CACHE] = { cmd_flush_cache, ALL_OK },
- [WIN_FLUSH_CACHE_EXT] = { cmd_flush_cache, HD_CFA_OK },
- [WIN_IDENTIFY] = { cmd_identify, ALL_OK },
- [WIN_SETFEATURES] = { cmd_set_features, ALL_OK | SET_DSC },
- [IBM_SENSE_CONDITION] = { cmd_ibm_sense_condition, CFA_OK | SET_DSC },
- [CFA_WEAR_LEVEL] = { cmd_cfa_erase_sectors, HD_CFA_OK | SET_DSC },
-- [WIN_READ_NATIVE_MAX] = { cmd_read_native_max, ALL_OK | SET_DSC },
-+ [WIN_READ_NATIVE_MAX] = { cmd_read_native_max, HD_CFA_OK | SET_DSC },
- };
-
- static bool ide_cmd_permitted(IDEState *s, uint32_t cmd)
---
-2.6.0.rc2.230.g3dd15c0
-
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch
deleted file mode 100644
index 4ee46e1..0000000
--- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-https://bugs.gentoo.org/560760
-
-From ce317461573bac12b10d67699b4ddf1f97cf066c Mon Sep 17 00:00:00 2001
-From: Jason Wang <jasowang@redhat.com>
-Date: Fri, 25 Sep 2015 13:21:28 +0800
-Subject: [PATCH 1/3] virtio: introduce virtqueue_unmap_sg()
-
-Factor out sg unmapping logic. This will be reused by the patch that
-can discard descriptor.
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Cc: Andrew James <andrew.james@hpe.com>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----
- hw/virtio/virtio.c | 14 ++++++++++----
- 1 file changed, 10 insertions(+), 4 deletions(-)
-
-diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
-index 7504f8b..6f2b96c 100644
---- a/hw/virtio/virtio.c
-+++ b/hw/virtio/virtio.c
-@@ -244,14 +244,12 @@ int virtio_queue_empty(VirtQueue *vq)
- return vring_avail_idx(vq) == vq->last_avail_idx;
- }
-
--void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
-- unsigned int len, unsigned int idx)
-+static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem,
-+ unsigned int len)
- {
- unsigned int offset;
- int i;
-
-- trace_virtqueue_fill(vq, elem, len, idx);
--
- offset = 0;
- for (i = 0; i < elem->in_num; i++) {
- size_t size = MIN(len - offset, elem->in_sg[i].iov_len);
-@@ -267,6 +265,14 @@ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
- cpu_physical_memory_unmap(elem->out_sg[i].iov_base,
- elem->out_sg[i].iov_len,
- 0, elem->out_sg[i].iov_len);
-+}
-+
-+void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
-+ unsigned int len, unsigned int idx)
-+{
-+ trace_virtqueue_fill(vq, elem, len, idx);
-+
-+ virtqueue_unmap_sg(vq, elem, len);
-
- idx = (idx + vring_used_idx(vq)) % vq->vring.num;
-
---
-2.6.0.rc2.230.g3dd15c0
-
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch
deleted file mode 100644
index 8c73fcb..0000000
--- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-https://bugs.gentoo.org/560760
-
-From 29b9f5efd78ae0f9cc02dd169b6e80d2c404bade Mon Sep 17 00:00:00 2001
-From: Jason Wang <jasowang@redhat.com>
-Date: Fri, 25 Sep 2015 13:21:29 +0800
-Subject: [PATCH 2/3] virtio: introduce virtqueue_discard()
-
-This patch introduces virtqueue_discard() to discard a descriptor and
-unmap the sgs. This will be used by the patch that will discard
-descriptor when packet is truncated.
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----
- hw/virtio/virtio.c | 7 +++++++
- include/hw/virtio/virtio.h | 2 ++
- 2 files changed, 9 insertions(+)
-
-diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
-index 6f2b96c..d0bc72e 100644
---- a/hw/virtio/virtio.c
-+++ b/hw/virtio/virtio.c
-@@ -267,6 +267,13 @@ static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem,
- 0, elem->out_sg[i].iov_len);
- }
-
-+void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
-+ unsigned int len)
-+{
-+ vq->last_avail_idx--;
-+ virtqueue_unmap_sg(vq, elem, len);
-+}
-+
- void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
- unsigned int len, unsigned int idx)
- {
-diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
-index 6201ee8..9d09115 100644
---- a/include/hw/virtio/virtio.h
-+++ b/include/hw/virtio/virtio.h
-@@ -146,6 +146,8 @@ void virtio_del_queue(VirtIODevice *vdev, int n);
- void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
- unsigned int len);
- void virtqueue_flush(VirtQueue *vq, unsigned int count);
-+void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
-+ unsigned int len);
- void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
- unsigned int len, unsigned int idx);
-
---
-2.6.0.rc2.230.g3dd15c0
-
diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch
deleted file mode 100644
index 96981e9..0000000
--- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-https://bugs.gentoo.org/560760
-
-From 0cf33fb6b49a19de32859e2cdc6021334f448fb3 Mon Sep 17 00:00:00 2001
-From: Jason Wang <jasowang@redhat.com>
-Date: Fri, 25 Sep 2015 13:21:30 +0800
-Subject: [PATCH 3/3] virtio-net: correctly drop truncated packets
-
-When packet is truncated during receiving, we drop the packets but
-neither discard the descriptor nor add and signal used
-descriptor. This will lead several issues:
-
-- sg mappings are leaked
-- rx will be stalled if a lots of packets were truncated
-
-In order to be consistent with vhost, fix by discarding the descriptor
-in this case.
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----
- hw/net/virtio-net.c | 8 +-------
- 1 file changed, 1 insertion(+), 7 deletions(-)
-
-diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
-index d388c55..a877614 100644
---- a/hw/net/virtio-net.c
-+++ b/hw/net/virtio-net.c
-@@ -1094,13 +1094,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t
- * must have consumed the complete packet.
- * Otherwise, drop it. */
- if (!n->mergeable_rx_bufs && offset < size) {
--#if 0
-- error_report("virtio-net truncated non-mergeable packet: "
-- "i %zd mergeable %d offset %zd, size %zd, "
-- "guest hdr len %zd, host hdr len %zd",
-- i, n->mergeable_rx_bufs,
-- offset, size, n->guest_hdr_len, n->host_hdr_len);
--#endif
-+ virtqueue_discard(q->rx_vq, &elem, total);
- return size;
- }
-
---
-2.6.0.rc2.230.g3dd15c0
-
diff --git a/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch b/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch
deleted file mode 100644
index ad4051e..0000000
--- a/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-https://bugs.gentoo.org/558396
-
-fix from upstream git
-
-From e424aff5f307227b1c2512bbb8ece891bb895cef Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Thu, 13 Aug 2015 10:41:50 +0200
-Subject: [PATCH] mirror: Fix coroutine reentrance
-
-This fixes a regression introduced by commit dcfb3beb ("mirror: Do zero
-write on target if sectors not allocated"), which was reported to cause
-aborts with the message "Co-routine re-entered recursively".
-
-The cause for this bug is the following code in mirror_iteration_done():
-
- if (s->common.busy) {
- qemu_coroutine_enter(s->common.co, NULL);
- }
-
-This has always been ugly because - unlike most places that reenter - it
-doesn't have a specific yield that it pairs with, but is more
-uncontrolled. What we really mean here is "reenter the coroutine if
-it's in one of the four explicit yields in mirror.c".
-
-This used to be equivalent with s->common.busy because neither
-mirror_run() nor mirror_iteration() call any function that could yield.
-However since commit dcfb3beb this doesn't hold true any more:
-bdrv_get_block_status_above() can yield.
-
-So what happens is that bdrv_get_block_status_above() wants to take a
-lock that is already held, so it adds itself to the queue of waiting
-coroutines and yields. Instead of being woken up by the unlock function,
-however, it gets woken up by mirror_iteration_done(), which is obviously
-wrong.
-
-In most cases the code actually happens to cope fairly well with such
-cases, but in this specific case, the unlock must already have scheduled
-the coroutine for wakeup when mirror_iteration_done() reentered it. And
-then the coroutine happened to process the scheduled restarts and tried
-to reenter itself recursively.
-
-This patch fixes the problem by pairing the reenter in
-mirror_iteration_done() with specific yields instead of abusing
-s->common.busy.
-
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Jeff Cody <jcody@redhat.com>
-Message-id: 1439455310-11263-1-git-send-email-kwolf@redhat.com
-Signed-off-by: Jeff Cody <jcody@redhat.com>
----
- block/mirror.c | 15 ++++++++++-----
- 1 file changed, 10 insertions(+), 5 deletions(-)
-
-diff --git a/block/mirror.c b/block/mirror.c
-index 0841964..9474443 100644
---- a/block/mirror.c
-+++ b/block/mirror.c
-@@ -60,6 +60,7 @@ typedef struct MirrorBlockJob {
- int sectors_in_flight;
- int ret;
- bool unmap;
-+ bool waiting_for_io;
- } MirrorBlockJob;
-
- typedef struct MirrorOp {
-@@ -114,11 +115,7 @@ static void mirror_iteration_done(MirrorOp *op, int ret)
- qemu_iovec_destroy(&op->qiov);
- g_slice_free(MirrorOp, op);
-
-- /* Enter coroutine when it is not sleeping. The coroutine sleeps to
-- * rate-limit itself. The coroutine will eventually resume since there is
-- * a sleep timeout so don't wake it early.
-- */
-- if (s->common.busy) {
-+ if (s->waiting_for_io) {
- qemu_coroutine_enter(s->common.co, NULL);
- }
- }
-@@ -203,7 +200,9 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
- /* Wait for I/O to this cluster (from a previous iteration) to be done. */
- while (test_bit(next_chunk, s->in_flight_bitmap)) {
- trace_mirror_yield_in_flight(s, sector_num, s->in_flight);
-+ s->waiting_for_io = true;
- qemu_coroutine_yield();
-+ s->waiting_for_io = false;
- }
-
- do {
-@@ -239,7 +238,9 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
- */
- while (nb_chunks == 0 && s->buf_free_count < added_chunks) {
- trace_mirror_yield_buf_busy(s, nb_chunks, s->in_flight);
-+ s->waiting_for_io = true;
- qemu_coroutine_yield();
-+ s->waiting_for_io = false;
- }
- if (s->buf_free_count < nb_chunks + added_chunks) {
- trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight);
-@@ -337,7 +338,9 @@ static void mirror_free_init(MirrorBlockJob *s)
- static void mirror_drain(MirrorBlockJob *s)
- {
- while (s->in_flight > 0) {
-+ s->waiting_for_io = true;
- qemu_coroutine_yield();
-+ s->waiting_for_io = false;
- }
- }
-
-@@ -510,7 +513,9 @@ static void coroutine_fn mirror_run(void *opaque)
- if (s->in_flight == MAX_IN_FLIGHT || s->buf_free_count == 0 ||
- (cnt == 0 && s->in_flight > 0)) {
- trace_mirror_yield(s, s->in_flight, s->buf_free_count, cnt);
-+ s->waiting_for_io = true;
- qemu_coroutine_yield();
-+ s->waiting_for_io = false;
- continue;
- } else if (cnt != 0) {
- delay_ns = mirror_iteration(s);
---
-2.5.0
-
diff --git a/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch b/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch
deleted file mode 100644
index f2538a7..0000000
--- a/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-https://bugs.gentoo.org/559656
-
-https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01199.html
-
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Subject: [PATCH] e1000: Avoid infinite loop in processing transmit descriptor
-Newsgroups: gmane.comp.emulators.qemu
-Date: 2015-09-04 16:21:06 GMT (2 days, 12 hours and 51 minutes ago)
-From: P J P <pjp@fedoraproject.org>
-
-While processing transmit descriptors, it could lead to an infinite
-loop if 'bytes' was to become zero; Add a check to avoid it.
-
-[The guest can force 'bytes' to 0 by setting the hdr_len and mss
-descriptor fields to 0.
---Stefan]
-
-Signed-off-by: P J P <pjp@fedoraproject.org>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/net/e1000.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/hw/net/e1000.c b/hw/net/e1000.c
-index 5c6bcd0..09c9e9d 100644
---- a/hw/net/e1000.c
-+++ b/hw/net/e1000.c
-@@ -740,7 +740,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
- memmove(tp->data, tp->header, tp->hdr_len);
- tp->size = tp->hdr_len;
- }
-- } while (split_size -= bytes);
-+ split_size -= bytes;
-+ } while (bytes && split_size);
- } else if (!tp->tse && tp->cptse) {
- // context descriptor TSE is not set, while data descriptor TSE is set
- DBGOUT(TXERR, "TCP segmentation error\n");
---
-2.4.3
diff --git a/app-emulation/qemu/qemu-2.3.0-r5.ebuild b/app-emulation/qemu/qemu-2.3.0-r5.ebuild
deleted file mode 100644
index 9e0cf4f..0000000
--- a/app-emulation/qemu/qemu-2.3.0-r5.ebuild
+++ /dev/null
@@ -1,611 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Require at least one softmmu or user target.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
- ${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- aio? ( dev-libs/libaio[static-libs(+)] )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.7.5
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- accessibility? ( app-accessibility/brltty )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- gtk? (
- gtk2? ( x11-libs/gtk+:2 )
- !gtk2? ( x11-libs/gtk+:3 )
- x11-libs/vte:2.90
- )
- iscsi? ( net-libs/libiscsi )
- opengl? ( virtual/opengl )
- pulseaudio? ( media-sound/pulseaudio )
- python? ( ${PYTHON_DEPS} )
- sdl? ( media-libs/libsdl[X] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- spice? ( >=app-emulation/spice-protocol-0.12.3 )
- systemtap? ( dev-util/systemtap )
- usbredir? ( >=sys-apps/usbredir-0.6 )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-src_prepare() {
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${P}-CVE-2015-3456.patch #549404
- epatch "${FILESDIR}"/${P}-CVE-2015-3209.patch #551752
- epatch "${FILESDIR}"/${P}-CVE-2015-5158.patch #555680
- epatch "${FILESDIR}"/${P}-CVE-2015-3214.patch #556052
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-1.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-2.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-3.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-1.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-2.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-3.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-4.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-5.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-6.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-7.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5166.patch #556304
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir=$2
- local static_flag="static-${buildtype}"
-
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls quorum)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu tls vnc-ws)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --target-list="${user_targets}"
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --target-list="${softmmu_targets}"
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- ;;
- esac
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- einfo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- [[ -n ${softmmu_targets} ]] && \
- einfo "Building the following softmmu targets: ${softmmu_targets}"
-
- [[ -n ${user_targets} ]] && \
- einfo "Building the following user targets: ${user_targets}"
-
- if [[ -n ${softmmu_targets} ]]; then
- mkdir "${S}/softmmu-build"
- qemu_src_configure "softmmu" "${S}/softmmu-build"
- fi
-
- if [[ -n ${user_targets} ]]; then
- mkdir "${S}/user-build"
- qemu_src_configure "user" "${S}/user-build"
- fi
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
- ewarn "save states has been removed starting with the 1.6.2 release"
- ewarn
- ewarn "It is recommended that you migrate any VMs that may be running"
- ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
- ewarn "any saved states with a newer qemu."
- ewarn
- ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
-
- if use x86 || use amd64; then
- ewarn
- ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
- ewarn "installed. In order to use kvm acceleration, pass the flag"
- ewarn "-enable-kvm when running your system target."
- fi
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version sys-firmware/seabios[binary]; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.3.0-r6.ebuild b/app-emulation/qemu/qemu-2.3.0-r6.ebuild
deleted file mode 100644
index b49f43c..0000000
--- a/app-emulation/qemu/qemu-2.3.0-r6.ebuild
+++ /dev/null
@@ -1,612 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Require at least one softmmu or user target.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
- ${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- aio? ( dev-libs/libaio[static-libs(+)] )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.7.5
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- accessibility? ( app-accessibility/brltty )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- gtk? (
- gtk2? ( x11-libs/gtk+:2 )
- !gtk2? ( x11-libs/gtk+:3 )
- x11-libs/vte:2.90
- )
- iscsi? ( net-libs/libiscsi )
- opengl? ( virtual/opengl )
- pulseaudio? ( media-sound/pulseaudio )
- python? ( ${PYTHON_DEPS} )
- sdl? ( media-libs/libsdl[X] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- spice? ( >=app-emulation/spice-protocol-0.12.3 )
- systemtap? ( dev-util/systemtap )
- usbredir? ( >=sys-apps/usbredir-0.6 )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-src_prepare() {
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${P}-CVE-2015-3456.patch #549404
- epatch "${FILESDIR}"/${P}-CVE-2015-3209.patch #551752
- epatch "${FILESDIR}"/${P}-CVE-2015-5158.patch #555680
- epatch "${FILESDIR}"/${P}-CVE-2015-3214.patch #556052
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-1.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-2.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-3.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-1.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-2.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-3.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-4.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-5.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-6.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-7.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5166.patch #556304
- epatch "${FILESDIR}"/${P}-virtio-serial.patch #557206
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir=$2
- local static_flag="static-${buildtype}"
-
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls quorum)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu tls vnc-ws)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --target-list="${user_targets}"
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --target-list="${softmmu_targets}"
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- ;;
- esac
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- einfo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- [[ -n ${softmmu_targets} ]] && \
- einfo "Building the following softmmu targets: ${softmmu_targets}"
-
- [[ -n ${user_targets} ]] && \
- einfo "Building the following user targets: ${user_targets}"
-
- if [[ -n ${softmmu_targets} ]]; then
- mkdir "${S}/softmmu-build"
- qemu_src_configure "softmmu" "${S}/softmmu-build"
- fi
-
- if [[ -n ${user_targets} ]]; then
- mkdir "${S}/user-build"
- qemu_src_configure "user" "${S}/user-build"
- fi
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
- ewarn "save states has been removed starting with the 1.6.2 release"
- ewarn
- ewarn "It is recommended that you migrate any VMs that may be running"
- ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
- ewarn "any saved states with a newer qemu."
- ewarn
- ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
-
- if use x86 || use amd64; then
- ewarn
- ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
- ewarn "installed. In order to use kvm acceleration, pass the flag"
- ewarn "-enable-kvm when running your system target."
- fi
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version sys-firmware/seabios[binary]; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.3.0-r7.ebuild b/app-emulation/qemu/qemu-2.3.0-r7.ebuild
deleted file mode 100644
index b49f43c..0000000
--- a/app-emulation/qemu/qemu-2.3.0-r7.ebuild
+++ /dev/null
@@ -1,612 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Require at least one softmmu or user target.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
- ${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- aio? ( dev-libs/libaio[static-libs(+)] )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.7.5
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- accessibility? ( app-accessibility/brltty )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- gtk? (
- gtk2? ( x11-libs/gtk+:2 )
- !gtk2? ( x11-libs/gtk+:3 )
- x11-libs/vte:2.90
- )
- iscsi? ( net-libs/libiscsi )
- opengl? ( virtual/opengl )
- pulseaudio? ( media-sound/pulseaudio )
- python? ( ${PYTHON_DEPS} )
- sdl? ( media-libs/libsdl[X] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- spice? ( >=app-emulation/spice-protocol-0.12.3 )
- systemtap? ( dev-util/systemtap )
- usbredir? ( >=sys-apps/usbredir-0.6 )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-src_prepare() {
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${P}-CVE-2015-3456.patch #549404
- epatch "${FILESDIR}"/${P}-CVE-2015-3209.patch #551752
- epatch "${FILESDIR}"/${P}-CVE-2015-5158.patch #555680
- epatch "${FILESDIR}"/${P}-CVE-2015-3214.patch #556052
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-1.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-2.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5154-3.patch #556050 / #555532
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-1.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-2.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-3.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-4.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-5.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-6.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5165-7.patch #556304
- epatch "${FILESDIR}"/${P}-CVE-2015-5166.patch #556304
- epatch "${FILESDIR}"/${P}-virtio-serial.patch #557206
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir=$2
- local static_flag="static-${buildtype}"
-
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls quorum)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu tls vnc-ws)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --target-list="${user_targets}"
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --target-list="${softmmu_targets}"
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- ;;
- esac
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- einfo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- [[ -n ${softmmu_targets} ]] && \
- einfo "Building the following softmmu targets: ${softmmu_targets}"
-
- [[ -n ${user_targets} ]] && \
- einfo "Building the following user targets: ${user_targets}"
-
- if [[ -n ${softmmu_targets} ]]; then
- mkdir "${S}/softmmu-build"
- qemu_src_configure "softmmu" "${S}/softmmu-build"
- fi
-
- if [[ -n ${user_targets} ]]; then
- mkdir "${S}/user-build"
- qemu_src_configure "user" "${S}/user-build"
- fi
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
- ewarn "save states has been removed starting with the 1.6.2 release"
- ewarn
- ewarn "It is recommended that you migrate any VMs that may be running"
- ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
- ewarn "any saved states with a newer qemu."
- ewarn
- ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
-
- if use x86 || use amd64; then
- ewarn
- ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
- ewarn "installed. In order to use kvm acceleration, pass the flag"
- ewarn "-enable-kvm when running your system target."
- fi
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version sys-firmware/seabios[binary]; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.3.1-r1.ebuild b/app-emulation/qemu/qemu-2.3.1-r1.ebuild
deleted file mode 100644
index d3349e4..0000000
--- a/app-emulation/qemu/qemu-2.3.1-r1.ebuild
+++ /dev/null
@@ -1,598 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Require at least one softmmu or user target.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
- ${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- aio? ( dev-libs/libaio[static-libs(+)] )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.7.5
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- accessibility? ( app-accessibility/brltty )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- gtk? (
- gtk2? ( x11-libs/gtk+:2 )
- !gtk2? ( x11-libs/gtk+:3 )
- x11-libs/vte:2.90
- )
- iscsi? ( net-libs/libiscsi )
- opengl? ( virtual/opengl )
- pulseaudio? ( media-sound/pulseaudio )
- python? ( ${PYTHON_DEPS} )
- sdl? ( media-libs/libsdl[X] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- spice? ( >=app-emulation/spice-protocol-0.12.3 )
- systemtap? ( dev-util/systemtap )
- usbredir? ( >=sys-apps/usbredir-0.6 )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-src_prepare() {
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.3.0-CVE-2015-3209.patch #551752
- epatch "${FILESDIR}"/${PN}-2.3.0-virtio-serial.patch #557206
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir=$2
- local static_flag="static-${buildtype}"
-
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls quorum)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu tls vnc-ws)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --target-list="${user_targets}"
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --target-list="${softmmu_targets}"
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- ;;
- esac
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- einfo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- [[ -n ${softmmu_targets} ]] && \
- einfo "Building the following softmmu targets: ${softmmu_targets}"
-
- [[ -n ${user_targets} ]] && \
- einfo "Building the following user targets: ${user_targets}"
-
- if [[ -n ${softmmu_targets} ]]; then
- mkdir "${S}/softmmu-build"
- qemu_src_configure "softmmu" "${S}/softmmu-build"
- fi
-
- if [[ -n ${user_targets} ]]; then
- mkdir "${S}/user-build"
- qemu_src_configure "user" "${S}/user-build"
- fi
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
- ewarn "save states has been removed starting with the 1.6.2 release"
- ewarn
- ewarn "It is recommended that you migrate any VMs that may be running"
- ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
- ewarn "any saved states with a newer qemu."
- ewarn
- ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
-
- if use x86 || use amd64; then
- ewarn
- ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
- ewarn "installed. In order to use kvm acceleration, pass the flag"
- ewarn "-enable-kvm when running your system target."
- fi
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version sys-firmware/seabios[binary]; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.3.1.ebuild b/app-emulation/qemu/qemu-2.3.1.ebuild
deleted file mode 100644
index d3349e4..0000000
--- a/app-emulation/qemu/qemu-2.3.1.ebuild
+++ /dev/null
@@ -1,598 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Require at least one softmmu or user target.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
- ${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- aio? ( dev-libs/libaio[static-libs(+)] )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.7.5
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- accessibility? ( app-accessibility/brltty )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- gtk? (
- gtk2? ( x11-libs/gtk+:2 )
- !gtk2? ( x11-libs/gtk+:3 )
- x11-libs/vte:2.90
- )
- iscsi? ( net-libs/libiscsi )
- opengl? ( virtual/opengl )
- pulseaudio? ( media-sound/pulseaudio )
- python? ( ${PYTHON_DEPS} )
- sdl? ( media-libs/libsdl[X] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- spice? ( >=app-emulation/spice-protocol-0.12.3 )
- systemtap? ( dev-util/systemtap )
- usbredir? ( >=sys-apps/usbredir-0.6 )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-src_prepare() {
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.3.0-CVE-2015-3209.patch #551752
- epatch "${FILESDIR}"/${PN}-2.3.0-virtio-serial.patch #557206
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir=$2
- local static_flag="static-${buildtype}"
-
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls quorum)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu tls vnc-ws)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --target-list="${user_targets}"
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --target-list="${softmmu_targets}"
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- ;;
- esac
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- einfo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- [[ -n ${softmmu_targets} ]] && \
- einfo "Building the following softmmu targets: ${softmmu_targets}"
-
- [[ -n ${user_targets} ]] && \
- einfo "Building the following user targets: ${user_targets}"
-
- if [[ -n ${softmmu_targets} ]]; then
- mkdir "${S}/softmmu-build"
- qemu_src_configure "softmmu" "${S}/softmmu-build"
- fi
-
- if [[ -n ${user_targets} ]]; then
- mkdir "${S}/user-build"
- qemu_src_configure "user" "${S}/user-build"
- fi
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
- ewarn "save states has been removed starting with the 1.6.2 release"
- ewarn
- ewarn "It is recommended that you migrate any VMs that may be running"
- ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
- ewarn "any saved states with a newer qemu."
- ewarn
- ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
-
- if use x86 || use amd64; then
- ewarn
- ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
- ewarn "installed. In order to use kvm acceleration, pass the flag"
- ewarn "-enable-kvm when running your system target."
- fi
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version sys-firmware/seabios[binary]; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.4.0-r1.ebuild b/app-emulation/qemu/qemu-2.4.0-r1.ebuild
deleted file mode 100644
index ad8c85d..0000000
--- a/app-emulation/qemu/qemu-2.4.0-r1.ebuild
+++ /dev/null
@@ -1,640 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${P}-block-mirror-crash.patch #558396
- epatch "${FILESDIR}"/${P}-CVE-2015-5225.patch #558416
- epatch "${FILESDIR}"/${PN}-2.4.0-e1000-loop.patch #559656
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.4.0-r2.ebuild b/app-emulation/qemu/qemu-2.4.0-r2.ebuild
deleted file mode 100644
index ad8c85d..0000000
--- a/app-emulation/qemu/qemu-2.4.0-r2.ebuild
+++ /dev/null
@@ -1,640 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${P}-block-mirror-crash.patch #558396
- epatch "${FILESDIR}"/${P}-CVE-2015-5225.patch #558416
- epatch "${FILESDIR}"/${PN}-2.4.0-e1000-loop.patch #559656
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild b/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild
deleted file mode 100644
index 1e99f54..0000000
--- a/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild
+++ /dev/null
@@ -1,645 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.4.0-block-mirror-crash.patch #558396
- epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-7295-{1,2,3}.patch #560760
- epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-6855.patch #560422
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # MIPS specific fixes. Bug #563162
- for x in "${FILESDIR}"/${PN}-2.4-mips-*; do
- epatch "${x}"
- done
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.4.0.1-r2.ebuild b/app-emulation/qemu/qemu-2.4.0.1-r2.ebuild
deleted file mode 100644
index 1e99f54..0000000
--- a/app-emulation/qemu/qemu-2.4.0.1-r2.ebuild
+++ /dev/null
@@ -1,645 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.4.0-block-mirror-crash.patch #558396
- epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-7295-{1,2,3}.patch #560760
- epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-6855.patch #560422
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # MIPS specific fixes. Bug #563162
- for x in "${FILESDIR}"/${PN}-2.4-mips-*; do
- epatch "${x}"
- done
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.4.0.1.ebuild b/app-emulation/qemu/qemu-2.4.0.1.ebuild
deleted file mode 100644
index e57f5ea..0000000
--- a/app-emulation/qemu/qemu-2.4.0.1.ebuild
+++ /dev/null
@@ -1,640 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.4.0-block-mirror-crash.patch #558396
- epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-7295-{1,2,3}.patch #560760
- epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-6855.patch #560422
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.4.1-r1.ebuild b/app-emulation/qemu/qemu-2.4.1-r1.ebuild
deleted file mode 100644
index 32539dd..0000000
--- a/app-emulation/qemu/qemu-2.4.1-r1.ebuild
+++ /dev/null
@@ -1,640 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-{7504,7512}.patch #567144
- epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-8345.patch #566792
- epatch "${FILESDIR}"/${PN}-2.4-mips-* #563162
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.4.1.ebuild b/app-emulation/qemu/qemu-2.4.1.ebuild
deleted file mode 100644
index e535a10..0000000
--- a/app-emulation/qemu/qemu-2.4.1.ebuild
+++ /dev/null
@@ -1,638 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.4-mips-* #563162
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2016-01-18 4:59 Mike Frysinger
0 siblings, 0 replies; 66+ messages in thread
From: Mike Frysinger @ 2016-01-18 4:59 UTC (permalink / raw
To: gentoo-commits
commit: 96bdea53ec5c2e6d80e30b288043e34bfc766e25
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 04:55:24 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 04:56:28 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=96bdea53
app-emulation/qemu: add upstream fixes for #567868 #568246 #570110 #570988 #571566
.../qemu/files/qemu-2.5.0-CVE-2015-8558.patch | 50 ++
.../qemu/files/qemu-2.5.0-CVE-2015-8567.patch | 95 +++
.../qemu/files/qemu-2.5.0-CVE-2015-8701.patch | 49 ++
.../qemu/files/qemu-2.5.0-CVE-2015-8743.patch | 50 ++
.../qemu/files/qemu-2.5.0-CVE-2016-1568.patch | 41 ++
app-emulation/qemu/qemu-2.5.0-r1.ebuild | 657 +++++++++++++++++++++
6 files changed, 942 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch
new file mode 100644
index 0000000..fbc6a0a
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8558.patch
@@ -0,0 +1,50 @@
+https://bugs.gentoo.org/568246
+
+From 156a2e4dbffa85997636a7a39ef12da6f1b40254 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Mon, 14 Dec 2015 09:21:23 +0100
+Subject: [PATCH] ehci: make idt processing more robust
+
+Make ehci_process_itd return an error in case we didn't do any actual
+iso transfer because we've found no active transaction. That'll avoid
+ehci happily run in circles forever if the guest builds a loop out of
+idts.
+
+This is CVE-2015-8558.
+
+Cc: qemu-stable@nongnu.org
+Reported-by: Qinghao Tang <luodalongde@gmail.com>
+Tested-by: P J P <ppandit@redhat.com>
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+---
+ hw/usb/hcd-ehci.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
+index 4e2161b..d07f228 100644
+--- a/hw/usb/hcd-ehci.c
++++ b/hw/usb/hcd-ehci.c
+@@ -1389,7 +1389,7 @@ static int ehci_process_itd(EHCIState *ehci,
+ {
+ USBDevice *dev;
+ USBEndpoint *ep;
+- uint32_t i, len, pid, dir, devaddr, endp;
++ uint32_t i, len, pid, dir, devaddr, endp, xfers = 0;
+ uint32_t pg, off, ptr1, ptr2, max, mult;
+
+ ehci->periodic_sched_active = PERIODIC_ACTIVE;
+@@ -1479,9 +1479,10 @@ static int ehci_process_itd(EHCIState *ehci,
+ ehci_raise_irq(ehci, USBSTS_INT);
+ }
+ itd->transact[i] &= ~ITD_XACT_ACTIVE;
++ xfers++;
+ }
+ }
+- return 0;
++ return xfers ? 0 : -1;
+ }
+
+
+--
+2.6.2
+
diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8567.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8567.patch
new file mode 100644
index 0000000..e196043
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8567.patch
@@ -0,0 +1,95 @@
+https://bugs.gentoo.org/567868
+
+From aa4a3dce1c88ed51b616806b8214b7c8428b7470 Mon Sep 17 00:00:00 2001
+From: P J P <ppandit@redhat.com>
+Date: Tue, 15 Dec 2015 12:27:54 +0530
+Subject: [PATCH] net: vmxnet3: avoid memory leakage in activate_device
+
+Vmxnet3 device emulator does not check if the device is active
+before activating it, also it did not free the transmit & receive
+buffers while deactivating the device, thus resulting in memory
+leakage on the host. This patch fixes both these issues to avoid
+host memory leakage.
+
+Reported-by: Qinghao Tang <luodalongde@gmail.com>
+Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+---
+ hw/net/vmxnet3.c | 24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
+index a5dd79a..9c1adfc 100644
+--- a/hw/net/vmxnet3.c
++++ b/hw/net/vmxnet3.c
+@@ -1194,8 +1194,13 @@ static void vmxnet3_reset_mac(VMXNET3State *s)
+
+ static void vmxnet3_deactivate_device(VMXNET3State *s)
+ {
+- VMW_CBPRN("Deactivating vmxnet3...");
+- s->device_active = false;
++ if (s->device_active) {
++ VMW_CBPRN("Deactivating vmxnet3...");
++ vmxnet_tx_pkt_reset(s->tx_pkt);
++ vmxnet_tx_pkt_uninit(s->tx_pkt);
++ vmxnet_rx_pkt_uninit(s->rx_pkt);
++ s->device_active = false;
++ }
+ }
+
+ static void vmxnet3_reset(VMXNET3State *s)
+@@ -1204,7 +1209,6 @@ static void vmxnet3_reset(VMXNET3State *s)
+
+ vmxnet3_deactivate_device(s);
+ vmxnet3_reset_interrupt_states(s);
+- vmxnet_tx_pkt_reset(s->tx_pkt);
+ s->drv_shmem = 0;
+ s->tx_sop = true;
+ s->skip_current_tx_pkt = false;
+@@ -1431,6 +1435,12 @@ static void vmxnet3_activate_device(VMXNET3State *s)
+ return;
+ }
+
++ /* Verify if device is active */
++ if (s->device_active) {
++ VMW_CFPRN("Vmxnet3 device is active");
++ return;
++ }
++
+ vmxnet3_adjust_by_guest_type(s);
+ vmxnet3_update_features(s);
+ vmxnet3_update_pm_state(s);
+@@ -1627,7 +1637,7 @@ static void vmxnet3_handle_command(VMXNET3State *s, uint64_t cmd)
+ break;
+
+ case VMXNET3_CMD_QUIESCE_DEV:
+- VMW_CBPRN("Set: VMXNET3_CMD_QUIESCE_DEV - pause the device");
++ VMW_CBPRN("Set: VMXNET3_CMD_QUIESCE_DEV - deactivate the device");
+ vmxnet3_deactivate_device(s);
+ break;
+
+@@ -1741,7 +1751,7 @@ vmxnet3_io_bar1_write(void *opaque,
+ * shared address only after we get the high part
+ */
+ if (val == 0) {
+- s->device_active = false;
++ vmxnet3_deactivate_device(s);
+ }
+ s->temp_shared_guest_driver_memory = val;
+ s->drv_shmem = 0;
+@@ -2021,9 +2031,7 @@ static bool vmxnet3_peer_has_vnet_hdr(VMXNET3State *s)
+ static void vmxnet3_net_uninit(VMXNET3State *s)
+ {
+ g_free(s->mcast_list);
+- vmxnet_tx_pkt_reset(s->tx_pkt);
+- vmxnet_tx_pkt_uninit(s->tx_pkt);
+- vmxnet_rx_pkt_uninit(s->rx_pkt);
++ vmxnet3_deactivate_device(s);
+ qemu_del_nic(s->nic);
+ }
+
+--
+2.6.2
+
diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8701.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8701.patch
new file mode 100644
index 0000000..0dab1c3
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8701.patch
@@ -0,0 +1,49 @@
+https://bugs.gentoo.org/570110
+
+From 007cd223de527b5f41278f2d886c1a4beb3e67aa Mon Sep 17 00:00:00 2001
+From: Prasad J Pandit <pjp@fedoraproject.org>
+Date: Mon, 28 Dec 2015 16:24:08 +0530
+Subject: [PATCH] net: rocker: fix an incorrect array bounds check
+
+While processing transmit(tx) descriptors in 'tx_consume' routine
+the switch emulator suffers from an off-by-one error, if a
+descriptor was to have more than allowed(ROCKER_TX_FRAGS_MAX=16)
+fragments. Fix an incorrect bounds check to avoid it.
+
+Reported-by: Qinghao Tang <luodalongde@gmail.com>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+---
+ hw/net/rocker/rocker.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
+index c57f1a6..2e77e50 100644
+--- a/hw/net/rocker/rocker.c
++++ b/hw/net/rocker/rocker.c
+@@ -232,6 +232,9 @@ static int tx_consume(Rocker *r, DescInfo *info)
+ frag_addr = rocker_tlv_get_le64(tlvs[ROCKER_TLV_TX_FRAG_ATTR_ADDR]);
+ frag_len = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_FRAG_ATTR_LEN]);
+
++ if (iovcnt >= ROCKER_TX_FRAGS_MAX) {
++ goto err_too_many_frags;
++ }
+ iov[iovcnt].iov_len = frag_len;
+ iov[iovcnt].iov_base = g_malloc(frag_len);
+ if (!iov[iovcnt].iov_base) {
+@@ -244,10 +247,7 @@ static int tx_consume(Rocker *r, DescInfo *info)
+ err = -ROCKER_ENXIO;
+ goto err_bad_io;
+ }
+-
+- if (++iovcnt > ROCKER_TX_FRAGS_MAX) {
+- goto err_too_many_frags;
+- }
++ iovcnt++;
+ }
+
+ if (iovcnt) {
+--
+2.6.2
+
diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8743.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8743.patch
new file mode 100644
index 0000000..b2bca56
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2015-8743.patch
@@ -0,0 +1,50 @@
+https://bugs.gentoo.org/570988
+
+From aa7f9966dfdff500bbbf1956d9e115b1fa8987a6 Mon Sep 17 00:00:00 2001
+From: Prasad J Pandit <pjp@fedoraproject.org>
+Date: Thu, 31 Dec 2015 17:05:27 +0530
+Subject: [PATCH] net: ne2000: fix bounds check in ioport operations
+
+While doing ioport r/w operations, ne2000 device emulation suffers
+from OOB r/w errors. Update respective array bounds check to avoid
+OOB access.
+
+Reported-by: Ling Liu <liuling-it@360.cn>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+---
+ hw/net/ne2000.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
+index 010f9ef..a3dffff 100644
+--- a/hw/net/ne2000.c
++++ b/hw/net/ne2000.c
+@@ -467,8 +467,9 @@ static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr,
+ uint32_t val)
+ {
+ addr &= ~1; /* XXX: check exact behaviour if not even */
+- if (addr < 32 ||
+- (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
++ if (addr < 32
++ || (addr >= NE2000_PMEM_START
++ && addr + sizeof(uint32_t) <= NE2000_MEM_SIZE)) {
+ stl_le_p(s->mem + addr, val);
+ }
+ }
+@@ -497,8 +498,9 @@ static inline uint32_t ne2000_mem_readw(NE2000State *s, uint32_t addr)
+ static inline uint32_t ne2000_mem_readl(NE2000State *s, uint32_t addr)
+ {
+ addr &= ~1; /* XXX: check exact behaviour if not even */
+- if (addr < 32 ||
+- (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
++ if (addr < 32
++ || (addr >= NE2000_PMEM_START
++ && addr + sizeof(uint32_t) <= NE2000_MEM_SIZE)) {
+ return ldl_le_p(s->mem + addr);
+ } else {
+ return 0xffffffff;
+--
+2.6.2
+
diff --git a/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-1568.patch b/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-1568.patch
new file mode 100644
index 0000000..4ce9a35
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.5.0-CVE-2016-1568.patch
@@ -0,0 +1,41 @@
+https://bugs.gentoo.org/571566
+
+From 4ab0359a8ae182a7ac5c99609667273167703fab Mon Sep 17 00:00:00 2001
+From: Prasad J Pandit <pjp@fedoraproject.org>
+Date: Mon, 11 Jan 2016 14:10:42 -0500
+Subject: [PATCH] ide: ahci: reset ncq object to unused on error
+
+When processing NCQ commands, AHCI device emulation prepares a
+NCQ transfer object; To which an aio control block(aiocb) object
+is assigned in 'execute_ncq_command'. In case, when the NCQ
+command is invalid, the 'aiocb' object is not assigned, and NCQ
+transfer object is left as 'used'. This leads to a use after
+free kind of error in 'bdrv_aio_cancel_async' via 'ahci_reset_port'.
+Reset NCQ transfer object to 'unused' to avoid it.
+
+[Maintainer edit: s/ACHI/AHCI/ in the commit message. --js]
+
+Reported-by: Qinghao Tang <luodalongde@gmail.com>
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+Reviewed-by: John Snow <jsnow@redhat.com>
+Message-id: 1452282511-4116-1-git-send-email-ppandit@redhat.com
+Signed-off-by: John Snow <jsnow@redhat.com>
+---
+ hw/ide/ahci.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
+index dd1912e..17f1cbd 100644
+--- a/hw/ide/ahci.c
++++ b/hw/ide/ahci.c
+@@ -910,6 +910,7 @@ static void ncq_err(NCQTransferState *ncq_tfs)
+ ide_state->error = ABRT_ERR;
+ ide_state->status = READY_STAT | ERR_STAT;
+ ncq_tfs->drive->port_regs.scr_err |= (1 << ncq_tfs->tag);
++ ncq_tfs->used = 0;
+ }
+
+ static void ncq_finish(NCQTransferState *ncq_tfs)
+--
+2.6.2
+
diff --git a/app-emulation/qemu/qemu-2.5.0-r1.ebuild b/app-emulation/qemu/qemu-2.5.0-r1.ebuild
new file mode 100644
index 0000000..9f61eb3
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.5.0-r1.ebuild
@@ -0,0 +1,657 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo pax-utils
+
+BACKPORTS=
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
+ ${BACKPORTS:+
+ https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
+ KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
+gnutls gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
+static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
+virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+#
+# Older versions of gnutls are supported, but it's simpler to just require
+# the latest versions. This is also why we require nettle.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? ( app-accessibility/brltty[static-libs(+)] )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle[static-libs(+)]
+ >=net-libs/gnutls-3.0[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.90 )
+ )
+ )
+ infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gles2]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.8.2
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xen? ( app-emulation/xen-tools:= )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'\n
+For Intel CPUs the module is called 'kvm-intel'\n
+Please review /etc/conf.d/modules for how to load these\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ # Cheap hack to disable gettext .mo generation.
+ use nls || rm -f po/*.po
+
+ epatch "${FILESDIR}"/qemu-2.5.0-cflags.patch
+ [[ -n ${BACKPORTS} ]] && \
+ EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
+ epatch
+
+ epatch "${FILESDIR}"/${P}-CVE-2015-8567.patch #567868
+ epatch "${FILESDIR}"/${P}-CVE-2015-8558.patch #568246
+ epatch "${FILESDIR}"/${P}-CVE-2015-8701.patch #570110
+ epatch "${FILESDIR}"/${P}-CVE-2015-8743.patch #570988
+ epatch "${FILESDIR}"/${P}-CVE-2016-1568.patch #571566
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+ local static_flag="static-${buildtype}"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gnutls)
+ $(conf_softmmu gnutls nettle)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu uuid)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu vte)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ )
+ static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/kvm_stat"
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_dorules "${FILESDIR}"/65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp-*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2016-02-15 15:27 Doug Goldstein
0 siblings, 0 replies; 66+ messages in thread
From: Doug Goldstein @ 2016-02-15 15:27 UTC (permalink / raw
To: gentoo-commits
commit: d526fe71f108586f62e2efc2ef06a67321d22216
Author: Doug Goldstein <cardoe <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 15 15:27:12 2016 +0000
Commit: Doug Goldstein <cardoe <AT> gentoo <DOT> org>
CommitDate: Mon Feb 15 15:27:24 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d526fe71
app-emulation/qemu: remove vulnerable versions
Package-Manager: portage-2.2.26
Signed-off-by: Doug Goldstein <cardoe <AT> gentoo.org>
app-emulation/qemu/Manifest | 1 -
app-emulation/qemu/files/qemu-1.7.0-cflags.patch | 11 -
.../qemu/files/qemu-2.4-mips-fix-mtc0.patch | 78 ---
.../qemu/files/qemu-2.4-mips-fix-rdhwr.patch | 44 --
.../qemu-2.4-mips-move-interrupts-new-func.patch | 89 ---
.../qemu/files/qemu-2.4-mips-wake-up-on-irq.patch | 29 -
.../qemu/files/qemu-2.4.1-CVE-2015-7504.patch | 49 --
.../qemu/files/qemu-2.4.1-CVE-2015-7512.patch | 37 --
.../qemu/files/qemu-2.4.1-CVE-2015-7549.patch | 62 --
.../qemu/files/qemu-2.4.1-CVE-2015-8345.patch | 65 --
.../qemu/files/qemu-2.4.1-CVE-2015-8504.patch | 46 --
app-emulation/qemu/qemu-2.4.1-r2.ebuild | 642 --------------------
app-emulation/qemu/qemu-2.5.0.ebuild | 651 ---------------------
13 files changed, 1804 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 6269bb7..70a4faa 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,2 +1 @@
-DIST qemu-2.4.1.tar.bz2 25087522 SHA256 e3d5cf4c8b1f9129c9c797329a515bfb6b3b1ded0ab8b394c8a316490fe3a177 SHA512 fde32b71a50d888c1055e61f4e6dfc45bb97e8e9ebee490c545965fbdcbd5ffd859fbf20648abed1f4fa9fcc5635e9b22e1829bbe802fc8aaf989d6013235917 WHIRLPOOL a698cfa5d2d138eeddb3c6bea57e3b89ca5d47165c04ed1cfd66a81647ac59cbdd594c919abef67bf198278da1160c5b9f3a0da84cd73827f3eb19a6e6f05436
DIST qemu-2.5.0.tar.bz2 25464996 SHA256 3443887401619fe33bfa5d900a4f2d6a79425ae2b7e43d5b8c36eb7a683772d4 SHA512 12153f94cc7f834fd6a85f25690c36f2331d88d414426fb8b9ac20a34e6f9222b1eda30b727674af583580fae90dfd6d0614a905dce1567d94cd049d426b9dd3 WHIRLPOOL 8f5717989d8d234ecf1763ee386b2e1f20c3b17918de130c6dae255e4523a230b2b01a759eba25e4b9f604c680d9b868c56f58bd71b7c6c2c22a2e46804435ef
diff --git a/app-emulation/qemu/files/qemu-1.7.0-cflags.patch b/app-emulation/qemu/files/qemu-1.7.0-cflags.patch
deleted file mode 100644
index cd003f6..0000000
--- a/app-emulation/qemu/files/qemu-1.7.0-cflags.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/configure
-+++ b/configure
-@@ -3131,8 +3131,6 @@ fi
- if test "$gcov" = "yes" ; then
- CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
- LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
--elif test "$debug" = "no" ; then
-- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
- fi
-
-
diff --git a/app-emulation/qemu/files/qemu-2.4-mips-fix-mtc0.patch b/app-emulation/qemu/files/qemu-2.4-mips-fix-mtc0.patch
deleted file mode 100644
index 07c2be5..0000000
--- a/app-emulation/qemu/files/qemu-2.4-mips-fix-mtc0.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From d54a299b83a07642c85a22bfe19b69ca4def9ec4 Mon Sep 17 00:00:00 2001
-From: Leon Alrae <leon.alrae@imgtec.com>
-Date: Wed, 9 Sep 2015 12:44:25 +0100
-Subject: [PATCH] target-mips: correct MTC0 instruction on MIPS64
-
-MTC0 on a 64-bit processor should move entire 64-bit GPR content to CP0
-register.
-
-Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
-Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
----
- target-mips/translate.c | 18 +++++++-----------
- 1 files changed, 7 insertions(+), 11 deletions(-)
-
-diff --git a/target-mips/translate.c b/target-mips/translate.c
-index 0883782..a59b670 100644
---- a/target-mips/translate.c
-+++ b/target-mips/translate.c
-@@ -4765,12 +4765,6 @@ static inline void gen_mtc0_store32 (TCGv arg, target_ulong off)
- tcg_temp_free_i32(t0);
- }
-
--static inline void gen_mtc0_store64 (TCGv arg, target_ulong off)
--{
-- tcg_gen_ext32s_tl(arg, arg);
-- tcg_gen_st_tl(arg, cpu_env, off);
--}
--
- static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
- {
- const char *rn = "invalid";
-@@ -5629,12 +5623,14 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
- break;
- case 5:
- CP0_CHECK(ctx->insn_flags & ASE_MT);
-- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_VPESchedule));
-+ tcg_gen_st_tl(arg, cpu_env,
-+ offsetof(CPUMIPSState, CP0_VPESchedule));
- rn = "VPESchedule";
- break;
- case 6:
- CP0_CHECK(ctx->insn_flags & ASE_MT);
-- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_VPEScheFBack));
-+ tcg_gen_st_tl(arg, cpu_env,
-+ offsetof(CPUMIPSState, CP0_VPEScheFBack));
- rn = "VPEScheFBack";
- break;
- case 7:
-@@ -5884,7 +5880,7 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
- case 14:
- switch (sel) {
- case 0:
-- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_EPC));
-+ tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EPC));
- rn = "EPC";
- break;
- default:
-@@ -6057,7 +6053,7 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
- switch (sel) {
- case 0:
- /* EJTAG support */
-- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_DEPC));
-+ tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_DEPC));
- rn = "DEPC";
- break;
- default:
-@@ -6160,7 +6156,7 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
- case 30:
- switch (sel) {
- case 0:
-- gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_ErrorEPC));
-+ tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_ErrorEPC));
- rn = "ErrorEPC";
- break;
- default:
---
-1.7.0.4
-
diff --git a/app-emulation/qemu/files/qemu-2.4-mips-fix-rdhwr.patch b/app-emulation/qemu/files/qemu-2.4-mips-fix-rdhwr.patch
deleted file mode 100644
index 998ec66..0000000
--- a/app-emulation/qemu/files/qemu-2.4-mips-fix-rdhwr.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From cdfcad788394ff53e317043e07b8e34f4987c659 Mon Sep 17 00:00:00 2001
-From: Alex Smith <alex.smith@imgtec.com>
-Date: Tue, 8 Sep 2015 11:34:11 +0100
-Subject: [PATCH 1/1] target-mips: Fix RDHWR on CP0.Count
-
-For RDHWR on the CP0.Count register, env->CP0_Count was being returned.
-This value is a delta against the QEMU_CLOCK_VIRTUAL clock, not the
-correct current value of CP0.Count. Use cpu_mips_get_count() instead.
-
-Signed-off-by: Alex Smith <alex.smith@imgtec.com>
-Cc: Aurelien Jarno <aurelien@aurel32.net>
-Cc: Leon Alrae <leon.alrae@imgtec.com>
-Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
-Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
-Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
----
- target-mips/op_helper.c | 9 +++++++--
- 1 files changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
-index 1aa9e3c..94de108 100644
---- a/target-mips/op_helper.c
-+++ b/target-mips/op_helper.c
-@@ -2184,10 +2184,15 @@ target_ulong helper_rdhwr_synci_step(CPUMIPSState *env)
- target_ulong helper_rdhwr_cc(CPUMIPSState *env)
- {
- if ((env->hflags & MIPS_HFLAG_CP0) ||
-- (env->CP0_HWREna & (1 << 2)))
-+ (env->CP0_HWREna & (1 << 2))) {
-+#ifdef CONFIG_USER_ONLY
- return env->CP0_Count;
-- else
-+#else
-+ return (int32_t)cpu_mips_get_count(env);
-+#endif
-+ } else {
- helper_raise_exception(env, EXCP_RI);
-+ }
-
- return 0;
- }
---
-1.7.0.4
-
diff --git a/app-emulation/qemu/files/qemu-2.4-mips-move-interrupts-new-func.patch b/app-emulation/qemu/files/qemu-2.4-mips-move-interrupts-new-func.patch
deleted file mode 100644
index 0ea5df5..0000000
--- a/app-emulation/qemu/files/qemu-2.4-mips-move-interrupts-new-func.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-Pending upstream inclusion
-
-Link: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg03573.html
-Patchwork: https://patchwork.ozlabs.org/patch/517392/
-X-Gentoo-Bug: 563162
-X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=563162
-
-Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
-
-diff --git a/target-mips/cpu.c b/target-mips/cpu.c
-index 4027d0f..144eea9 100644
---- a/target-mips/cpu.c
-+++ b/target-mips/cpu.c
-@@ -58,7 +58,9 @@ static bool mips_cpu_has_work(CPUState *cs)
- check for interrupts that can be taken. */
- if ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
- cpu_mips_hw_interrupts_pending(env)) {
-- has_work = true;
-+ if (cpu_mips_hw_interrupts_enabled(env)) {
-+ has_work = true;
-+ }
- }
-
- /* MIPS-MT has the ability to halt the CPU. */
-diff --git a/target-mips/cpu.h b/target-mips/cpu.h
-index c91883d..210370e 100644
---- a/target-mips/cpu.h
-+++ b/target-mips/cpu.h
-@@ -639,23 +639,24 @@ static inline int cpu_mmu_index (CPUMIPSState *env)
- return env->hflags & MIPS_HFLAG_KSU;
- }
-
--static inline int cpu_mips_hw_interrupts_pending(CPUMIPSState *env)
-+static inline bool cpu_mips_hw_interrupts_enabled(CPUMIPSState *env)
- {
-- int32_t pending;
-- int32_t status;
-- int r;
--
-- if (!(env->CP0_Status & (1 << CP0St_IE)) ||
-- (env->CP0_Status & (1 << CP0St_EXL)) ||
-- (env->CP0_Status & (1 << CP0St_ERL)) ||
-+ return (env->CP0_Status & (1 << CP0St_IE)) &&
-+ !(env->CP0_Status & (1 << CP0St_EXL)) &&
-+ !(env->CP0_Status & (1 << CP0St_ERL)) &&
-+ !(env->hflags & MIPS_HFLAG_DM) &&
- /* Note that the TCStatus IXMT field is initialized to zero,
- and only MT capable cores can set it to one. So we don't
- need to check for MT capabilities here. */
-- (env->active_tc.CP0_TCStatus & (1 << CP0TCSt_IXMT)) ||
-- (env->hflags & MIPS_HFLAG_DM)) {
-- /* Interrupts are disabled */
-- return 0;
-- }
-+ !(env->active_tc.CP0_TCStatus & (1 << CP0TCSt_IXMT));
-+}
-+
-+/* Check if there is pending and not masked out interrupt */
-+static inline bool cpu_mips_hw_interrupts_pending(CPUMIPSState *env)
-+{
-+ int32_t pending;
-+ int32_t status;
-+ bool r;
-
- pending = env->CP0_Cause & CP0Ca_IP_mask;
- status = env->CP0_Status & CP0Ca_IP_mask;
-@@ -669,7 +670,7 @@ static inline int cpu_mips_hw_interrupts_pending(CPUMIPSState *env)
- /* A MIPS configured with compatibility or VInt (Vectored Interrupts)
- treats the pending lines as individual interrupt lines, the status
- lines are individual masks. */
-- r = pending & status;
-+ r = (pending & status) != 0;
- }
- return r;
- }
-diff --git a/target-mips/helper.c b/target-mips/helper.c
-index 01c4461..2d86323 100644
---- a/target-mips/helper.c
-+++ b/target-mips/helper.c
-@@ -759,7 +759,8 @@ bool mips_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
- MIPSCPU *cpu = MIPS_CPU(cs);
- CPUMIPSState *env = &cpu->env;
-
-- if (cpu_mips_hw_interrupts_pending(env)) {
-+ if (cpu_mips_hw_interrupts_enabled(env) &&
-+ cpu_mips_hw_interrupts_pending(env)) {
- /* Raise it */
- cs->exception_index = EXCP_EXT_INTERRUPT;
- env->error_code = 0;
diff --git a/app-emulation/qemu/files/qemu-2.4-mips-wake-up-on-irq.patch b/app-emulation/qemu/files/qemu-2.4-mips-wake-up-on-irq.patch
deleted file mode 100644
index 559a4af..0000000
--- a/app-emulation/qemu/files/qemu-2.4-mips-wake-up-on-irq.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Pending upstream inclusion
-
-Link: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg03572.html
-Patchwork: https://patchwork.ozlabs.org/patch/517391/
-X-Gentoo-Bug: 563162
-X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=563162
-
-Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
-diff --git a/target-mips/cpu.c b/target-mips/cpu.c
-index 144eea9..cbeca04 100644
---- a/target-mips/cpu.c
-+++ b/target-mips/cpu.c
-@@ -53,12 +53,13 @@ static bool mips_cpu_has_work(CPUState *cs)
- CPUMIPSState *env = &cpu->env;
- bool has_work = false;
-
-- /* It is implementation dependent if non-enabled interrupts
-- wake-up the CPU, however most of the implementations only
-+ /* Prior to MIPS Release 6 it is implementation dependent if non-enabled
-+ interrupts wake-up the CPU, however most of the implementations only
- check for interrupts that can be taken. */
- if ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
- cpu_mips_hw_interrupts_pending(env)) {
-- if (cpu_mips_hw_interrupts_enabled(env)) {
-+ if (cpu_mips_hw_interrupts_enabled(env) ||
-+ (env->insn_flags & ISA_MIPS32R6)) {
- has_work = true;
- }
- }
diff --git a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7504.patch b/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7504.patch
deleted file mode 100644
index e86e0c6..0000000
--- a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7504.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 837f21aacf5a714c23ddaadbbc5212f9b661e3f7 Mon Sep 17 00:00:00 2001
-From: Prasad J Pandit <pjp@fedoraproject.org>
-Date: Fri, 20 Nov 2015 11:50:31 +0530
-Subject: [PATCH] net: pcnet: add check to validate receive data
- size(CVE-2015-7504)
-
-In loopback mode, pcnet_receive routine appends CRC code to the
-receive buffer. If the data size given is same as the buffer size,
-the appended CRC code overwrites 4 bytes after s->buffer. Added a
-check to avoid that.
-
-Reported by: Qinghao Tang <luodalongde@gmail.com>
-Cc: qemu-stable@nongnu.org
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
----
- hw/net/pcnet.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
-index 0eb3cc4..309c40b 100644
---- a/hw/net/pcnet.c
-+++ b/hw/net/pcnet.c
-@@ -1084,7 +1084,7 @@ ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
- uint32_t fcs = ~0;
- uint8_t *p = src;
-
-- while (p != &src[size-4])
-+ while (p != &src[size])
- CRC(fcs, *p++);
- crc_err = (*(uint32_t *)p != htonl(fcs));
- }
-@@ -1233,8 +1233,10 @@ static void pcnet_transmit(PCNetState *s)
- bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
-
- /* if multi-tmd packet outsizes s->buffer then skip it silently.
-- Note: this is not what real hw does */
-- if (s->xmit_pos + bcnt > sizeof(s->buffer)) {
-+ * Note: this is not what real hw does.
-+ * Last four bytes of s->buffer are used to store CRC FCS code.
-+ */
-+ if (s->xmit_pos + bcnt > sizeof(s->buffer) - 4) {
- s->xmit_pos = -1;
- goto txdone;
- }
---
-2.6.2
-
diff --git a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7512.patch b/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7512.patch
deleted file mode 100644
index 4fee9ef..0000000
--- a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7512.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 8b98a2f07175d46c3f7217639bd5e03f2ec56343 Mon Sep 17 00:00:00 2001
-From: Jason Wang <jasowang@redhat.com>
-Date: Mon, 30 Nov 2015 15:00:06 +0800
-Subject: [PATCH] pcnet: fix rx buffer overflow(CVE-2015-7512)
-
-Backends could provide a packet whose length is greater than buffer
-size. Check for this and truncate the packet to avoid rx buffer
-overflow in this case.
-
-Cc: Prasad J Pandit <pjp@fedoraproject.org>
-Cc: qemu-stable@nongnu.org
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
----
- hw/net/pcnet.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
-index 309c40b..1f4a3db 100644
---- a/hw/net/pcnet.c
-+++ b/hw/net/pcnet.c
-@@ -1064,6 +1064,12 @@ ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
- int pktcount = 0;
-
- if (!s->looptest) {
-+ if (size > 4092) {
-+#ifdef PCNET_DEBUG_RMD
-+ fprintf(stderr, "pcnet: truncates rx packet.\n");
-+#endif
-+ size = 4092;
-+ }
- memcpy(src, buf, size);
- /* no need to compute the CRC */
- src[size] = 0;
---
-2.6.2
-
diff --git a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7549.patch b/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7549.patch
deleted file mode 100644
index 897fe34..0000000
--- a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-7549.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-https://bugs.gentoo.org/568214
-
-From 43b11a91dd861a946b231b89b7542856ade23d1b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
-Date: Fri, 26 Jun 2015 14:25:29 +0200
-Subject: [PATCH] msix: implement pba write (but read-only)
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-qpci_msix_pending() writes on pba region, causing qemu to SEGV:
-
- Program received signal SIGSEGV, Segmentation fault.
- [Switching to Thread 0x7ffff7fba8c0 (LWP 25882)]
- 0x0000000000000000 in ?? ()
- (gdb) bt
- #0 0x0000000000000000 in ()
- #1 0x00005555556556c5 in memory_region_oldmmio_write_accessor (mr=0x5555579f3f80, addr=0, value=0x7fffffffbf68, size=4, shift=0, mask=4294967295, attrs=...) at /home/elmarco/src/qemu/memory.c:434
- #2 0x00005555556558e1 in access_with_adjusted_size (addr=0, value=0x7fffffffbf68, size=4, access_size_min=1, access_size_max=4, access=0x55555565563e <memory_region_oldmmio_write_accessor>, mr=0x5555579f3f80, attrs=...) at /home/elmarco/src/qemu/memory.c:506
- #3 0x00005555556581eb in memory_region_dispatch_write (mr=0x5555579f3f80, addr=0, data=0, size=4, attrs=...) at /home/elmarco/src/qemu/memory.c:1176
- #4 0x000055555560b6f9 in address_space_rw (as=0x555555eff4e0 <address_space_memory>, addr=3759147008, attrs=..., buf=0x7fffffffc1b0 "", len=4, is_write=true) at /home/elmarco/src/qemu/exec.c:2439
- #5 0x000055555560baa2 in cpu_physical_memory_rw (addr=3759147008, buf=0x7fffffffc1b0 "", len=4, is_write=1) at /home/elmarco/src/qemu/exec.c:2534
- #6 0x000055555564c005 in cpu_physical_memory_write (addr=3759147008, buf=0x7fffffffc1b0, len=4) at /home/elmarco/src/qemu/include/exec/cpu-common.h:80
- #7 0x000055555564cd9c in qtest_process_command (chr=0x55555642b890, words=0x5555578de4b0) at /home/elmarco/src/qemu/qtest.c:378
- #8 0x000055555564db77 in qtest_process_inbuf (chr=0x55555642b890, inbuf=0x55555641b340) at /home/elmarco/src/qemu/qtest.c:569
- #9 0x000055555564dc07 in qtest_read (opaque=0x55555642b890, buf=0x7fffffffc2e0 "writel 0xe0100800 0x0\n", size=22) at /home/elmarco/src/qemu/qtest.c:581
- #10 0x000055555574ce3e in qemu_chr_be_write (s=0x55555642b890, buf=0x7fffffffc2e0 "writel 0xe0100800 0x0\n", len=22) at qemu-char.c:306
- #11 0x0000555555751263 in tcp_chr_read (chan=0x55555642bcf0, cond=G_IO_IN, opaque=0x55555642b890) at qemu-char.c:2876
- #12 0x00007ffff64c9a8a in g_main_context_dispatch (context=0x55555641c400) at gmain.c:3122
-
-(without this patch, this can be reproduced with the ivshmem qtest)
-
-Implement an empty mmio write to avoid the crash.
-
-Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
----
- hw/pci/msix.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/hw/pci/msix.c b/hw/pci/msix.c
-index 2fdada4..64c93d8 100644
---- a/hw/pci/msix.c
-+++ b/hw/pci/msix.c
-@@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
- return pci_get_long(dev->msix_pba + addr);
- }
-
-+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
-+ uint64_t val, unsigned size)
-+{
-+}
-+
- static const MemoryRegionOps msix_pba_mmio_ops = {
- .read = msix_pba_mmio_read,
-+ .write = msix_pba_mmio_write,
- .endianness = DEVICE_LITTLE_ENDIAN,
- .valid = {
- .min_access_size = 4,
---
-2.6.2
-
diff --git a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-8345.patch b/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-8345.patch
deleted file mode 100644
index f01d9ac..0000000
--- a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-8345.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-https://bugs.gentoo.org/566792
-
-From 00837731d254908a841d69298a4f9f077babaf24 Mon Sep 17 00:00:00 2001
-From: Stefan Weil <sw@weilnetz.de>
-Date: Fri, 20 Nov 2015 08:42:33 +0100
-Subject: [PATCH] eepro100: Prevent two endless loops
-
-http://lists.nongnu.org/archive/html/qemu-devel/2015-11/msg04592.html
-shows an example how an endless loop in function action_command can
-be achieved.
-
-During my code review, I noticed a 2nd case which can result in an
-endless loop.
-
-Reported-by: Qinghao Tang <luodalongde@gmail.com>
-Signed-off-by: Stefan Weil <sw@weilnetz.de>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
----
- hw/net/eepro100.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
-
-diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
-index 60333b7..685a478 100644
---- a/hw/net/eepro100.c
-+++ b/hw/net/eepro100.c
-@@ -774,6 +774,11 @@ static void tx_command(EEPRO100State *s)
- #if 0
- uint16_t tx_buffer_el = lduw_le_pci_dma(&s->dev, tbd_address + 6);
- #endif
-+ if (tx_buffer_size == 0) {
-+ /* Prevent an endless loop. */
-+ logout("loop in %s:%u\n", __FILE__, __LINE__);
-+ break;
-+ }
- tbd_address += 8;
- TRACE(RXTX, logout
- ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n",
-@@ -855,6 +860,10 @@ static void set_multicast_list(EEPRO100State *s)
-
- static void action_command(EEPRO100State *s)
- {
-+ /* The loop below won't stop if it gets special handcrafted data.
-+ Therefore we limit the number of iterations. */
-+ unsigned max_loop_count = 16;
-+
- for (;;) {
- bool bit_el;
- bool bit_s;
-@@ -870,6 +879,13 @@ static void action_command(EEPRO100State *s)
- #if 0
- bool bit_sf = ((s->tx.command & COMMAND_SF) != 0);
- #endif
-+
-+ if (max_loop_count-- == 0) {
-+ /* Prevent an endless loop. */
-+ logout("loop in %s:%u\n", __FILE__, __LINE__);
-+ break;
-+ }
-+
- s->cu_offset = s->tx.link;
- TRACE(OTHER,
- logout("val=(cu start), status=0x%04x, command=0x%04x, link=0x%08x\n",
---
-2.6.2
-
diff --git a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-8504.patch b/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-8504.patch
deleted file mode 100644
index 7b0102a..0000000
--- a/app-emulation/qemu/files/qemu-2.4.1-CVE-2015-8504.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-https://bugs.gentoo.org/567828
-
-From 4c65fed8bdf96780735dbdb92a8bd0d6b6526cc3 Mon Sep 17 00:00:00 2001
-From: Prasad J Pandit <pjp@fedoraproject.org>
-Date: Thu, 3 Dec 2015 18:54:17 +0530
-Subject: [PATCH] ui: vnc: avoid floating point exception
-
-While sending 'SetPixelFormat' messages to a VNC server,
-the client could set the 'red-max', 'green-max' and 'blue-max'
-values to be zero. This leads to a floating point exception in
-write_png_palette while doing frame buffer updates.
-
-Reported-by: Lian Yihan <lianyihan@360.cn>
-Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
-Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
----
- ui/vnc.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/ui/vnc.c b/ui/vnc.c
-index 7538405..cbe4d33 100644
---- a/ui/vnc.c
-+++ b/ui/vnc.c
-@@ -2198,15 +2198,15 @@ static void set_pixel_format(VncState *vs,
- return;
- }
-
-- vs->client_pf.rmax = red_max;
-+ vs->client_pf.rmax = red_max ? red_max : 0xFF;
- vs->client_pf.rbits = hweight_long(red_max);
- vs->client_pf.rshift = red_shift;
- vs->client_pf.rmask = red_max << red_shift;
-- vs->client_pf.gmax = green_max;
-+ vs->client_pf.gmax = green_max ? green_max : 0xFF;
- vs->client_pf.gbits = hweight_long(green_max);
- vs->client_pf.gshift = green_shift;
- vs->client_pf.gmask = green_max << green_shift;
-- vs->client_pf.bmax = blue_max;
-+ vs->client_pf.bmax = blue_max ? blue_max : 0xFF;
- vs->client_pf.bbits = hweight_long(blue_max);
- vs->client_pf.bshift = blue_shift;
- vs->client_pf.bmask = blue_max << blue_shift;
---
-2.6.2
-
diff --git a/app-emulation/qemu/qemu-2.4.1-r2.ebuild b/app-emulation/qemu/qemu-2.4.1-r2.ebuild
deleted file mode 100644
index a42f99b..0000000
--- a/app-emulation/qemu/qemu-2.4.1-r2.ebuild
+++ /dev/null
@@ -1,642 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
-virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( dev-libs/nss !app-emulation/libcacard )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- tls? ( net-libs/gnutls[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-{7504,7512}.patch #567144
- epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-8345.patch #566792
- epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-8504.patch #567828
- epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-7549.patch #568214
- epatch "${FILESDIR}"/${PN}-2.4-mips-* #563162
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard smartcard-nss)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu tls vnc-tls)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp/*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.5.0.ebuild b/app-emulation/qemu/qemu-2.5.0.ebuild
deleted file mode 100644
index 70f595e..0000000
--- a/app-emulation/qemu/qemu-2.5.0.ebuild
+++ /dev/null
@@ -1,651 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo pax-utils
-
-BACKPORTS=
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
- ${BACKPORTS:+
- https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
- KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
-gnutls gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
-virgl virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-#
-# Older versions of gnutls are supported, but it's simpler to just require
-# the latest versions. This is also why we require nettle.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle[static-libs(+)]
- >=net-libs/gnutls-3.0[static-libs(+)]
- )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.90 )
- )
- )
- infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gles2]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'\n
-For Intel CPUs the module is called 'kvm-intel'\n
-Please review /etc/conf.d/modules for how to load these\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- # Cheap hack to disable gettext .mo generation.
- use nls || rm -f po/*.po
-
- epatch "${FILESDIR}"/qemu-2.5.0-cflags.patch
- [[ -n ${BACKPORTS} ]] && \
- EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
- epatch
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gnutls)
- $(conf_softmmu gnutls nettle)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/kvm_stat"
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp-*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2016-03-28 22:03 Mike Frysinger
0 siblings, 0 replies; 66+ messages in thread
From: Mike Frysinger @ 2016-03-28 22:03 UTC (permalink / raw
To: gentoo-commits
commit: 5ffdef327ca2184359715dccb7a74373ef3d6a78
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 28 22:03:37 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Mar 28 22:03:45 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ffdef32
app-emulation/qemu: add few more upstream fixes #573816 #578142
.../qemu/files/qemu-2.5.0-9pfs-segfault.patch | 34 +
.../qemu/files/qemu-2.5.0-ne2000-reg-check.patch | 37 ++
app-emulation/qemu/qemu-2.5.0-r3.ebuild | 696 +++++++++++++++++++++
3 files changed, 767 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.5.0-9pfs-segfault.patch b/app-emulation/qemu/files/qemu-2.5.0-9pfs-segfault.patch
new file mode 100644
index 0000000..0e27684
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.5.0-9pfs-segfault.patch
@@ -0,0 +1,34 @@
+From 4b3a4f2d458ca5a7c6c16ac36a8d9ac22cc253d6 Mon Sep 17 00:00:00 2001
+From: Greg Kurz <gkurz@linux.vnet.ibm.com>
+Date: Wed, 23 Dec 2015 10:56:58 +0100
+Subject: [PATCH] virtio-9p: use accessor to get thread_pool
+
+The aio_context_new() function does not allocate a thread pool. This is
+deferred to the first call to the aio_get_thread_pool() accessor. It is
+hence forbidden to access the thread_pool field directly, as it may be
+NULL. The accessor *must* be used always.
+
+Fixes: ebac1202c95a4f1b76b6ef3f0f63926fa76e753e
+Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
+Tested-by: Michael Tokarev <mjt@tls.msk.ru>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
+---
+ hw/9pfs/virtio-9p-coth.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/9pfs/virtio-9p-coth.c b/hw/9pfs/virtio-9p-coth.c
+index fb6e8f8..ab9425c 100644
+--- a/hw/9pfs/virtio-9p-coth.c
++++ b/hw/9pfs/virtio-9p-coth.c
+@@ -36,6 +36,6 @@ static int coroutine_enter_func(void *arg)
+ void co_run_in_worker_bh(void *opaque)
+ {
+ Coroutine *co = opaque;
+- thread_pool_submit_aio(qemu_get_aio_context()->thread_pool,
++ thread_pool_submit_aio(aio_get_thread_pool(qemu_get_aio_context()),
+ coroutine_enter_func, co, coroutine_enter_cb, co);
+ }
+--
+2.7.4
+
diff --git a/app-emulation/qemu/files/qemu-2.5.0-ne2000-reg-check.patch b/app-emulation/qemu/files/qemu-2.5.0-ne2000-reg-check.patch
new file mode 100644
index 0000000..2874b75
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.5.0-ne2000-reg-check.patch
@@ -0,0 +1,37 @@
+From 415ab35a441eca767d033a2702223e785b9d5190 Mon Sep 17 00:00:00 2001
+From: Prasad J Pandit <pjp@fedoraproject.org>
+Date: Wed, 24 Feb 2016 11:41:33 +0530
+Subject: [PATCH] net: ne2000: check ring buffer control registers
+
+Ne2000 NIC uses ring buffer of NE2000_MEM_SIZE(49152)
+bytes to process network packets. Registers PSTART & PSTOP
+define ring buffer size & location. Setting these registers
+to invalid values could lead to infinite loop or OOB r/w
+access issues. Add check to avoid it.
+
+Reported-by: Yang Hongke <yanghongke@huawei.com>
+Tested-by: Yang Hongke <yanghongke@huawei.com>
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+---
+ hw/net/ne2000.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
+index e408083..f0feaf9 100644
+--- a/hw/net/ne2000.c
++++ b/hw/net/ne2000.c
+@@ -155,6 +155,10 @@ static int ne2000_buffer_full(NE2000State *s)
+ {
+ int avail, index, boundary;
+
++ if (s->stop <= s->start) {
++ return 1;
++ }
++
+ index = s->curpag << 8;
+ boundary = s->boundary << 8;
+ if (index < boundary)
+--
+2.7.4
+
diff --git a/app-emulation/qemu/qemu-2.5.0-r3.ebuild b/app-emulation/qemu/qemu-2.5.0-r3.ebuild
new file mode 100644
index 0000000..5d27b99
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.5.0-r3.ebuild
@@ -0,0 +1,696 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="de_DE fr_FR hu it tr zh_CN"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo pax-utils l10n
+
+BACKPORTS=
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
+ ${BACKPORTS:+
+ https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
+gnutls gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
+static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
+virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+#
+# Older versions of gnutls are supported, but it's simpler to just require
+# the latest versions. This is also why we require nettle.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? ( app-accessibility/brltty[static-libs(+)] )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle[static-libs(+)]
+ >=net-libs/gnutls-3.0[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.90 )
+ )
+ )
+ infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gles2]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.8.2
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xen? ( app-emulation/xen-tools:= )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'\n
+For Intel CPUs the module is called 'kvm-intel'\n
+Please review /etc/conf.d/modules for how to load these\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ epatch "${FILESDIR}"/qemu-2.5.0-cflags.patch
+ [[ -n ${BACKPORTS} ]] && \
+ EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
+ epatch
+
+ epatch "${FILESDIR}"/${P}-CVE-2015-8567.patch #567868
+ epatch "${FILESDIR}"/${P}-CVE-2015-8558.patch #568246
+ epatch "${FILESDIR}"/${P}-CVE-2015-8701.patch #570110
+ epatch "${FILESDIR}"/${P}-CVE-2015-8743.patch #570988
+ epatch "${FILESDIR}"/${P}-CVE-2016-1568.patch #571566
+ epatch "${FILESDIR}"/${P}-CVE-2015-8613.patch #569118
+ epatch "${FILESDIR}"/${P}-CVE-2015-8619.patch #569300
+ epatch "${FILESDIR}"/${P}-CVE-2016-1714.patch #571560
+ epatch "${FILESDIR}"/${P}-CVE-2016-1922.patch #572082
+ epatch "${FILESDIR}"/${P}-CVE-2016-1981.patch #572412
+ epatch "${FILESDIR}"/${P}-usb-ehci-oob.patch #572454
+ epatch "${FILESDIR}"/${P}-CVE-2016-2197.patch #573280
+ epatch "${FILESDIR}"/${P}-CVE-2016-2198.patch #573314
+ epatch "${FILESDIR}"/${P}-CVE-2016-2392.patch #574902
+ epatch "${FILESDIR}"/${P}-usb-ndis-int-overflow.patch #575492
+ epatch "${FILESDIR}"/${P}-rng-stack-corrupt-{0,1,2,3}.patch #576420
+ epatch "${FILESDIR}"/${P}-sysmacros.patch
+ epatch "${FILESDIR}"/${P}-ne2000-reg-check.patch #573816
+ epatch "${FILESDIR}"/${P}-9pfs-segfault.patch #578142
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+
+ # Run after we've applied all patches.
+ handle_locales
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+ local static_flag="static-${buildtype}"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gnutls)
+ $(conf_softmmu gnutls nettle)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu uuid)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu vte)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ )
+ static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/kvm_stat"
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_dorules "${FILESDIR}"/65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp-*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2016-09-10 2:23 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2016-09-10 2:23 UTC (permalink / raw
To: gentoo-commits
commit: eaeffb27d67769a089170dcc45ea3e8a4efb645b
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 10 02:23:22 2016 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sat Sep 10 02:23:22 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eaeffb27
app-emulation/qemu: apply fix for CVE-2016-7170, bug #593284
Package-Manager: portage-2.2.28
.../qemu/files/qemu-2.7.0-CVE-2016-7170.patch | 40 ++++++++++++++++++++++
.../{qemu-2.7.0-r1.ebuild => qemu-2.7.0-r2.ebuild} | 1 +
2 files changed, 41 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch
new file mode 100644
index 00000000..7eb5f76
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch
@@ -0,0 +1,40 @@
+From: Prasad J Pandit <address@hidden>
+
+When processing svga command DEFINE_CURSOR in vmsvga_fifo_run,
+the computed BITMAP and PIXMAP size are checked against the
+'cursor.mask[]' and 'cursor.image[]' array sizes in bytes.
+Correct these checks to avoid OOB memory access.
+
+Reported-by: Qinghao Tang <address@hidden>
+Reported-by: Li Qiang <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/display/vmware_vga.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
+index e51a05e..6599cf0 100644
+--- a/hw/display/vmware_vga.c
++++ b/hw/display/vmware_vga.c
+@@ -676,11 +676,13 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
+ cursor.bpp = vmsvga_fifo_read(s);
+
+ args = SVGA_BITMAP_SIZE(x, y) + SVGA_PIXMAP_SIZE(x, y, cursor.bpp);
+- if (cursor.width > 256 ||
+- cursor.height > 256 ||
+- cursor.bpp > 32 ||
+- SVGA_BITMAP_SIZE(x, y) > sizeof cursor.mask ||
+- SVGA_PIXMAP_SIZE(x, y, cursor.bpp) > sizeof cursor.image) {
++ if (cursor.width > 256
++ || cursor.height > 256
++ || cursor.bpp > 32
++ || SVGA_BITMAP_SIZE(x, y)
++ > sizeof(cursor.mask) / sizeof(cursor.mask[0])
++ || SVGA_PIXMAP_SIZE(x, y, cursor.bpp)
++ > sizeof(cursor.image) / sizeof(cursor.image[0])) {
+ goto badcmd;
+ }
+
+--
+2.5.5
+
diff --git a/app-emulation/qemu/qemu-2.7.0-r1.ebuild b/app-emulation/qemu/qemu-2.7.0-r2.ebuild
similarity index 99%
rename from app-emulation/qemu/qemu-2.7.0-r1.ebuild
rename to app-emulation/qemu/qemu-2.7.0-r2.ebuild
index c75b7b6..42a669e 100644
--- a/app-emulation/qemu/qemu-2.7.0-r1.ebuild
+++ b/app-emulation/qemu/qemu-2.7.0-r2.ebuild
@@ -340,6 +340,7 @@ src_prepare() {
epatch "${FILESDIR}"/${P}-CVE-2016-7156.patch # bug 593036
epatch "${FILESDIR}"/${P}-CVE-2016-7157-1.patch # bug 593038
epatch "${FILESDIR}"/${P}-CVE-2016-7157-2.patch # bug 593038
+ epatch "${FILESDIR}"/${P}-CVE-2016-7170.patch # bug 593284
# Fix ld and objcopy being called directly
tc-export AR LD OBJCOPY
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2016-09-18 4:33 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2016-09-18 4:33 UTC (permalink / raw
To: gentoo-commits
commit: b50850bf14489740441b408a2d45f6e64d724f7d
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 18 04:02:53 2016 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 04:24:07 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b50850bf
app-emulation/qemu: security fixes, ebuild maintenance
bug 593956: CVE-2016-7422
bug 593950: CVE-2016-7421
bug 590230: missing use depend opengl? ( media-libs/mesa[...,gbm] )
bug 575326: update to readme.gentoo-r1 eclass
Package-Manager: portage-2.2.28
.../qemu/files/qemu-2.7.0-CVE-2016-7421.patch | 34 +
.../qemu/files/qemu-2.7.0-CVE-2016-7422.patch | 38 ++
app-emulation/qemu/qemu-2.7.0-r3.ebuild | 687 +++++++++++++++++++++
3 files changed, 759 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch
new file mode 100644
index 00000000..b9f3545
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch
@@ -0,0 +1,34 @@
+From: Prasad J Pandit <address@hidden>
+
+Vmware Paravirtual SCSI emulator while processing IO requests
+could run into an infinite loop if 'pvscsi_ring_pop_req_descr'
+always returned positive value. Limit IO loop to the ring size.
+
+Cc: address@hidden
+Reported-by: Li Qiang <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+Message-Id: <address@hidden>
+Signed-off-by: Paolo Bonzini <address@hidden>
+---
+ hw/scsi/vmw_pvscsi.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
+index babac5a..a5ce7de 100644
+--- a/hw/scsi/vmw_pvscsi.c
++++ b/hw/scsi/vmw_pvscsi.c
+@@ -247,8 +247,11 @@ static hwaddr
+ pvscsi_ring_pop_req_descr(PVSCSIRingInfo *mgr)
+ {
+ uint32_t ready_ptr = RS_GET_FIELD(mgr, reqProdIdx);
++ uint32_t ring_size = PVSCSI_MAX_NUM_PAGES_REQ_RING
++ * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
+
+- if (ready_ptr != mgr->consumed_ptr) {
++ if (ready_ptr != mgr->consumed_ptr
++ && ready_ptr - mgr->consumed_ptr < ring_size) {
+ uint32_t next_ready_ptr =
+ mgr->consumed_ptr++ & mgr->txr_len_mask;
+ uint32_t next_ready_page =
+--
+1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch
new file mode 100644
index 00000000..6368e7f
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch
@@ -0,0 +1,38 @@
+From: Prasad J Pandit <address@hidden>
+
+virtio back end uses set of buffers to facilitate I/O operations.
+If its size is too large, 'cpu_physical_memory_map' could return
+a null address. This would result in a null dereference
+while un-mapping descriptors. Add check to avoid it.
+
+Reported-by: Qinghao Tang <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/virtio/virtio.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
+index 15ee3a7..0a4c5b6 100644
+--- a/hw/virtio/virtio.c
++++ b/hw/virtio/virtio.c
+@@ -472,12 +472,14 @@ static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iove
+ }
+
+ iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);
+- iov[num_sg].iov_len = len;
+- addr[num_sg] = pa;
++ if (iov[num_sg].iov_base) {
++ iov[num_sg].iov_len = len;
++ addr[num_sg] = pa;
+
++ pa += len;
++ num_sg++;
++ }
+ sz -= len;
+- pa += len;
+- num_sg++;
+ }
+ *p_num_sg = num_sg;
+ }
+--
+2.5.5
diff --git a/app-emulation/qemu/qemu-2.7.0-r3.ebuild b/app-emulation/qemu/qemu-2.7.0-r3.ebuild
new file mode 100644
index 00000000..203cdc7
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.7.0-r3.ebuild
@@ -0,0 +1,687 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
+gnutls gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
+static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
+virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+#
+# Older versions of gnutls are supported, but it's simpler to just require
+# the latest versions. This is also why we require nettle.
+#
+# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
+# system binaries and tools, not user binaries.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ dev-libs/libpcre[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? ( app-accessibility/brltty[static-libs(+)] )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.90 )
+ )
+ )
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gles2,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.8.2
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xen? ( app-emulation/xen-tools:= )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'.\n
+For Intel CPUs the module is called 'kvm-intel'.\n
+Please review /etc/conf.d/modules for how to load these.\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
+For brand new installs, the default permissions on /dev/kvm might not let you
+access it. You can tell udev to reset ownership/perms:\n
+udevadm trigger -c add /dev/kvm"
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ epatch "${FILESDIR}"/${P}-CVE-2016-6836.patch # bug 591242
+ epatch "${FILESDIR}"/${P}-CVE-2016-7155.patch # bug 593034
+ epatch "${FILESDIR}"/${P}-CVE-2016-7156.patch # bug 593036
+ epatch "${FILESDIR}"/${P}-CVE-2016-7157-1.patch # bug 593038
+ epatch "${FILESDIR}"/${P}-CVE-2016-7157-2.patch # bug 593038
+ epatch "${FILESDIR}"/${P}-CVE-2016-7170.patch # bug 593284
+ epatch "${FILESDIR}"/${P}-CVE-2016-7421.patch # bug 593950
+ epatch "${FILESDIR}"/${P}-CVE-2016-7422.patch # bug 593956
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+
+ # Run after we've applied all patches.
+ handle_locales
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+ local static_flag="static-${buildtype}"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bzip2)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gnutls)
+ $(conf_softmmu gnutls nettle)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu uuid)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu vte)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ $(use_enable bzip2)
+ )
+ static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_dorules "${FILESDIR}"/65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp-*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2016-10-26 21:48 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2016-10-26 21:48 UTC (permalink / raw
To: gentoo-commits
commit: 5a981e9d23127c779dc8ecb1d05ef08fe4d3a011
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 26 21:47:50 2016 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Wed Oct 26 21:48:21 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a981e9d
app-emulation/qemu: multiple security fixes for 2.7.0-r5
CVE-2016-7466, bug 594520
CVE-2016-7907, bug 596048
CVE-2016-7908, bug 596049
CVE-2016-7909, bug 596048
CVE-2016-7994, bug 596738
CVE-2016-7994, bug 596738
CVE-2016-8576, bug 596752
CVE-2016-8577, bug 596776
CVE-2016-8578, bug 596774
CVE-2016-8668, bug 597110
CVE-2016-8669, bug 597108
CVE-2016-8669, bug 597108
CVE-2016-8909, bug 598044
CVE-2016-8910, bug 598046
Package-Manager: portage-2.3.0
.../qemu/files/qemu-2.7.0-CVE-2016-7907.patch | 45 ++
.../qemu/files/qemu-2.7.0-CVE-2016-7908.patch | 52 ++
.../qemu/files/qemu-2.7.0-CVE-2016-7909.patch | 32 +
.../qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch | 25 +
.../qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch | 26 +
.../qemu/files/qemu-2.7.0-CVE-2016-8576.patch | 61 ++
.../qemu/files/qemu-2.7.0-CVE-2016-8577.patch | 34 +
.../qemu/files/qemu-2.7.0-CVE-2016-8578.patch | 58 ++
.../qemu/files/qemu-2.7.0-CVE-2016-8668.patch | 30 +
.../qemu/files/qemu-2.7.0-CVE-2016-8669-1.patch | 29 +
.../qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch | 34 +
.../qemu/files/qemu-2.7.0-CVE-2016-8909.patch | 31 +
.../qemu/files/qemu-2.7.0-CVE-2016-8910.patch | 29 +
app-emulation/qemu/qemu-2.7.0-r5.ebuild | 703 +++++++++++++++++++++
14 files changed, 1189 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch
new file mode 100644
index 00000000..34b095a
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch
@@ -0,0 +1,45 @@
+From: Prasad J Pandit <address@hidden>
+
+i.MX Fast Ethernet Controller uses buffer descriptors to manage
+data flow to/fro receive & transmit queues. While transmitting
+packets, it could continue to read buffer descriptors if a buffer
+descriptor has length of zero and has crafted values in bd.flags.
+Set an upper limit to number of buffer descriptors.
+
+Reported-by: Li Qiang <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/net/imx_fec.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+Update per
+ -> https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05284.html
+
+diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
+index 1c415ab..1d74827 100644
+--- a/hw/net/imx_fec.c
++++ b/hw/net/imx_fec.c
+@@ -220,6 +220,8 @@ static const VMStateDescription vmstate_imx_eth = {
+ #define PHY_INT_PARFAULT (1 << 2)
+ #define PHY_INT_AUTONEG_PAGE (1 << 1)
+
++#define IMX_MAX_DESC 1024
++
+ static void imx_eth_update(IMXFECState *s);
+
+ /*
+@@ -402,12 +404,12 @@ static void imx_eth_update(IMXFECState *s)
+
+ static void imx_fec_do_tx(IMXFECState *s)
+ {
+- int frame_size = 0;
++ int frame_size = 0, descnt = 0;
+ uint8_t frame[ENET_MAX_FRAME_SIZE];
+ uint8_t *ptr = frame;
+ uint32_t addr = s->tx_descriptor;
+
+- while (1) {
++ while (descnt++ < IMX_MAX_DESC) {
+ IMXFECBufDesc bd;
+ int len;
+
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch
new file mode 100644
index 00000000..16d072f
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch
@@ -0,0 +1,52 @@
+From 070c4b92b8cd5390889716677a0b92444d6e087a Mon Sep 17 00:00:00 2001
+From: Prasad J Pandit <pjp@fedoraproject.org>
+Date: Thu, 22 Sep 2016 16:02:37 +0530
+Subject: [PATCH] net: mcf: limit buffer descriptor count
+
+ColdFire Fast Ethernet Controller uses buffer descriptors to manage
+data flow to/fro receive & transmit queues. While transmitting
+packets, it could continue to read buffer descriptors if a buffer
+descriptor has length of zero and has crafted values in bd.flags.
+Set upper limit to number of buffer descriptors.
+
+Reported-by: Li Qiang <liqiang6-s@360.cn>
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+---
+ hw/net/mcf_fec.c | 5 +++--
+ 1 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
+index 0ee8ad9..d31fea1 100644
+--- a/hw/net/mcf_fec.c
++++ b/hw/net/mcf_fec.c
+@@ -23,6 +23,7 @@ do { printf("mcf_fec: " fmt , ## __VA_ARGS__); } while (0)
+ #define DPRINTF(fmt, ...) do {} while(0)
+ #endif
+
++#define FEC_MAX_DESC 1024
+ #define FEC_MAX_FRAME_SIZE 2032
+
+ typedef struct {
+@@ -149,7 +150,7 @@ static void mcf_fec_do_tx(mcf_fec_state *s)
+ uint32_t addr;
+ mcf_fec_bd bd;
+ int frame_size;
+- int len;
++ int len, descnt = 0;
+ uint8_t frame[FEC_MAX_FRAME_SIZE];
+ uint8_t *ptr;
+
+@@ -157,7 +158,7 @@ static void mcf_fec_do_tx(mcf_fec_state *s)
+ ptr = frame;
+ frame_size = 0;
+ addr = s->tx_descriptor;
+- while (1) {
++ while (descnt++ < FEC_MAX_DESC) {
+ mcf_fec_read_bd(&bd, addr);
+ DPRINTF("tx_bd %x flags %04x len %d data %08x\n",
+ addr, bd.flags, bd.length, bd.data);
+--
+1.7.0.4
+
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch
new file mode 100644
index 00000000..8e6ecff
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch
@@ -0,0 +1,32 @@
+From: Prasad J Pandit <address@hidden>
+
+The AMD PC-Net II emulator has set of control and status(CSR)
+registers. Of these, CSR76 and CSR78 hold receive and transmit
+descriptor ring length respectively. This ring length could range
+from 1 to 65535. Setting ring length to zero leads to an infinite
+loop in pcnet_rdra_addr. Add check to avoid it.
+
+Reported-by: Li Qiang <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/net/pcnet.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
+index 198a01f..3078de8 100644
+--- a/hw/net/pcnet.c
++++ b/hw/net/pcnet.c
+@@ -1429,8 +1429,11 @@ static void pcnet_csr_writew(PCNetState *s, uint32_t rap, uint32_t new_value)
+ case 47: /* POLLINT */
+ case 72:
+ case 74:
++ break;
+ case 76: /* RCVRL */
+ case 78: /* XMTRL */
++ val = (val > 0) ? val : 512;
++ break;
+ case 112:
+ if (CSR_STOP(s) || CSR_SPND(s))
+ break;
+--
+2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch
new file mode 100644
index 00000000..6fe77f3
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch
@@ -0,0 +1,25 @@
+From: Li Qiang <address@hidden>
+
+In virtio gpu resource create dispatch, if the pixman format is zero
+it doesn't free the resource object allocated previously. Thus leading
+a host memory leak issue. This patch avoid this.
+
+Signed-off-by: Li Qiang <address@hidden>
+---
+ hw/display/virtio-gpu.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
+index 7fe6ed8..5b6d17b 100644
+--- a/hw/display/virtio-gpu.c
++++ b/hw/display/virtio-gpu.c
+@@ -333,6 +333,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "%s: host couldn't handle guest format %d\n",
+ __func__, c2d.format);
++ g_free(res);
+ cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
+ return;
+ }
+--
+1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch
new file mode 100644
index 00000000..dce1b2b
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch
@@ -0,0 +1,26 @@
+From: Li Qiang <address@hidden>
+
+While processing isochronous transfer descriptors(iTD), if the page
+select(PG) field value is out of bands it will return. In this
+situation the ehci's sg list doesn't be freed thus leading a memory
+leak issue. This patch avoid this.
+
+Signed-off-by: Li Qiang <address@hidden>
+---
+ hw/usb/hcd-ehci.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
+index b093db7..f4ece9a 100644
+--- a/hw/usb/hcd-ehci.c
++++ b/hw/usb/hcd-ehci.c
+@@ -1426,6 +1426,7 @@ static int ehci_process_itd(EHCIState *ehci,
+ if (off + len > 4096) {
+ /* transfer crosses page border */
+ if (pg == 6) {
++ qemu_sglist_destroy(&ehci->isgl);
+ return -1; /* avoid page pg + 1 */
+ }
+ ptr2 = (itd->bufptr[pg + 1] & ITD_BUFPTR_MASK);
+--
+1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch
new file mode 100644
index 00000000..9617cd5
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch
@@ -0,0 +1,61 @@
+From 20009bdaf95d10bf748fa69b104672d3cfaceddf Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <address@hidden>
+Date: Fri, 7 Oct 2016 10:15:29 +0200
+Subject: [PATCH] xhci: limit the number of link trbs we are willing to process
+
+Signed-off-by: Gerd Hoffmann <address@hidden>
+---
+ hw/usb/hcd-xhci.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
+index 726435c..ee4fa48 100644
+--- a/hw/usb/hcd-xhci.c
++++ b/hw/usb/hcd-xhci.c
+@@ -54,6 +54,8 @@
+ * to the specs when it gets them */
+ #define ER_FULL_HACK
+
++#define TRB_LINK_LIMIT 4
++
+ #define LEN_CAP 0x40
+ #define LEN_OPER (0x400 + 0x10 * MAXPORTS)
+ #define LEN_RUNTIME ((MAXINTRS + 1) * 0x20)
+@@ -1000,6 +1002,7 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
+ dma_addr_t *addr)
+ {
+ PCIDevice *pci_dev = PCI_DEVICE(xhci);
++ uint32_t link_cnt = 0;
+
+ while (1) {
+ TRBType type;
+@@ -1026,6 +1029,9 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
+ ring->dequeue += TRB_SIZE;
+ return type;
+ } else {
++ if (++link_cnt > TRB_LINK_LIMIT) {
++ return 0;
++ }
+ ring->dequeue = xhci_mask64(trb->parameter);
+ if (trb->control & TRB_LK_TC) {
+ ring->ccs = !ring->ccs;
+@@ -1043,6 +1049,7 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring)
+ bool ccs = ring->ccs;
+ /* hack to bundle together the two/three TDs that make a setup transfer */
+ bool control_td_set = 0;
++ uint32_t link_cnt = 0;
+
+ while (1) {
+ TRBType type;
+@@ -1058,6 +1065,9 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring)
+ type = TRB_TYPE(trb);
+
+ if (type == TR_LINK) {
++ if (++link_cnt > TRB_LINK_LIMIT) {
++ return -length;
++ }
+ dequeue = xhci_mask64(trb.parameter);
+ if (trb.control & TRB_LK_TC) {
+ ccs = !ccs;
+--
+1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch
new file mode 100644
index 00000000..8c29580
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch
@@ -0,0 +1,34 @@
+From: Li Qiang <address@hidden>
+
+In 9pfs read dispatch function, it doesn't free two QEMUIOVector
+object thus causing potential memory leak. This patch avoid this.
+
+Signed-off-by: Li Qiang <address@hidden>
+---
+ hw/9pfs/9p.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
+index 119ee58..543a791 100644
+--- a/hw/9pfs/9p.c
++++ b/hw/9pfs/9p.c
+@@ -1826,14 +1826,15 @@ static void v9fs_read(void *opaque)
+ if (len < 0) {
+ /* IO error return the error */
+ err = len;
+- goto out;
++ goto out_free_iovec;
+ }
+ } while (count < max_count && len > 0);
+ err = pdu_marshal(pdu, offset, "d", count);
+ if (err < 0) {
+- goto out;
++ goto out_free_iovec;
+ }
+ err += offset + count;
++out_free_iovec:
+ qemu_iovec_destroy(&qiov);
+ qemu_iovec_destroy(&qiov_full);
+ } else if (fidp->fid_type == P9_FID_XATTR) {
+--
+1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch
new file mode 100644
index 00000000..74eee7e
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch
@@ -0,0 +1,58 @@
+From ba42ebb863ab7d40adc79298422ed9596df8f73a Mon Sep 17 00:00:00 2001
+From: Li Qiang <liqiang6-s@360.cn>
+Date: Mon, 17 Oct 2016 14:13:58 +0200
+Subject: [PATCH] 9pfs: allocate space for guest originated empty strings
+
+If a guest sends an empty string paramater to any 9P operation, the current
+code unmarshals it into a V9fsString equal to { .size = 0, .data = NULL }.
+
+This is unfortunate because it can cause NULL pointer dereference to happen
+at various locations in the 9pfs code. And we don't want to check str->data
+everywhere we pass it to strcmp() or any other function which expects a
+dereferenceable pointer.
+
+This patch enforces the allocation of genuine C empty strings instead, so
+callers don't have to bother.
+
+Out of all v9fs_iov_vunmarshal() users, only v9fs_xattrwalk() checks if
+the returned string is empty. It now uses v9fs_string_size() since
+name.data cannot be NULL anymore.
+
+Signed-off-by: Li Qiang <liqiang6-s@360.cn>
+[groug, rewritten title and changelog,
+ fix empty string check in v9fs_xattrwalk()]
+Signed-off-by: Greg Kurz <groug@kaod.org>
+---
+ fsdev/9p-iov-marshal.c | 2 +-
+ hw/9pfs/9p.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
+index 663cad5..1d16f8d 100644
+--- a/fsdev/9p-iov-marshal.c
++++ b/fsdev/9p-iov-marshal.c
+@@ -125,7 +125,7 @@ ssize_t v9fs_iov_vunmarshal(struct iovec *out_sg, int out_num, size_t offset,
+ str->data = g_malloc(str->size + 1);
+ copied = v9fs_unpack(str->data, out_sg, out_num, offset,
+ str->size);
+- if (copied > 0) {
++ if (copied >= 0) {
+ str->data[str->size] = 0;
+ } else {
+ v9fs_string_free(str);
+diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
+index 119ee58..39a7e1d 100644
+--- a/hw/9pfs/9p.c
++++ b/hw/9pfs/9p.c
+@@ -3174,7 +3174,7 @@ static void v9fs_xattrwalk(void *opaque)
+ goto out;
+ }
+ v9fs_path_copy(&xattr_fidp->path, &file_fidp->path);
+- if (name.data == NULL) {
++ if (!v9fs_string_size(&name)) {
+ /*
+ * listxattr request. Get the size first
+ */
+--
+2.7.3
+
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch
new file mode 100644
index 00000000..a27d3a6
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch
@@ -0,0 +1,30 @@
+From: Prasad J Pandit <address@hidden>
+
+Rocker network switch emulator has test registers to help debug
+DMA operations. While testing host DMA access, a buffer address
+is written to register 'TEST_DMA_ADDR' and its size is written to
+register 'TEST_DMA_SIZE'. When performing TEST_DMA_CTRL_INVERT
+test, if DMA buffer size was greater than 'INT_MAX', it leads to
+an invalid buffer access. Limit the DMA buffer size to avoid it.
+
+Reported-by: Huawei PSIRT <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/net/rocker/rocker.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
+index 30f2ce4..e9d215a 100644
+--- a/hw/net/rocker/rocker.c
++++ b/hw/net/rocker/rocker.c
+@@ -860,7 +860,7 @@ static void rocker_io_writel(void *opaque, hwaddr addr, uint32_t val)
+ rocker_msix_irq(r, val);
+ break;
+ case ROCKER_TEST_DMA_SIZE:
+- r->test_dma_size = val;
++ r->test_dma_size = val & 0xFFFF;
+ break;
+ case ROCKER_TEST_DMA_ADDR + 4:
+ r->test_dma_addr = ((uint64_t)val) << 32 | r->lower32;
+--
+2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-1.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-1.patch
new file mode 100644
index 00000000..457f022
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-1.patch
@@ -0,0 +1,29 @@
+From: Prasad J Pandit <address@hidden>
+
+The JAZZ RC4030 chipset emulator has a periodic timer and
+associated interval reload register. The reload value is used
+as divider when computing timer's next tick value. If reload
+value is large, it could lead to divide by zero error. Limit
+the interval reload value to avoid it.
+
+Reported-by: Huawei PSIRT <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/dma/rc4030.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
+index 2f2576f..c1b4997 100644
+--- a/hw/dma/rc4030.c
++++ b/hw/dma/rc4030.c
+@@ -460,7 +460,7 @@ static void rc4030_write(void *opaque, hwaddr addr, uint64_t data,
+ break;
+ /* Interval timer reload */
+ case 0x0228:
+- s->itr = val;
++ s->itr = val & 0x01FF;
+ qemu_irq_lower(s->timer_irq);
+ set_next_tick(s);
+ break;
+--
+2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch
new file mode 100644
index 00000000..23393b7
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch
@@ -0,0 +1,34 @@
+From: Prasad J Pandit <address@hidden>
+
+16550A UART device uses an oscillator to generate frequencies
+(baud base), which decide communication speed. This speed could
+be changed by dividing it by a divider. If the divider is
+greater than the baud base, speed is set to zero, leading to a
+divide by zero error. Add check to avoid it.
+
+Reported-by: Huawei PSIRT <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/char/serial.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Update per
+ -> https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg02400.html
+
+diff --git a/hw/char/serial.c b/hw/char/serial.c
+index 3442f47..eec72b7 100644
+--- a/hw/char/serial.c
++++ b/hw/char/serial.c
+@@ -153,8 +153,9 @@ static void serial_update_parameters(SerialState *s)
+ int speed, parity, data_bits, stop_bits, frame_size;
+ QEMUSerialSetParams ssp;
+
+- if (s->divider == 0)
++ if (s->divider == 0 || s->divider > s->baudbase) {
+ return;
++ }
+
+ /* Start bit. */
+ frame_size = 1;
+--
+2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch
new file mode 100644
index 00000000..ed6613f
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch
@@ -0,0 +1,31 @@
+From: Prasad J Pandit <address@hidden>
+
+Intel HDA emulator uses stream of buffers during DMA data
+transfers. Each entry has buffer length and buffer pointer
+position, which are used to derive bytes to 'copy'. If this
+length and buffer pointer were to be same, 'copy' could be
+set to zero(0), leading to an infinite loop. Add check to
+avoid it.
+
+Reported-by: Huawei PSIRT <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/audio/intel-hda.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
+index cd95340..537face 100644
+--- a/hw/audio/intel-hda.c
++++ b/hw/audio/intel-hda.c
+@@ -416,7 +416,8 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
+ }
+
+ left = len;
+- while (left > 0) {
++ s = st->bentries;
++ while (left > 0 && s-- > 0) {
+ copy = left;
+ if (copy > st->bsize - st->lpib)
+ copy = st->bsize - st->lpib;
+--
+2.7.4
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch
new file mode 100644
index 00000000..c93f796
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch
@@ -0,0 +1,29 @@
+From: Prasad J Pandit <address@hidden>
+
+RTL8139 ethernet controller in C+ mode supports multiple
+descriptor rings, each with maximum of 64 descriptors. While
+processing transmit descriptor ring in 'rtl8139_cplus_transmit',
+it does not limit the descriptor count and runs forever. Add
+check to avoid it.
+
+Reported-by: Andrew Henderson <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/net/rtl8139.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
+index 3345bc6..f05e59c 100644
+--- a/hw/net/rtl8139.c
++++ b/hw/net/rtl8139.c
+@@ -2350,7 +2350,7 @@ static void rtl8139_cplus_transmit(RTL8139State *s)
+ {
+ int txcount = 0;
+
+- while (rtl8139_cplus_transmit_one(s))
++ while (txcount < 64 && rtl8139_cplus_transmit_one(s))
+ {
+ ++txcount;
+ }
+--
+2.7.4
diff --git a/app-emulation/qemu/qemu-2.7.0-r5.ebuild b/app-emulation/qemu/qemu-2.7.0-r5.ebuild
new file mode 100644
index 00000000..cece751
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.7.0-r5.ebuild
@@ -0,0 +1,703 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
+gnutls gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
+static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
+virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+#
+# Older versions of gnutls are supported, but it's simpler to just require
+# the latest versions. This is also why we require nettle.
+#
+# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
+# system binaries and tools, not user binaries.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ dev-libs/libpcre[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? ( app-accessibility/brltty[static-libs(+)] )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.90 )
+ )
+ )
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gles2,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.8.2
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xen? ( app-emulation/xen-tools:= )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'.\n
+For Intel CPUs the module is called 'kvm-intel'.\n
+Please review /etc/conf.d/modules for how to load these.\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
+For brand new installs, the default permissions on /dev/kvm might not let you
+access it. You can tell udev to reset ownership/perms:\n
+udevadm trigger -c add /dev/kvm"
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+
+ epatch "${FILESDIR}"/${P}-CVE-2016-6836.patch # bug 591242
+ epatch "${FILESDIR}"/${P}-CVE-2016-7155.patch # bug 593034
+ epatch "${FILESDIR}"/${P}-CVE-2016-7156.patch # bug 593036
+ epatch "${FILESDIR}"/${P}-CVE-2016-7157-1.patch # bug 593038
+ epatch "${FILESDIR}"/${P}-CVE-2016-7157-2.patch # bug 593038
+ epatch "${FILESDIR}"/${P}-CVE-2016-7170.patch # bug 593284
+ epatch "${FILESDIR}"/${P}-CVE-2016-7421.patch # bug 593950
+ epatch "${FILESDIR}"/${P}-CVE-2016-7422.patch # bug 593956
+ epatch "${FILESDIR}"/${P}-CVE-2016-7423.patch # bug 594368
+ epatch "${FILESDIR}"/${P}-CVE-2016-7466.patch # bug 594520
+ epatch "${FILESDIR}"/${P}-CVE-2016-7907.patch # bug 596048
+ epatch "${FILESDIR}"/${P}-CVE-2016-7908.patch # bug 596049
+ epatch "${FILESDIR}"/${P}-CVE-2016-7909.patch # bug 596048
+ epatch "${FILESDIR}"/${P}-CVE-2016-7994-1.patch # bug 596738
+ epatch "${FILESDIR}"/${P}-CVE-2016-7994-2.patch # bug 596738
+ epatch "${FILESDIR}"/${P}-CVE-2016-8576.patch # bug 596752
+ epatch "${FILESDIR}"/${P}-CVE-2016-8577.patch # bug 596776
+ epatch "${FILESDIR}"/${P}-CVE-2016-8578.patch # bug 596774
+ epatch "${FILESDIR}"/${P}-CVE-2016-8668.patch # bug 597110
+ epatch "${FILESDIR}"/${P}-CVE-2016-8669-1.patch # bug 597108
+ epatch "${FILESDIR}"/${P}-CVE-2016-8669-2.patch # bug 597108
+ epatch "${FILESDIR}"/${P}-CVE-2016-8909.patch # bug 598044
+ epatch "${FILESDIR}"/${P}-CVE-2016-8910.patch # bug 598046
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+
+ # Run after we've applied all patches.
+ handle_locales
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+ local static_flag="static-${buildtype}"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bzip2)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gnutls)
+ $(conf_softmmu gnutls nettle)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu uuid)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu vte)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ $(use_enable bzip2)
+ )
+ static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_dorules "${FILESDIR}"/65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp-*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2016-12-29 20:09 Mike Frysinger
0 siblings, 0 replies; 66+ messages in thread
From: Mike Frysinger @ 2016-12-29 20:09 UTC (permalink / raw
To: gentoo-commits
commit: 538fed1c866f2b1ef17d97295a06bd666e828d6f
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 29 18:20:31 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Dec 29 20:05:08 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=538fed1c
app-emulation/qemu: version bump to 2.8.0
app-emulation/qemu/Manifest | 1 +
.../qemu/files/qemu-2.8.0-CVE-2016-10028.patch | 40 ++++++++++++++++++++++
.../qemu/files/qemu-2.8.0-CVE-2016-9908.patch | 35 +++++++++++++++++++
.../qemu/files/qemu-2.8.0-CVE-2016-9912.patch | 38 ++++++++++++++++++++
.../qemu/{qemu-9999.ebuild => qemu-2.8.0.ebuild} | 6 +++-
app-emulation/qemu/qemu-9999.ebuild | 2 +-
6 files changed, 120 insertions(+), 2 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 5d40bbd..46537bc 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,2 +1,3 @@
DIST qemu-2.7.0.tar.bz2 26867760 SHA256 326e739506ba690daf69fc17bd3913a6c313d9928d743bd8eddb82f403f81e53 SHA512 654acaa7b3724a288e5d7e2a26ab780d9c9ed9f647fba00a906cbaffbe9d58fd666f2d962514aa2c5b391b4c53811ac3170d2eb51727f090bd19dfe45ca9a9db WHIRLPOOL dcb3e5f7da89dd8e14d636d7ebd476e076e0043880bb9ea3fb1c03cb4bcd4e5c7d3c4719da26c3ce521e3a3db5ae671e86f198ac1bc3474e774d75504fef8b8d
DIST qemu-2.7.1.tar.bz2 26868403 SHA256 68636788eb69bcb0b44ba220b32b50495d6bd5712a934c282217831c4822958f SHA512 16a83946e9064733254c82c961749bf9c56a0a2a8ee46145b4a78e1452ac0e2548d888963d18c80e28f65202890fd643b0011951b5b1c66ef16234767ed91898 WHIRLPOOL ae3d3c2b2a3700613733659847de6187755631cb09e8c3548ea30cd994357c9ff128646edce88dfe4dce53e6c1c0f37f8de3688ee7e22262033b40f3fc706efa
+DIST qemu-2.8.0.tar.bz2 28368517 SHA256 dafd5d7f649907b6b617b822692f4c82e60cf29bc0fc58bc2036219b591e5e62 SHA512 50f2988d822388ba9fd1bf5dbe68359033ed7432d7f0f9790299f32f63faa6dc72979256b5632ba572d47ee3e74ed40e3e8e331dc6303ec1599f1b4367cb78c2 WHIRLPOOL 0ce4e0539657eb832e4039819e7360c792b6aa41c718f0e0d762f4933217f0d370af94b1d6d9776853575b4a6811d8c85db069bf09d21bd15399ac8b50440ff5
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-10028.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-10028.patch
new file mode 100644
index 00000000..466c819
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-10028.patch
@@ -0,0 +1,40 @@
+https://lists.gnu.org/archive/html/qemu-devel/2016-12/msg01903.html
+https://bugs.gentoo.org/603444
+
+From: P J P
+Subject: [Qemu-devel] [PATCH] display: virtio-gpu-3d: check virgl capabilities max_size
+Date: Wed, 14 Dec 2016 12:31:56 +0530
+From: Prasad J Pandit <address@hidden>
+
+Virtio GPU device while processing 'VIRTIO_GPU_CMD_GET_CAPSET'
+command, retrieves the maximum capabilities size to fill in the
+response object. It continues to fill in capabilities even if
+retrieved 'max_size' is zero(0), thus resulting in OOB access.
+Add check to avoid it.
+
+Reported-by: Zhenhao Hong <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/display/virtio-gpu-3d.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
+index 758d33a..6ceeba3 100644
+--- a/hw/display/virtio-gpu-3d.c
++++ b/hw/display/virtio-gpu-3d.c
+@@ -370,8 +370,12 @@ static void virgl_cmd_get_capset(VirtIOGPU *g,
+
+ virgl_renderer_get_cap_set(gc.capset_id, &max_ver,
+ &max_size);
++ if (!max_size) {
++ cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
++ return;
++ }
++
+ resp = g_malloc0(sizeof(*resp) + max_size);
+-
+ resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;
+ virgl_renderer_fill_caps(gc.capset_id,
+ gc.capset_version,
+--
+2.9.3
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9908.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9908.patch
new file mode 100644
index 00000000..841de65
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9908.patch
@@ -0,0 +1,35 @@
+https://lists.gnu.org/archive/html/qemu-devel/2016-11/msg00059.html
+https://bugs.gentoo.org/601826
+
+From: Li Qiang
+Subject: [Qemu-devel] [PATCH] virtio-gpu: fix information leak in capset get dispatch
+Date: Tue, 1 Nov 2016 05:37:57 -0700
+From: Li Qiang <address@hidden>
+
+In virgl_cmd_get_capset function, it uses g_malloc to allocate
+a response struct to the guest. As the 'resp'struct hasn't been full
+initialized it will lead the 'resp->padding' field to the guest.
+Use g_malloc0 to avoid this.
+
+Signed-off-by: Li Qiang <address@hidden>
+---
+ hw/display/virtio-gpu-3d.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
+index 23f39de..d98b140 100644
+--- a/hw/display/virtio-gpu-3d.c
++++ b/hw/display/virtio-gpu-3d.c
+@@ -371,7 +371,7 @@ static void virgl_cmd_get_capset(VirtIOGPU *g,
+
+ virgl_renderer_get_cap_set(gc.capset_id, &max_ver,
+ &max_size);
+- resp = g_malloc(sizeof(*resp) + max_size);
++ resp = g_malloc0(sizeof(*resp) + max_size);
+
+ resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;
+ virgl_renderer_fill_caps(gc.capset_id,
+--
+1.8.3.1
+
+
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9912.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9912.patch
new file mode 100644
index 00000000..55963f7
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9912.patch
@@ -0,0 +1,38 @@
+https://lists.gnu.org/archive/html/qemu-devel/2016-11/msg05043.html
+https://bugs.gentoo.org/602630
+
+From: Li Qiang
+Subject: [Qemu-devel] [PATCH] virtio-gpu: call cleanup mapping function in resource destroy
+Date: Mon, 28 Nov 2016 21:29:25 -0500
+If the guest destroy the resource before detach banking, the 'iov'
+and 'addrs' field in resource is not freed thus leading memory
+leak issue. This patch avoid this.
+
+Signed-off-by: Li Qiang <address@hidden>
+---
+ hw/display/virtio-gpu.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
+index 60bce94..98dadf2 100644
+--- a/hw/display/virtio-gpu.c
++++ b/hw/display/virtio-gpu.c
+@@ -28,6 +28,8 @@
+ static struct virtio_gpu_simple_resource*
+ virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
+
++static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *res);
++
+ #ifdef CONFIG_VIRGL
+ #include <virglrenderer.h>
+ #define VIRGL(_g, _virgl, _simple, ...) \
+@@ -358,6 +360,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g,
+ struct virtio_gpu_simple_resource *res)
+ {
+ pixman_image_unref(res->image);
++ virtio_gpu_cleanup_mapping(res);
+ QTAILQ_REMOVE(&g->reslist, res, next);
+ g_free(res);
+ }
+--
+1.8.3.1
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-2.8.0.ebuild
similarity index 98%
copy from app-emulation/qemu/qemu-9999.ebuild
copy to app-emulation/qemu/qemu-2.8.0.ebuild
index 4859990..de01f6c 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-2.8.0.ebuild
@@ -142,7 +142,7 @@ USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
X86_FIRMWARE_DEPEND="
>=sys-firmware/ipxe-1.0.0_p20130624
pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
+ ~sys-firmware/seabios-1.10.1
~sys-firmware/sgabios-0.1_pre8
~sys-firmware/vgabios-0.7a
)
@@ -333,6 +333,10 @@ src_prepare() {
epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-1.patch #597108
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9908.patch #601826
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9912.patch #602630
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-10028.patch #603444
# Fix ld and objcopy being called directly
tc-export AR LD OBJCOPY
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 4859990..8b5b30c 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -142,7 +142,7 @@ USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
X86_FIRMWARE_DEPEND="
>=sys-firmware/ipxe-1.0.0_p20130624
pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
+ ~sys-firmware/seabios-1.10.1
~sys-firmware/sgabios-0.1_pre8
~sys-firmware/vgabios-0.7a
)
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-01-20 19:28 Mike Frysinger
0 siblings, 0 replies; 66+ messages in thread
From: Mike Frysinger @ 2017-01-20 19:28 UTC (permalink / raw
To: gentoo-commits
commit: 175bcba82218df8e7ad40919b5d45dbcc3d2ac30
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 20 19:21:20 2017 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Jan 20 19:26:19 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=175bcba8
app-emulation/qemu: generate init.d script from upstream settings
app-emulation/qemu/files/qemu-binfmt.initd.head | 64 +++++++++++++++++++++++++
app-emulation/qemu/files/qemu-binfmt.initd.tail | 14 ++++++
app-emulation/qemu/qemu-9999.ebuild | 49 ++++++++++++++++++-
3 files changed, 125 insertions(+), 2 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-binfmt.initd.head b/app-emulation/qemu/files/qemu-binfmt.initd.head
new file mode 100644
index 00000000..858d5d7
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-binfmt.initd.head
@@ -0,0 +1,64 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Enable automatic non-native program execution by the kernel.
+
+# Defaulting to OC should be safe because it comes down to:
+# - do we trust the interp itself to not be malicious? yes; we built it.
+# - do we trust the programs we're running? ish; same permission as native
+# binaries apply. so if user can do bad stuff natively, cross isn't worse.
+: ${QEMU_BINFMT_FLAGS:=OC}
+
+depend() {
+ after procfs
+}
+
+start() {
+ ebegin "Registering qemu-user binaries (flags: ${QEMU_BINFMT_FLAGS})"
+
+ if [ ! -d /proc/sys/fs/binfmt_misc ] ; then
+ modprobe -q binfmt_misc
+ fi
+
+ if [ ! -d /proc/sys/fs/binfmt_misc ] ; then
+ eend 1 "You need support for 'misc binaries' in your kernel!"
+ return
+ fi
+
+ if [ ! -f /proc/sys/fs/binfmt_misc/register ] ; then
+ mount -t binfmt_misc -o nodev,noexec,nosuid \
+ binfmt_misc /proc/sys/fs/binfmt_misc >/dev/null 2>&1
+ eend $? || return
+ fi
+
+ # Probe the native cpu type so we don't try registering them.
+ local cpu="$(uname -m)"
+ case "${cpu}" in
+ armv[4-9]*)
+ cpu="arm"
+ ;;
+ i386|i486|i586|i686|i86pc|BePC|x86_64)
+ cpu="i386"
+ ;;
+ m68k)
+ cpu="m68k"
+ ;;
+ mips*)
+ cpu="mips"
+ ;;
+ "Power Macintosh"|ppc|ppc64)
+ cpu="ppc"
+ ;;
+ s390*)
+ cpu="s390"
+ ;;
+ sh*)
+ cpu="sh"
+ ;;
+ sparc*)
+ cpu="sparc"
+ ;;
+ esac
+
+ # Register the interpreter for each cpu except for the native one.
diff --git a/app-emulation/qemu/files/qemu-binfmt.initd.tail b/app-emulation/qemu/files/qemu-binfmt.initd.tail
new file mode 100644
index 00000000..7679481
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-binfmt.initd.tail
@@ -0,0 +1,14 @@
+ eend 0
+}
+
+stop() {
+ # We unregister everything in the "qemu-xxx" namespace.
+ ebegin "Unregistering qemu-user binaries"
+ local f
+ for f in /proc/sys/fs/binfmt_misc/qemu-* ; do
+ if [ -f "${f}" ] ; then
+ echo '-1' > "${f}"
+ fi
+ done
+ eend 0
+}
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 28b1867..6a78bbb 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -560,13 +560,58 @@ qemu_python_install() {
python_doscript "${S}/scripts/qmp/qemu-ga-client"
}
+# Generate the /etc/init.d/qemu-binfmt script which registers the user handlers.
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu init.d script"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
src_install() {
if [[ -n ${user_targets} ]]; then
cd "${S}/user-build"
emake DESTDIR="${ED}" install
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ # Install binfmt handler init script for user targets.
+ doinitd "${T}/qemu-binfmt"
fi
if [[ -n ${softmmu_targets} ]]; then
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-02-13 4:58 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-02-13 4:58 UTC (permalink / raw
To: gentoo-commits
commit: cd0007ee8270ccd2773604782ddcc4b67fa3a103
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 13 04:08:18 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Mon Feb 13 04:08:18 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd0007ee
app-emulation/qemu: drop old versions 2.7.0, 2.7.1
Package-Manager: Portage-2.3.3, Repoman-2.3.1
app-emulation/qemu/Manifest | 2 -
.../qemu/files/qemu-2.7.0-CVE-2016-6836.patch | 27 -
.../qemu/files/qemu-2.7.0-CVE-2016-7155.patch | 81 ---
.../qemu/files/qemu-2.7.0-CVE-2016-7156.patch | 62 --
.../qemu/files/qemu-2.7.0-CVE-2016-7157-1.patch | 28 -
.../qemu/files/qemu-2.7.0-CVE-2016-7157-2.patch | 27 -
.../qemu/files/qemu-2.7.0-CVE-2016-7170.patch | 40 --
.../qemu/files/qemu-2.7.0-CVE-2016-7421.patch | 34 -
.../qemu/files/qemu-2.7.0-CVE-2016-7422.patch | 37 --
.../qemu/files/qemu-2.7.0-CVE-2016-7423.patch | 31 -
.../qemu/files/qemu-2.7.0-CVE-2016-7466.patch | 26 -
.../qemu/files/qemu-2.7.0-CVE-2016-7907.patch | 45 --
.../qemu/files/qemu-2.7.0-CVE-2016-7908.patch | 52 --
.../qemu/files/qemu-2.7.0-CVE-2016-7909.patch | 32 -
.../qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch | 25 -
.../qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch | 26 -
.../qemu/files/qemu-2.7.0-CVE-2016-8576.patch | 61 --
.../qemu/files/qemu-2.7.0-CVE-2016-8577.patch | 34 -
.../qemu/files/qemu-2.7.0-CVE-2016-8578.patch | 58 --
.../qemu/files/qemu-2.7.0-CVE-2016-8668.patch | 30 -
.../qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch | 34 -
.../qemu/files/qemu-2.7.0-CVE-2016-8909.patch | 31 -
.../qemu/files/qemu-2.7.0-CVE-2016-8910.patch | 29 -
.../qemu/files/qemu-2.7.0-CVE-2016-9102.patch | 21 -
.../qemu/files/qemu-2.7.0-CVE-2016-9103.patch | 27 -
.../qemu/files/qemu-2.7.0-CVE-2016-9104.patch | 92 ---
.../qemu/files/qemu-2.7.0-CVE-2016-9105.patch | 25 -
.../qemu/files/qemu-2.7.0-CVE-2016-9106.patch | 27 -
app-emulation/qemu/qemu-2.7.0-r7.ebuild | 707 ---------------------
app-emulation/qemu/qemu-2.7.1.ebuild | 699 --------------------
30 files changed, 2450 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 46537bc26f..36a9241809 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,3 +1 @@
-DIST qemu-2.7.0.tar.bz2 26867760 SHA256 326e739506ba690daf69fc17bd3913a6c313d9928d743bd8eddb82f403f81e53 SHA512 654acaa7b3724a288e5d7e2a26ab780d9c9ed9f647fba00a906cbaffbe9d58fd666f2d962514aa2c5b391b4c53811ac3170d2eb51727f090bd19dfe45ca9a9db WHIRLPOOL dcb3e5f7da89dd8e14d636d7ebd476e076e0043880bb9ea3fb1c03cb4bcd4e5c7d3c4719da26c3ce521e3a3db5ae671e86f198ac1bc3474e774d75504fef8b8d
-DIST qemu-2.7.1.tar.bz2 26868403 SHA256 68636788eb69bcb0b44ba220b32b50495d6bd5712a934c282217831c4822958f SHA512 16a83946e9064733254c82c961749bf9c56a0a2a8ee46145b4a78e1452ac0e2548d888963d18c80e28f65202890fd643b0011951b5b1c66ef16234767ed91898 WHIRLPOOL ae3d3c2b2a3700613733659847de6187755631cb09e8c3548ea30cd994357c9ff128646edce88dfe4dce53e6c1c0f37f8de3688ee7e22262033b40f3fc706efa
DIST qemu-2.8.0.tar.bz2 28368517 SHA256 dafd5d7f649907b6b617b822692f4c82e60cf29bc0fc58bc2036219b591e5e62 SHA512 50f2988d822388ba9fd1bf5dbe68359033ed7432d7f0f9790299f32f63faa6dc72979256b5632ba572d47ee3e74ed40e3e8e331dc6303ec1599f1b4367cb78c2 WHIRLPOOL 0ce4e0539657eb832e4039819e7360c792b6aa41c718f0e0d762f4933217f0d370af94b1d6d9776853575b4a6811d8c85db069bf09d21bd15399ac8b50440ff5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-6836.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-6836.patch
deleted file mode 100644
index 56f7435df5..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-6836.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: Li Qiang <address@hidden>
-
-In Vmxnet3 device emulator while processing transmit(tx) queue,
-when it reaches end of packet, it calls vmxnet3_complete_packet.
-In that local 'txcq_descr' object is not initialised, which could
-leak host memory bytes a guest.
-
-Reported-by: Li Qiang <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/net/vmxnet3.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
-index 90f6943..92f6af9 100644
---- a/hw/net/vmxnet3.c
-+++ b/hw/net/vmxnet3.c
-@@ -531,6 +531,7 @@ static void vmxnet3_complete_packet(VMXNET3State *s, int qidx, uint32_t tx_ridx)
-
- VMXNET3_RING_DUMP(VMW_RIPRN, "TXC", qidx, &s->txq_descr[qidx].comp_ring);
-
-+ memset(&txcq_descr, 0, sizeof(txcq_descr));
- txcq_descr.txdIdx = tx_ridx;
- txcq_descr.gen = vmxnet3_ring_curr_gen(&s->txq_descr[qidx].comp_ring);
-
---
-2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7155.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7155.patch
deleted file mode 100644
index 495faf2f1c..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7155.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-Vmware Paravirtual SCSI emulation uses command descriptors to
-process SCSI commands. These descriptors come with their ring
-buffers. A guest could set the page count for these rings to
-an arbitrary value, leading to infinite loop or OOB access.
-Add check to avoid it.
-
-Reported-by: Tom Victor <address@hidden>
-Reported-by: Li Qiang <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/scsi/vmw_pvscsi.c | 21 ++++++++++-----------
- 1 file changed, 10 insertions(+), 11 deletions(-)
-
-Update per review
- -> https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg00019.html
-
-diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
-index 5116f4a..4245c15 100644
---- a/hw/scsi/vmw_pvscsi.c
-+++ b/hw/scsi/vmw_pvscsi.c
-@@ -152,7 +152,7 @@ pvscsi_log2(uint32_t input)
- return log;
- }
-
--static int
-+static void
- pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
- {
- int i;
-@@ -160,10 +160,6 @@ pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
- uint32_t req_ring_size, cmp_ring_size;
- m->rs_pa = ri->ringsStatePPN << VMW_PAGE_SHIFT;
-
-- if ((ri->reqRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES)
-- || (ri->cmpRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES)) {
-- return -1;
-- }
- req_ring_size = ri->reqRingNumPages * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
- cmp_ring_size = ri->cmpRingNumPages * PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE;
- txr_len_log2 = pvscsi_log2(req_ring_size - 1);
-@@ -195,8 +191,6 @@ pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
-
- /* Flush ring state page changes */
- smp_wmb();
--
-- return 0;
- }
-
- static int
-@@ -746,7 +740,7 @@ pvscsi_dbg_dump_tx_rings_config(PVSCSICmdDescSetupRings *rc)
-
- trace_pvscsi_tx_rings_num_pages("Confirm Ring", rc->cmpRingNumPages);
- for (i = 0; i < rc->cmpRingNumPages; i++) {
-- trace_pvscsi_tx_rings_ppn("Confirm Ring", rc->reqRingPPNs[i]);
-+ trace_pvscsi_tx_rings_ppn("Confirm Ring", rc->cmpRingPPNs[i]);
- }
- }
-
-@@ -779,10 +773,15 @@ pvscsi_on_cmd_setup_rings(PVSCSIState *s)
-
- trace_pvscsi_on_cmd_arrived("PVSCSI_CMD_SETUP_RINGS");
-
-+ if (!rc->reqRingNumPages
-+ || rc->reqRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES
-+ || !rc->cmpRingNumPages
-+ || rc->cmpRingNumPages > PVSCSI_SETUP_RINGS_MAX_NUM_PAGES) {
-+ return PVSCSI_COMMAND_PROCESSING_FAILED;
-+ }
-+
- pvscsi_dbg_dump_tx_rings_config(rc);
-- if (pvscsi_ring_init_data(&s->rings, rc) < 0) {
-- return PVSCSI_COMMAND_PROCESSING_FAILED;
-- }
-+ pvscsi_ring_init_data(&s->rings, rc);
-
- s->rings_info_valid = TRUE;
- return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
---
-2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7156.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7156.patch
deleted file mode 100644
index 9c21a6759a..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7156.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-In PVSCSI paravirtual SCSI bus, pvscsi_convert_sglist can take a very
-long time or go into an infinite loop due to two different bugs:
-
-1) the request descriptor data length is defined to be 64 bit. While
-building SG list from a request descriptor, it gets truncated to 32bit
-in routine 'pvscsi_convert_sglist'. This could lead to an infinite loop
-situation for large 'dataLen' values, when data_length is cast to uint32_t
-and chunk_size becomes always zero. Fix this by removing the incorrect
-cast.
-
-2) pvscsi_get_next_sg_elem can be called arbitrarily many times if the
-element has a zero length. Get out of the loop early when this happens,
-by introducing an upper limit on the number of SG list elements.
-
-Reported-by: Li Qiang <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/scsi/vmw_pvscsi.c | 11 ++++++-----
- 1 file changed, 6 insertions(+), 5 deletions(-)
-
-Update as per:
- -> https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg01172.html
-
-diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
-index 4245c15..babac5a 100644
---- a/hw/scsi/vmw_pvscsi.c
-+++ b/hw/scsi/vmw_pvscsi.c
-@@ -40,6 +40,8 @@
- #define PVSCSI_MAX_DEVS (64)
- #define PVSCSI_MSIX_NUM_VECTORS (1)
-
-+#define PVSCSI_MAX_SG_ELEM 2048
-+
- #define PVSCSI_MAX_CMD_DATA_WORDS \
- (sizeof(PVSCSICmdDescSetupRings)/sizeof(uint32_t))
-
-@@ -628,17 +630,16 @@ pvscsi_queue_pending_descriptor(PVSCSIState *s, SCSIDevice **d,
- static void
- pvscsi_convert_sglist(PVSCSIRequest *r)
- {
-- int chunk_size;
-+ uint32_t chunk_size, elmcnt = 0;
- uint64_t data_length = r->req.dataLen;
- PVSCSISGState sg = r->sg;
-- while (data_length) {
-- while (!sg.resid) {
-+ while (data_length && elmcnt < PVSCSI_MAX_SG_ELEM) {
-+ while (!sg.resid && elmcnt++ < PVSCSI_MAX_SG_ELEM) {
- pvscsi_get_next_sg_elem(&sg);
- trace_pvscsi_convert_sglist(r->req.context, r->sg.dataAddr,
- r->sg.resid);
- }
-- assert(data_length > 0);
-- chunk_size = MIN((unsigned) data_length, sg.resid);
-+ chunk_size = MIN(data_length, sg.resid);
- if (chunk_size) {
- qemu_sglist_add(&r->sgl, sg.dataAddr, chunk_size);
- }
---
-2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-1.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-1.patch
deleted file mode 100644
index 480de308e0..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-1.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-When LSI SAS1068 Host Bus emulator builds configuration page
-headers, the format string used in 'mptsas_config_manufacturing_1'
-was wrong. It could lead to an invalid memory access.
-
-Reported-by: Tom Victor <address@hidden>
-Fix-suggested-by: Paolo Bonzini <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/scsi/mptconfig.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/scsi/mptconfig.c b/hw/scsi/mptconfig.c
-index 7071854..1ec895b 100644
---- a/hw/scsi/mptconfig.c
-+++ b/hw/scsi/mptconfig.c
-@@ -203,7 +203,7 @@ size_t mptsas_config_manufacturing_1(MPTSASState *s, uint8_t **data, int address
- {
- /* VPD - all zeros */
- return MPTSAS_CONFIG_PACK(1, MPI_CONFIG_PAGETYPE_MANUFACTURING, 0x00,
-- "s256");
-+ "*s256");
- }
-
- static
---
-2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-2.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-2.patch
deleted file mode 100644
index 5e796086ae..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7157-2.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-When LSI SAS1068 Host Bus emulator builds configuration page
-headers, mptsas_config_pack() asserts to check returned size
-value is within limit of 256 bytes. Fix that assert expression.
-
-Suggested-by: Paolo Bonzini <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/scsi/mptconfig.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/scsi/mptconfig.c b/hw/scsi/mptconfig.c
-index 1ec895b..531947f 100644
---- a/hw/scsi/mptconfig.c
-+++ b/hw/scsi/mptconfig.c
-@@ -158,7 +158,7 @@ static size_t mptsas_config_pack(uint8_t **data, const char *fmt, ...)
- va_end(ap);
-
- if (data) {
-- assert(ret < 256 && (ret % 4) == 0);
-+ assert(ret / 4 < 256);
- stb_p(*data + 1, ret / 4);
- }
- return ret;
---
-2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch
deleted file mode 100644
index 7eb5f76dd1..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7170.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-When processing svga command DEFINE_CURSOR in vmsvga_fifo_run,
-the computed BITMAP and PIXMAP size are checked against the
-'cursor.mask[]' and 'cursor.image[]' array sizes in bytes.
-Correct these checks to avoid OOB memory access.
-
-Reported-by: Qinghao Tang <address@hidden>
-Reported-by: Li Qiang <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/display/vmware_vga.c | 12 +++++++-----
- 1 file changed, 7 insertions(+), 5 deletions(-)
-
-diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
-index e51a05e..6599cf0 100644
---- a/hw/display/vmware_vga.c
-+++ b/hw/display/vmware_vga.c
-@@ -676,11 +676,13 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
- cursor.bpp = vmsvga_fifo_read(s);
-
- args = SVGA_BITMAP_SIZE(x, y) + SVGA_PIXMAP_SIZE(x, y, cursor.bpp);
-- if (cursor.width > 256 ||
-- cursor.height > 256 ||
-- cursor.bpp > 32 ||
-- SVGA_BITMAP_SIZE(x, y) > sizeof cursor.mask ||
-- SVGA_PIXMAP_SIZE(x, y, cursor.bpp) > sizeof cursor.image) {
-+ if (cursor.width > 256
-+ || cursor.height > 256
-+ || cursor.bpp > 32
-+ || SVGA_BITMAP_SIZE(x, y)
-+ > sizeof(cursor.mask) / sizeof(cursor.mask[0])
-+ || SVGA_PIXMAP_SIZE(x, y, cursor.bpp)
-+ > sizeof(cursor.image) / sizeof(cursor.image[0])) {
- goto badcmd;
- }
-
---
-2.5.5
-
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch
deleted file mode 100644
index b9f354537a..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7421.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-Vmware Paravirtual SCSI emulator while processing IO requests
-could run into an infinite loop if 'pvscsi_ring_pop_req_descr'
-always returned positive value. Limit IO loop to the ring size.
-
-Cc: address@hidden
-Reported-by: Li Qiang <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
-Message-Id: <address@hidden>
-Signed-off-by: Paolo Bonzini <address@hidden>
----
- hw/scsi/vmw_pvscsi.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
-index babac5a..a5ce7de 100644
---- a/hw/scsi/vmw_pvscsi.c
-+++ b/hw/scsi/vmw_pvscsi.c
-@@ -247,8 +247,11 @@ static hwaddr
- pvscsi_ring_pop_req_descr(PVSCSIRingInfo *mgr)
- {
- uint32_t ready_ptr = RS_GET_FIELD(mgr, reqProdIdx);
-+ uint32_t ring_size = PVSCSI_MAX_NUM_PAGES_REQ_RING
-+ * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
-
-- if (ready_ptr != mgr->consumed_ptr) {
-+ if (ready_ptr != mgr->consumed_ptr
-+ && ready_ptr - mgr->consumed_ptr < ring_size) {
- uint32_t next_ready_ptr =
- mgr->consumed_ptr++ & mgr->txr_len_mask;
- uint32_t next_ready_page =
---
-1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch
deleted file mode 100644
index cc60581086..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7422.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 973e7170dddefb491a48df5cba33b2ae151013a0 Mon Sep 17 00:00:00 2001
-From: Prasad J Pandit <pjp@fedoraproject.org>
-Date: Mon, 19 Sep 2016 23:55:45 +0530
-Subject: [PATCH] virtio: add check for descriptor's mapped address
-
-virtio back end uses set of buffers to facilitate I/O operations.
-If its size is too large, 'cpu_physical_memory_map' could return
-a null address. This would result in a null dereference while
-un-mapping descriptors. Add check to avoid it.
-
-Reported-by: Qinghao Tang <luodalongde@gmail.com>
-Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Reviewed-by: Laszlo Ersek <lersek@redhat.com>
----
- hw/virtio/virtio.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
-index fcf3358d6c0d..bb656b1ccff0 100644
---- a/hw/virtio/virtio.c
-+++ b/hw/virtio/virtio.c
-@@ -495,6 +495,11 @@ static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iove
- }
-
- iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);
-+ if (!iov[num_sg].iov_base) {
-+ error_report("virtio: bogus descriptor or out of resources");
-+ exit(1);
-+ }
-+
- iov[num_sg].iov_len = len;
- addr[num_sg] = pa;
-
---
-2.11.0
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7423.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7423.patch
deleted file mode 100644
index fdd871b162..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7423.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From: Li Qiang <address@hidden>
-
-When processing IO request in mptsas, it uses g_new to allocate
-a 'req' object. If an error occurs before 'req->sreq' is
-allocated, It could lead to an OOB write in mptsas_free_request
-function. Use g_new0 to avoid it.
-
-Reported-by: Li Qiang <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
-Message-Id: <address@hidden>
-Cc: address@hidden
-Signed-off-by: Paolo Bonzini <address@hidden>
----
- hw/scsi/mptsas.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
-index 0e0a22f..eaae1bb 100644
---- a/hw/scsi/mptsas.c
-+++ b/hw/scsi/mptsas.c
-@@ -304,7 +304,7 @@ static int mptsas_process_scsi_io_request(MPTSASState *s,
- goto bad;
- }
-
-- req = g_new(MPTSASRequest, 1);
-+ req = g_new0(MPTSASRequest, 1);
- QTAILQ_INSERT_TAIL(&s->pending, req, next);
- req->scsi_io = *scsi_io;
- req->dev = s;
---
-1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7466.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7466.patch
deleted file mode 100644
index d5028bb168..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7466.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From: Li Qiang <address@hidden>
-
-If the xhci uses msix, it doesn't free the corresponding
-memory, thus leading a memory leak. This patch avoid this.
-
-Signed-off-by: Li Qiang <address@hidden>
----
- hw/usb/hcd-xhci.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
-index 188f954..281a2a5 100644
---- a/hw/usb/hcd-xhci.c
-+++ b/hw/usb/hcd-xhci.c
-@@ -3709,8 +3709,7 @@ static void usb_xhci_exit(PCIDevice *dev)
- /* destroy msix memory region */
- if (dev->msix_table && dev->msix_pba
- && dev->msix_entry_used) {
-- memory_region_del_subregion(&xhci->mem, &dev->msix_table_mmio);
-- memory_region_del_subregion(&xhci->mem, &dev->msix_pba_mmio);
-+ msix_uninit(dev, &xhci->mem, &xhci->mem);
- }
-
- usb_bus_release(&xhci->bus);
---
-1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch
deleted file mode 100644
index 34b095a513..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7907.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-i.MX Fast Ethernet Controller uses buffer descriptors to manage
-data flow to/fro receive & transmit queues. While transmitting
-packets, it could continue to read buffer descriptors if a buffer
-descriptor has length of zero and has crafted values in bd.flags.
-Set an upper limit to number of buffer descriptors.
-
-Reported-by: Li Qiang <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/net/imx_fec.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-Update per
- -> https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05284.html
-
-diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
-index 1c415ab..1d74827 100644
---- a/hw/net/imx_fec.c
-+++ b/hw/net/imx_fec.c
-@@ -220,6 +220,8 @@ static const VMStateDescription vmstate_imx_eth = {
- #define PHY_INT_PARFAULT (1 << 2)
- #define PHY_INT_AUTONEG_PAGE (1 << 1)
-
-+#define IMX_MAX_DESC 1024
-+
- static void imx_eth_update(IMXFECState *s);
-
- /*
-@@ -402,12 +404,12 @@ static void imx_eth_update(IMXFECState *s)
-
- static void imx_fec_do_tx(IMXFECState *s)
- {
-- int frame_size = 0;
-+ int frame_size = 0, descnt = 0;
- uint8_t frame[ENET_MAX_FRAME_SIZE];
- uint8_t *ptr = frame;
- uint32_t addr = s->tx_descriptor;
-
-- while (1) {
-+ while (descnt++ < IMX_MAX_DESC) {
- IMXFECBufDesc bd;
- int len;
-
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch
deleted file mode 100644
index 16d072fe79..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7908.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 070c4b92b8cd5390889716677a0b92444d6e087a Mon Sep 17 00:00:00 2001
-From: Prasad J Pandit <pjp@fedoraproject.org>
-Date: Thu, 22 Sep 2016 16:02:37 +0530
-Subject: [PATCH] net: mcf: limit buffer descriptor count
-
-ColdFire Fast Ethernet Controller uses buffer descriptors to manage
-data flow to/fro receive & transmit queues. While transmitting
-packets, it could continue to read buffer descriptors if a buffer
-descriptor has length of zero and has crafted values in bd.flags.
-Set upper limit to number of buffer descriptors.
-
-Reported-by: Li Qiang <liqiang6-s@360.cn>
-Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
----
- hw/net/mcf_fec.c | 5 +++--
- 1 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
-index 0ee8ad9..d31fea1 100644
---- a/hw/net/mcf_fec.c
-+++ b/hw/net/mcf_fec.c
-@@ -23,6 +23,7 @@ do { printf("mcf_fec: " fmt , ## __VA_ARGS__); } while (0)
- #define DPRINTF(fmt, ...) do {} while(0)
- #endif
-
-+#define FEC_MAX_DESC 1024
- #define FEC_MAX_FRAME_SIZE 2032
-
- typedef struct {
-@@ -149,7 +150,7 @@ static void mcf_fec_do_tx(mcf_fec_state *s)
- uint32_t addr;
- mcf_fec_bd bd;
- int frame_size;
-- int len;
-+ int len, descnt = 0;
- uint8_t frame[FEC_MAX_FRAME_SIZE];
- uint8_t *ptr;
-
-@@ -157,7 +158,7 @@ static void mcf_fec_do_tx(mcf_fec_state *s)
- ptr = frame;
- frame_size = 0;
- addr = s->tx_descriptor;
-- while (1) {
-+ while (descnt++ < FEC_MAX_DESC) {
- mcf_fec_read_bd(&bd, addr);
- DPRINTF("tx_bd %x flags %04x len %d data %08x\n",
- addr, bd.flags, bd.length, bd.data);
---
-1.7.0.4
-
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch
deleted file mode 100644
index 8e6ecff892..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7909.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-The AMD PC-Net II emulator has set of control and status(CSR)
-registers. Of these, CSR76 and CSR78 hold receive and transmit
-descriptor ring length respectively. This ring length could range
-from 1 to 65535. Setting ring length to zero leads to an infinite
-loop in pcnet_rdra_addr. Add check to avoid it.
-
-Reported-by: Li Qiang <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/net/pcnet.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
-index 198a01f..3078de8 100644
---- a/hw/net/pcnet.c
-+++ b/hw/net/pcnet.c
-@@ -1429,8 +1429,11 @@ static void pcnet_csr_writew(PCNetState *s, uint32_t rap, uint32_t new_value)
- case 47: /* POLLINT */
- case 72:
- case 74:
-+ break;
- case 76: /* RCVRL */
- case 78: /* XMTRL */
-+ val = (val > 0) ? val : 512;
-+ break;
- case 112:
- if (CSR_STOP(s) || CSR_SPND(s))
- break;
---
-2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch
deleted file mode 100644
index 6fe77f367d..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-1.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: Li Qiang <address@hidden>
-
-In virtio gpu resource create dispatch, if the pixman format is zero
-it doesn't free the resource object allocated previously. Thus leading
-a host memory leak issue. This patch avoid this.
-
-Signed-off-by: Li Qiang <address@hidden>
----
- hw/display/virtio-gpu.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
-index 7fe6ed8..5b6d17b 100644
---- a/hw/display/virtio-gpu.c
-+++ b/hw/display/virtio-gpu.c
-@@ -333,6 +333,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
- qemu_log_mask(LOG_GUEST_ERROR,
- "%s: host couldn't handle guest format %d\n",
- __func__, c2d.format);
-+ g_free(res);
- cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
- return;
- }
---
-1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch
deleted file mode 100644
index dce1b2b2a3..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-7994-2.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From: Li Qiang <address@hidden>
-
-While processing isochronous transfer descriptors(iTD), if the page
-select(PG) field value is out of bands it will return. In this
-situation the ehci's sg list doesn't be freed thus leading a memory
-leak issue. This patch avoid this.
-
-Signed-off-by: Li Qiang <address@hidden>
----
- hw/usb/hcd-ehci.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
-index b093db7..f4ece9a 100644
---- a/hw/usb/hcd-ehci.c
-+++ b/hw/usb/hcd-ehci.c
-@@ -1426,6 +1426,7 @@ static int ehci_process_itd(EHCIState *ehci,
- if (off + len > 4096) {
- /* transfer crosses page border */
- if (pg == 6) {
-+ qemu_sglist_destroy(&ehci->isgl);
- return -1; /* avoid page pg + 1 */
- }
- ptr2 = (itd->bufptr[pg + 1] & ITD_BUFPTR_MASK);
---
-1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch
deleted file mode 100644
index 9617cd5dc8..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8576.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 20009bdaf95d10bf748fa69b104672d3cfaceddf Mon Sep 17 00:00:00 2001
-From: Gerd Hoffmann <address@hidden>
-Date: Fri, 7 Oct 2016 10:15:29 +0200
-Subject: [PATCH] xhci: limit the number of link trbs we are willing to process
-
-Signed-off-by: Gerd Hoffmann <address@hidden>
----
- hw/usb/hcd-xhci.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
-index 726435c..ee4fa48 100644
---- a/hw/usb/hcd-xhci.c
-+++ b/hw/usb/hcd-xhci.c
-@@ -54,6 +54,8 @@
- * to the specs when it gets them */
- #define ER_FULL_HACK
-
-+#define TRB_LINK_LIMIT 4
-+
- #define LEN_CAP 0x40
- #define LEN_OPER (0x400 + 0x10 * MAXPORTS)
- #define LEN_RUNTIME ((MAXINTRS + 1) * 0x20)
-@@ -1000,6 +1002,7 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
- dma_addr_t *addr)
- {
- PCIDevice *pci_dev = PCI_DEVICE(xhci);
-+ uint32_t link_cnt = 0;
-
- while (1) {
- TRBType type;
-@@ -1026,6 +1029,9 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
- ring->dequeue += TRB_SIZE;
- return type;
- } else {
-+ if (++link_cnt > TRB_LINK_LIMIT) {
-+ return 0;
-+ }
- ring->dequeue = xhci_mask64(trb->parameter);
- if (trb->control & TRB_LK_TC) {
- ring->ccs = !ring->ccs;
-@@ -1043,6 +1049,7 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring)
- bool ccs = ring->ccs;
- /* hack to bundle together the two/three TDs that make a setup transfer */
- bool control_td_set = 0;
-+ uint32_t link_cnt = 0;
-
- while (1) {
- TRBType type;
-@@ -1058,6 +1065,9 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring)
- type = TRB_TYPE(trb);
-
- if (type == TR_LINK) {
-+ if (++link_cnt > TRB_LINK_LIMIT) {
-+ return -length;
-+ }
- dequeue = xhci_mask64(trb.parameter);
- if (trb.control & TRB_LK_TC) {
- ccs = !ccs;
---
-1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch
deleted file mode 100644
index 8c295802c8..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8577.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From: Li Qiang <address@hidden>
-
-In 9pfs read dispatch function, it doesn't free two QEMUIOVector
-object thus causing potential memory leak. This patch avoid this.
-
-Signed-off-by: Li Qiang <address@hidden>
----
- hw/9pfs/9p.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
-index 119ee58..543a791 100644
---- a/hw/9pfs/9p.c
-+++ b/hw/9pfs/9p.c
-@@ -1826,14 +1826,15 @@ static void v9fs_read(void *opaque)
- if (len < 0) {
- /* IO error return the error */
- err = len;
-- goto out;
-+ goto out_free_iovec;
- }
- } while (count < max_count && len > 0);
- err = pdu_marshal(pdu, offset, "d", count);
- if (err < 0) {
-- goto out;
-+ goto out_free_iovec;
- }
- err += offset + count;
-+out_free_iovec:
- qemu_iovec_destroy(&qiov);
- qemu_iovec_destroy(&qiov_full);
- } else if (fidp->fid_type == P9_FID_XATTR) {
---
-1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch
deleted file mode 100644
index 74eee7e4d9..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8578.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From ba42ebb863ab7d40adc79298422ed9596df8f73a Mon Sep 17 00:00:00 2001
-From: Li Qiang <liqiang6-s@360.cn>
-Date: Mon, 17 Oct 2016 14:13:58 +0200
-Subject: [PATCH] 9pfs: allocate space for guest originated empty strings
-
-If a guest sends an empty string paramater to any 9P operation, the current
-code unmarshals it into a V9fsString equal to { .size = 0, .data = NULL }.
-
-This is unfortunate because it can cause NULL pointer dereference to happen
-at various locations in the 9pfs code. And we don't want to check str->data
-everywhere we pass it to strcmp() or any other function which expects a
-dereferenceable pointer.
-
-This patch enforces the allocation of genuine C empty strings instead, so
-callers don't have to bother.
-
-Out of all v9fs_iov_vunmarshal() users, only v9fs_xattrwalk() checks if
-the returned string is empty. It now uses v9fs_string_size() since
-name.data cannot be NULL anymore.
-
-Signed-off-by: Li Qiang <liqiang6-s@360.cn>
-[groug, rewritten title and changelog,
- fix empty string check in v9fs_xattrwalk()]
-Signed-off-by: Greg Kurz <groug@kaod.org>
----
- fsdev/9p-iov-marshal.c | 2 +-
- hw/9pfs/9p.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
-index 663cad5..1d16f8d 100644
---- a/fsdev/9p-iov-marshal.c
-+++ b/fsdev/9p-iov-marshal.c
-@@ -125,7 +125,7 @@ ssize_t v9fs_iov_vunmarshal(struct iovec *out_sg, int out_num, size_t offset,
- str->data = g_malloc(str->size + 1);
- copied = v9fs_unpack(str->data, out_sg, out_num, offset,
- str->size);
-- if (copied > 0) {
-+ if (copied >= 0) {
- str->data[str->size] = 0;
- } else {
- v9fs_string_free(str);
-diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
-index 119ee58..39a7e1d 100644
---- a/hw/9pfs/9p.c
-+++ b/hw/9pfs/9p.c
-@@ -3174,7 +3174,7 @@ static void v9fs_xattrwalk(void *opaque)
- goto out;
- }
- v9fs_path_copy(&xattr_fidp->path, &file_fidp->path);
-- if (name.data == NULL) {
-+ if (!v9fs_string_size(&name)) {
- /*
- * listxattr request. Get the size first
- */
---
-2.7.3
-
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch
deleted file mode 100644
index a27d3a6fb1..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8668.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-Rocker network switch emulator has test registers to help debug
-DMA operations. While testing host DMA access, a buffer address
-is written to register 'TEST_DMA_ADDR' and its size is written to
-register 'TEST_DMA_SIZE'. When performing TEST_DMA_CTRL_INVERT
-test, if DMA buffer size was greater than 'INT_MAX', it leads to
-an invalid buffer access. Limit the DMA buffer size to avoid it.
-
-Reported-by: Huawei PSIRT <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/net/rocker/rocker.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
-index 30f2ce4..e9d215a 100644
---- a/hw/net/rocker/rocker.c
-+++ b/hw/net/rocker/rocker.c
-@@ -860,7 +860,7 @@ static void rocker_io_writel(void *opaque, hwaddr addr, uint32_t val)
- rocker_msix_irq(r, val);
- break;
- case ROCKER_TEST_DMA_SIZE:
-- r->test_dma_size = val;
-+ r->test_dma_size = val & 0xFFFF;
- break;
- case ROCKER_TEST_DMA_ADDR + 4:
- r->test_dma_addr = ((uint64_t)val) << 32 | r->lower32;
---
-2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch
deleted file mode 100644
index 23393b7d59..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8669-2.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-16550A UART device uses an oscillator to generate frequencies
-(baud base), which decide communication speed. This speed could
-be changed by dividing it by a divider. If the divider is
-greater than the baud base, speed is set to zero, leading to a
-divide by zero error. Add check to avoid it.
-
-Reported-by: Huawei PSIRT <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/char/serial.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-Update per
- -> https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg02400.html
-
-diff --git a/hw/char/serial.c b/hw/char/serial.c
-index 3442f47..eec72b7 100644
---- a/hw/char/serial.c
-+++ b/hw/char/serial.c
-@@ -153,8 +153,9 @@ static void serial_update_parameters(SerialState *s)
- int speed, parity, data_bits, stop_bits, frame_size;
- QEMUSerialSetParams ssp;
-
-- if (s->divider == 0)
-+ if (s->divider == 0 || s->divider > s->baudbase) {
- return;
-+ }
-
- /* Start bit. */
- frame_size = 1;
---
-2.5.5
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch
deleted file mode 100644
index ed6613f896..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8909.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-Intel HDA emulator uses stream of buffers during DMA data
-transfers. Each entry has buffer length and buffer pointer
-position, which are used to derive bytes to 'copy'. If this
-length and buffer pointer were to be same, 'copy' could be
-set to zero(0), leading to an infinite loop. Add check to
-avoid it.
-
-Reported-by: Huawei PSIRT <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/audio/intel-hda.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
-index cd95340..537face 100644
---- a/hw/audio/intel-hda.c
-+++ b/hw/audio/intel-hda.c
-@@ -416,7 +416,8 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
- }
-
- left = len;
-- while (left > 0) {
-+ s = st->bentries;
-+ while (left > 0 && s-- > 0) {
- copy = left;
- if (copy > st->bsize - st->lpib)
- copy = st->bsize - st->lpib;
---
-2.7.4
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch
deleted file mode 100644
index c93f79631f..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-8910.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From: Prasad J Pandit <address@hidden>
-
-RTL8139 ethernet controller in C+ mode supports multiple
-descriptor rings, each with maximum of 64 descriptors. While
-processing transmit descriptor ring in 'rtl8139_cplus_transmit',
-it does not limit the descriptor count and runs forever. Add
-check to avoid it.
-
-Reported-by: Andrew Henderson <address@hidden>
-Signed-off-by: Prasad J Pandit <address@hidden>
----
- hw/net/rtl8139.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index 3345bc6..f05e59c 100644
---- a/hw/net/rtl8139.c
-+++ b/hw/net/rtl8139.c
-@@ -2350,7 +2350,7 @@ static void rtl8139_cplus_transmit(RTL8139State *s)
- {
- int txcount = 0;
-
-- while (rtl8139_cplus_transmit_one(s))
-+ while (txcount < 64 && rtl8139_cplus_transmit_one(s))
- {
- ++txcount;
- }
---
-2.7.4
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9102.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9102.patch
deleted file mode 100644
index 963eca97f4..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9102.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From: Li Qiang <address@hidden>
-
-The 'fs.xattr.value' field in V9fsFidState object doesn't consider the
-situation that this field has been allocated previously. Every time, it
-will be allocated directly. This leads a host memory leak issue. This
-patch fix this.
-
---
-1.8.3.1
-diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
-index 75ba5f1..a4c7109 100644
---- a/hw/9pfs/9p.c
-+++ b/hw/9pfs/9p.c
-@@ -3269,6 +3269,7 @@ static void v9fs_xattrcreate(void *opaque)
- xattr_fidp->fs.xattr.flags = flags;
- v9fs_string_init(&xattr_fidp->fs.xattr.name);
- v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);
-+ g_free(xattr_fidp->fs.xattr.value);
- xattr_fidp->fs.xattr.value = g_malloc(size);
- err = offset;
- put_fid(pdu, file_fidp);
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9103.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9103.patch
deleted file mode 100644
index 7520863a7d..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9103.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Author: Li Qiang <liqiang6-s@360.cn>
-Date: Mon Oct 17 14:13:58 2016 +0200
-
- 9pfs: fix information leak in xattr read
-
- 9pfs uses g_malloc() to allocate the xattr memory space, if the guest
- reads this memory before writing to it, this will leak host heap memory
- to the guest. This patch avoid this.
-
- Signed-off-by: Li Qiang <liqiang6-s@360.cn>
- Reviewed-by: Greg Kurz <groug@kaod.org>
- Signed-off-by: Greg Kurz <groug@kaod.org>
-
-diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
-index 26aa7d5..bf23b01 100644
---- a/hw/9pfs/9p.c
-+++ b/hw/9pfs/9p.c
-@@ -3269,8 +3269,8 @@ static void coroutine_fn v9fs_xattrcreate(void *opaque)
- xattr_fidp->fs.xattr.flags = flags;
- v9fs_string_init(&xattr_fidp->fs.xattr.name);
- v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);
- g_free(xattr_fidp->fs.xattr.value);
-- xattr_fidp->fs.xattr.value = g_malloc(size);
-+ xattr_fidp->fs.xattr.value = g_malloc0(size);
- err = offset;
- put_fid(pdu, file_fidp);
- out_nofid:
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9104.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9104.patch
deleted file mode 100644
index f1aec55c22..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9104.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 7e55d65c56a03dcd2c5d7c49d37c5a74b55d4bd6 Mon Sep 17 00:00:00 2001
-From: Li Qiang <liqiang6-s@360.cn>
-Date: Tue, 1 Nov 2016 12:00:40 +0100
-Subject: [PATCH] 9pfs: fix integer overflow issue in xattr read/write
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The v9fs_xattr_read() and v9fs_xattr_write() are passed a guest
-originated offset: they must ensure this offset does not go beyond
-the size of the extended attribute that was set in v9fs_xattrcreate().
-Unfortunately, the current code implement these checks with unsafe
-calculations on 32 and 64 bit values, which may allow a malicious
-guest to cause OOB access anyway.
-
-Fix this by comparing the offset and the xattr size, which are
-both uint64_t, before trying to compute the effective number of bytes
-to read or write.
-
-Suggested-by: Greg Kurz <groug@kaod.org>
-Signed-off-by: Li Qiang <liqiang6-s@360.cn>
-Reviewed-by: Greg Kurz <groug@kaod.org>
-Reviewed-By: Guido Günther <agx@sigxcpu.org>
-Signed-off-by: Greg Kurz <groug@kaod.org>
----
- hw/9pfs/9p.c | 32 ++++++++++++--------------------
- 1 file changed, 12 insertions(+), 20 deletions(-)
-
-diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
-index ab18ef2..7705ead 100644
---- a/hw/9pfs/9p.c
-+++ b/hw/9pfs/9p.c
-@@ -1637,20 +1637,17 @@ static int v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
- {
- ssize_t err;
- size_t offset = 7;
-- int read_count;
-- int64_t xattr_len;
-+ uint64_t read_count;
- V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
- VirtQueueElement *elem = v->elems[pdu->idx];
-
-- xattr_len = fidp->fs.xattr.len;
-- read_count = xattr_len - off;
-+ if (fidp->fs.xattr.len < off) {
-+ read_count = 0;
-+ } else {
-+ read_count = fidp->fs.xattr.len - off;
-+ }
- if (read_count > max_count) {
- read_count = max_count;
-- } else if (read_count < 0) {
-- /*
-- * read beyond XATTR value
-- */
-- read_count = 0;
- }
- err = pdu_marshal(pdu, offset, "d", read_count);
- if (err < 0) {
-@@ -1979,23 +1976,18 @@ static int v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
- {
- int i, to_copy;
- ssize_t err = 0;
-- int write_count;
-- int64_t xattr_len;
-+ uint64_t write_count;
- size_t offset = 7;
-
-
-- xattr_len = fidp->fs.xattr.len;
-- write_count = xattr_len - off;
-- if (write_count > count) {
-- write_count = count;
-- } else if (write_count < 0) {
-- /*
-- * write beyond XATTR value len specified in
-- * xattrcreate
-- */
-+ if (fidp->fs.xattr.len < off) {
- err = -ENOSPC;
- goto out;
- }
-+ write_count = fidp->fs.xattr.len - off;
-+ if (write_count > count) {
-+ write_count = count;
-+ }
- err = pdu_marshal(pdu, offset, "d", write_count);
- if (err < 0) {
- return err;
---
-2.7.3
-
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9105.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9105.patch
deleted file mode 100644
index cddff97f70..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9105.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: Li Qiang <address@hidden>
-
-In v9fs_link dispatch function, it doesn't put the 'oldfidp'
-fid object, this will make the 'oldfidp->ref' never reach to 0,
-thus leading a memory leak issue. This patch fix this.
-
-Signed-off-by: Li Qiang <address@hidden>
----
- hw/9pfs/9p.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
-index 8b50bfb..29f8b7a 100644
---- a/hw/9pfs/9p.c
-+++ b/hw/9pfs/9p.c
-@@ -2413,6 +2413,7 @@ static void v9fs_link(void *opaque)
- if (!err) {
- err = offset;
- }
-+ put_fid(pdu, oldfidp);
- out:
- put_fid(pdu, dfidp);
- out_nofid:
---
-1.8.3.1
diff --git a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9106.patch b/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9106.patch
deleted file mode 100644
index 137272d6b8..0000000000
--- a/app-emulation/qemu/files/qemu-2.7.0-CVE-2016-9106.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Author: Li Qiang <liqiang6-s@360.cn>
-Date: Mon Oct 17 14:13:58 2016 +0200
-
- 9pfs: fix memory leak in v9fs_write
-
- If an error occurs when marshalling the transfer length to the guest, the
- v9fs_write() function doesn't free an IO vector, thus leading to a memory
- leak. This patch fixes the issue.
-
- Signed-off-by: Li Qiang <liqiang6-s@360.cn>
- Reviewed-by: Greg Kurz <groug@kaod.org>
- [groug, rephrased the changelog]
- Signed-off-by: Greg Kurz <groug@kaod.org>
-
-diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
-index d43a552..e88cf25 100644
---- a/hw/9pfs/9p.c
-+++ b/hw/9pfs/9p.c
-@@ -2090,7 +2090,7 @@ static void coroutine_fn v9fs_write(void *opaque)
- offset = 7;
- err = pdu_marshal(pdu, offset, "d", total);
- if (err < 0) {
-- goto out;
-+ goto out_qiov;
- }
- err += offset;
-
diff --git a/app-emulation/qemu/qemu-2.7.0-r7.ebuild b/app-emulation/qemu/qemu-2.7.0-r7.ebuild
deleted file mode 100644
index 2f0c6ad6c2..0000000000
--- a/app-emulation/qemu/qemu-2.7.0-r7.ebuild
+++ /dev/null
@@ -1,707 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo-r1 pax-utils l10n
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
- KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
-gnutls gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
-virgl virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-#
-# Older versions of gnutls are supported, but it's simpler to just require
-# the latest versions. This is also why we require nettle.
-#
-# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
-# system binaries and tools, not user binaries.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- )
- infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gbm]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'.\n
-For Intel CPUs the module is called 'kvm-intel'.\n
-Please review /etc/conf.d/modules for how to load these.\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
-For brand new installs, the default permissions on /dev/kvm might not let you
-access it. You can tell udev to reset ownership/perms:\n
-udevadm trigger -c add /dev/kvm"
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-handle_locales() {
- # Make sure locale list is kept up-to-date.
- local detected sorted
- detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
- sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "PLOCALES: ${sorted}"
- eerror " po/*.po: ${detected}"
- die "sync PLOCALES"
- fi
-
- # Deal with selective install of locales.
- if use nls ; then
- # Delete locales the user does not want. #577814
- rm_loc() { rm po/$1.po || die; }
- l10n_for_each_disabled_locale_do rm_loc
- else
- # Cheap hack to disable gettext .mo generation.
- rm -f po/*.po
- fi
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
-
- epatch "${FILESDIR}"/${P}-CVE-2016-6836.patch # bug 591242
- epatch "${FILESDIR}"/${P}-CVE-2016-7155.patch # bug 593034
- epatch "${FILESDIR}"/${P}-CVE-2016-7156.patch # bug 593036
- epatch "${FILESDIR}"/${P}-CVE-2016-7157-1.patch # bug 593038
- epatch "${FILESDIR}"/${P}-CVE-2016-7157-2.patch # bug 593038
- epatch "${FILESDIR}"/${P}-CVE-2016-7170.patch # bug 593284
- epatch "${FILESDIR}"/${P}-CVE-2016-7421.patch # bug 593950
- epatch "${FILESDIR}"/${P}-CVE-2016-7422.patch # bug 593956
- epatch "${FILESDIR}"/${P}-CVE-2016-7423.patch # bug 594368
- epatch "${FILESDIR}"/${P}-CVE-2016-7466.patch # bug 594520
- epatch "${FILESDIR}"/${P}-CVE-2016-7907.patch # bug 596048
- epatch "${FILESDIR}"/${P}-CVE-2016-7908.patch # bug 596049
- epatch "${FILESDIR}"/${P}-CVE-2016-7909.patch # bug 596048
- epatch "${FILESDIR}"/${P}-CVE-2016-7994-1.patch # bug 596738
- epatch "${FILESDIR}"/${P}-CVE-2016-7994-2.patch # bug 596738
- epatch "${FILESDIR}"/${P}-CVE-2016-8576.patch # bug 596752
- epatch "${FILESDIR}"/${P}-CVE-2016-8577.patch # bug 596776
- epatch "${FILESDIR}"/${P}-CVE-2016-8578.patch # bug 596774
- epatch "${FILESDIR}"/${P}-CVE-2016-8668.patch # bug 597110
- epatch "${FILESDIR}"/${P}-CVE-2016-8669-1.patch # bug 597108
- epatch "${FILESDIR}"/${P}-CVE-2016-8669-2.patch # bug 597108
- epatch "${FILESDIR}"/${P}-CVE-2016-8909.patch # bug 598044
- epatch "${FILESDIR}"/${P}-CVE-2016-8910.patch # bug 598046
- epatch "${FILESDIR}"/${P}-CVE-2016-9102.patch # bug 598328
- epatch "${FILESDIR}"/${P}-CVE-2016-9103.patch # bug 598328
- epatch "${FILESDIR}"/${P}-CVE-2016-9104.patch # bug 598328
- epatch "${FILESDIR}"/${P}-CVE-2016-9105.patch # bug 598328
- epatch "${FILESDIR}"/${P}-CVE-2016-9106.patch # bug 598772
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-
- # Run after we've applied all patches.
- handle_locales
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bzip2)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gnutls)
- $(conf_softmmu gnutls nettle)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- $(use_enable bzip2)
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp-*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
diff --git a/app-emulation/qemu/qemu-2.7.1.ebuild b/app-emulation/qemu/qemu-2.7.1.ebuild
deleted file mode 100644
index ce6d3090c5..0000000000
--- a/app-emulation/qemu/qemu-2.7.1.ebuild
+++ /dev/null
@@ -1,699 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo-r1 pax-utils l10n
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-2
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
- KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
-gnutls gtk gtk2 infiniband iscsi +jpeg \
-kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
-+png pulseaudio python \
-rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
-static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
-virgl virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
-mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
-x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-softmmu static-user )
- static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-#
-# Older versions of gnutls are supported, but it's simpler to just require
-# the latest versions. This is also why we require nettle.
-#
-# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
-# system binaries and tools, not user binaries.
-COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? ( app-accessibility/brltty[static-libs(+)] )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- )
- infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gbm]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
-X86_FIRMWARE_DEPEND="
- >=sys-firmware/ipxe-1.0.0_p20130624
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.8.2
- ~sys-firmware/sgabios-0.1_pre8
- ~sys-firmware/vgabios-0.7a
- )
- !pin-upstream-blobs? (
- sys-firmware/seabios
- sys-firmware/sgabios
- sys-firmware/vgabios
- )"
-CDEPEND="
- !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
- !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xen? ( app-emulation/xen-tools:= )"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
- static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )
-"
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or32
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
-you have the kernel module loaded before running kvm. The easiest way to
-ensure that the kernel module is loaded is to load it on boot.\n
-For AMD CPUs the module is called 'kvm-amd'.\n
-For Intel CPUs the module is called 'kvm-intel'.\n
-Please review /etc/conf.d/modules for how to load these.\n\n
-Make sure your user is in the 'kvm' group\n
-Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
-For brand new installs, the default permissions on /dev/kvm might not let you
-access it. You can tell udev to reset ownership/perms:\n
-udevadm trigger -c add /dev/kvm"
-
-qemu_support_kvm() {
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
- use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
- use qemu_softmmu_targets_s390x; then
- return 0
- fi
-
- return 1
-}
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-handle_locales() {
- # Make sure locale list is kept up-to-date.
- local detected sorted
- detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
- sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "PLOCALES: ${sorted}"
- eerror " po/*.po: ${detected}"
- die "sync PLOCALES"
- fi
-
- # Deal with selective install of locales.
- if use nls ; then
- # Delete locales the user does not want. #577814
- rm_loc() { rm po/$1.po || die; }
- l10n_for_each_disabled_locale_do rm_loc
- else
- # Cheap hack to disable gettext .mo generation.
- rm -f po/*.po
- fi
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
- epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-6836.patch #591242
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7156.patch #593036
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7170.patch #593284
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7422.patch #593956
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7466.patch #594520
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7907.patch #596048
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7908.patch #596049
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7909.patch #596048
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7994-1.patch #596738
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-7994-2.patch #596738
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8576.patch #596752
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8577.patch #596776
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8578.patch #596774
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8668.patch #597110
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-1.patch #597108
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-2.patch #597108
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8909.patch #598044
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9102.patch #598328
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9103.patch #598328
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9104.patch #598328
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9105.patch #598328
- epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-9106.patch #598772
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- epatch_user
-
- # Run after we've applied all patches.
- handle_locales
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
- local static_flag="static-${buildtype}"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets as the default configure
- # options will autoprobe and try to link in a bunch of unused junk.
- conf_softmmu() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_softmmu accessibility brlapi)
- $(conf_softmmu aio linux-aio)
- $(conf_softmmu bzip2)
- $(conf_softmmu bluetooth bluez)
- $(conf_softmmu caps cap-ng)
- $(conf_softmmu curl)
- $(conf_softmmu fdt)
- $(conf_softmmu glusterfs)
- $(conf_softmmu gnutls)
- $(conf_softmmu gnutls nettle)
- $(conf_softmmu gtk)
- $(conf_softmmu infiniband rdma)
- $(conf_softmmu iscsi libiscsi)
- $(conf_softmmu jpeg vnc-jpeg)
- $(conf_softmmu kernel_linux kvm)
- $(conf_softmmu lzo)
- $(conf_softmmu ncurses curses)
- $(conf_softmmu nfs libnfs)
- $(conf_softmmu numa)
- $(conf_softmmu opengl)
- $(conf_softmmu png vnc-png)
- $(conf_softmmu rbd)
- $(conf_softmmu sasl vnc-sasl)
- $(conf_softmmu sdl)
- $(conf_softmmu seccomp)
- $(conf_softmmu smartcard)
- $(conf_softmmu snappy)
- $(conf_softmmu spice)
- $(conf_softmmu ssh libssh2)
- $(conf_softmmu usb libusb)
- $(conf_softmmu usbredir usb-redir)
- $(conf_softmmu uuid)
- $(conf_softmmu vde)
- $(conf_softmmu vhost-net)
- $(conf_softmmu virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_softmmu vnc)
- $(conf_softmmu vte)
- $(conf_softmmu xen)
- $(conf_softmmu xen xen-pci-passthrough)
- $(conf_softmmu xfs xfsctl)
- )
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- ;;
- softmmu)
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
-
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --with-system-pixman
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- $(use_enable bzip2)
- )
- static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- gcc-specs-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- default
- fi
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets
- newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_dorules "${FILESDIR}"/65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- if [[ -z ${softmmu_targets}${user_targets} ]]; then
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
- fi
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- # Remove the docdir placed qmp-commands.txt
- mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
- dodoc docs/qmp-*.txt
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- fi
-
- # Remove vgabios since we're using the vgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
- dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- qemu_support_kvm && readme.gentoo_create_doc
-}
-
-pkg_postinst() {
- if qemu_support_kvm; then
- readme.gentoo_print_elog
- fi
-
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/vgabios)"
-}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-02-13 6:40 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-02-13 6:40 UTC (permalink / raw
To: gentoo-commits
commit: acc843fe087a30413d5603826d659826a3b599ae
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 13 06:21:02 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Mon Feb 13 06:38:29 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=acc843fe
app-emulation/qemu: fix permissions on vhost-net, bug #593196
Add an additional udev rule that grants access to /dev/vhost-net to the kvm
user.
Package-Manager: Portage-2.3.3, Repoman-2.3.1
app-emulation/qemu/files/65-kvm.rules-r1 | 2 +
app-emulation/qemu/qemu-2.8.0-r2.ebuild | 691 +++++++++++++++++++++++++++++++
2 files changed, 693 insertions(+)
diff --git a/app-emulation/qemu/files/65-kvm.rules-r1 b/app-emulation/qemu/files/65-kvm.rules-r1
new file mode 100644
index 0000000000..ab3776ac29
--- /dev/null
+++ b/app-emulation/qemu/files/65-kvm.rules-r1
@@ -0,0 +1,2 @@
+KERNEL=="kvm", GROUP="kvm", MODE="0660"
+KERNEL=="vhost-net", GROUP="kvm", MODE="0660", OPTIONS+="static_node=vhost-net"
diff --git a/app-emulation/qemu/qemu-2.8.0-r2.ebuild b/app-emulation/qemu/qemu-2.8.0-r2.ebuild
new file mode 100644
index 0000000000..47a1a128dc
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.8.0-r2.ebuild
@@ -0,0 +1,691 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
+gnutls gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
+static-user systemtap tci test +threads usb usbredir vde +vhost-net \
+virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+#
+# Older versions of gnutls are supported, but it's simpler to just require
+# the latest versions. This is also why we require nettle.
+#
+# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
+# system binaries and tools, not user binaries.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? ( app-accessibility/brltty[static-libs(+)] )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ )
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.10.1
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xen? ( app-emulation/xen-tools:= )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'.\n
+For Intel CPUs the module is called 'kvm-intel'.\n
+Please review /etc/conf.d/modules for how to load these.\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
+For brand new installs, the default permissions on /dev/kvm might not let you
+access it. You can tell udev to reset ownership/perms:\n
+udevadm trigger -c add /dev/kvm"
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-1.patch #597108
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9908.patch #601826
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9912.patch #602630
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-10028.patch #603444
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-10155.patch #606720
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-2615.patch #608034
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5525-1.patch #606264
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5525-2.patch
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5552.patch #606722
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5578.patch #607000
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5579.patch #607100
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5667.patch #607766
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5856.patch #608036
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5857.patch #608038
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5898.patch #608520
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5931.patch #608728
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+
+ # Run after we've applied all patches.
+ handle_locales
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+ local static_flag="static-${buildtype}"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bzip2)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gnutls)
+ $(conf_softmmu gnutls nettle)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu vte)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ $(use_enable bzip2)
+ )
+ static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp-*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-02-21 12:03 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-02-21 12:03 UTC (permalink / raw
To: gentoo-commits
commit: cc47fc6cf1fef191ebb6c19d4b8bba9a12294024
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 21 03:27:40 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Tue Feb 21 12:03:08 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc47fc6c
app-emulation/qemu: security fixes, notably CVE-2017-2620, bug #609206
This commit applies a number of patches fixing
CVE-2017-2620 #609206
CVE-2017-2630 #609396
CVE-2017-5973 #609334
CVE-2017-5987 #609398
CVE-2017-6058 #609638
Package-Manager: Portage-2.3.3, Repoman-2.3.1
.../qemu/files/qemu-2.8.0-CVE-2017-2620.patch | 56 ++
.../qemu/files/qemu-2.8.0-CVE-2017-2630.patch | 22 +
.../qemu/files/qemu-2.8.0-CVE-2017-5973.patch | 87 +++
.../qemu/files/qemu-2.8.0-CVE-2017-5987.patch | 50 ++
.../qemu/files/qemu-2.8.0-CVE-2017-6058.patch | 112 ++++
app-emulation/qemu/qemu-2.8.0-r3.ebuild | 699 +++++++++++++++++++++
6 files changed, 1026 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-2620.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-2620.patch
new file mode 100644
index 0000000000..e2a98012d7
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-2620.patch
@@ -0,0 +1,56 @@
+From: Gerd Hoffmann <kraxel@redhat.com>
+Subject: [PATCH 3/3] cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo
+
+CIRRUS_BLTMODE_MEMSYSSRC blits do NOT check blit destination
+and blit width, at all. Oops. Fix it.
+
+Security impact: high.
+
+The missing blit destination check allows to write to host memory.
+Basically same as CVE-2014-8106 for the other blit variants.
+
+The missing blit width check allows to overflow cirrus_bltbuf,
+with the attractive target cirrus_srcptr (current cirrus_bltbuf write
+position) being located right after cirrus_bltbuf in CirrusVGAState.
+
+Due to cirrus emulation writing cirrus_bltbuf bytewise the attacker
+hasn't full control over cirrus_srcptr though, only one byte can be
+changed. Once the first byte has been modified further writes land
+elsewhere.
+
+[ This is CVE-2017-2620 / XSA-209 - Ian Jackson ]
+
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+---
+ hw/display/cirrus_vga.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
+index 0e47cf8..a093dc8 100644
+--- a/hw/display/cirrus_vga.c
++++ b/hw/display/cirrus_vga.c
+@@ -899,6 +899,10 @@ static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
+ {
+ int w;
+
++ if (blit_is_unsafe(s)) {
++ return 0;
++ }
++
+ s->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;
+ s->cirrus_srcptr = &s->cirrus_bltbuf[0];
+ s->cirrus_srcptr_end = &s->cirrus_bltbuf[0];
+@@ -924,6 +928,10 @@ static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
+ }
+ s->cirrus_srccounter = s->cirrus_blt_srcpitch * s->cirrus_blt_height;
+ }
++
++ /* the blit_is_unsafe call above should catch this */
++ assert(s->cirrus_blt_srcpitch <= CIRRUS_BLTBUFSIZE);
++
+ s->cirrus_srcptr = s->cirrus_bltbuf;
+ s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
+ cirrus_update_memory_access(s);
+--
+1.8.3.1
+
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-2630.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-2630.patch
new file mode 100644
index 0000000000..034b322de5
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-2630.patch
@@ -0,0 +1,22 @@
+Comparison symbol is misused. It may lead to memory corruption.
+
+Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
+---
+ nbd/client.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nbd/client.c b/nbd/client.c
+index 6caf6bda6d..351731bc63 100644
+--- a/nbd/client.c
++++ b/nbd/client.c
+@@ -94,7 +94,7 @@ static ssize_t drop_sync(QIOChannel *ioc, size_t size)
+ char small[1024];
+ char *buffer;
+
+- buffer = sizeof(small) < size ? small : g_malloc(MIN(65536, size));
++ buffer = sizeof(small) > size ? small : g_malloc(MIN(65536, size));
+ while (size > 0) {
+ ssize_t count = read_sync(ioc, buffer, MIN(65536, size));
+
+--
+2.11.0
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-5973.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-5973.patch
new file mode 100644
index 0000000000..50ff3c9979
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-5973.patch
@@ -0,0 +1,87 @@
+Limits should be big enough that normal guest should not hit it.
+Add a tracepoint to log them, just in case. Also, while being
+at it, log the existing link trb limit too.
+
+Reported-by: 李强 <address@hidden>
+Signed-off-by: Gerd Hoffmann <address@hidden>
+---
+ hw/usb/hcd-xhci.c | 15 ++++++++++++++-
+ hw/usb/trace-events | 1 +
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
+index fbf8a8b..28dd2f2 100644
+--- a/hw/usb/hcd-xhci.c
++++ b/hw/usb/hcd-xhci.c
+@@ -51,6 +51,8 @@
+ #define EV_QUEUE (((3 * 24) + 16) * MAXSLOTS)
+
+ #define TRB_LINK_LIMIT 4
++#define COMMAND_LIMIT 256
++#define TRANSFER_LIMIT 256
+
+ #define LEN_CAP 0x40
+ #define LEN_OPER (0x400 + 0x10 * MAXPORTS)
+@@ -943,6 +945,7 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
+ return type;
+ } else {
+ if (++link_cnt > TRB_LINK_LIMIT) {
++ trace_usb_xhci_enforced_limit("trb-link");
+ return 0;
+ }
+ ring->dequeue = xhci_mask64(trb->parameter);
+@@ -2060,6 +2063,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
+ XHCIRing *ring;
+ USBEndpoint *ep = NULL;
+ uint64_t mfindex;
++ unsigned int count = 0;
+ int length;
+ int i;
+
+@@ -2172,6 +2176,10 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
+ epctx->retry = xfer;
+ break;
+ }
++ if (count++ > TRANSFER_LIMIT) {
++ trace_usb_xhci_enforced_limit("transfers");
++ break;
++ }
+ }
+ epctx->kick_active--;
+
+@@ -2618,7 +2626,7 @@ static void xhci_process_commands(XHCIState *xhci)
+ TRBType type;
+ XHCIEvent event = {ER_COMMAND_COMPLETE, CC_SUCCESS};
+ dma_addr_t addr;
+- unsigned int i, slotid = 0;
++ unsigned int i, slotid = 0, count = 0;
+
+ DPRINTF("xhci_process_commands()\n");
+ if (!xhci_running(xhci)) {
+@@ -2735,6 +2743,11 @@ static void xhci_process_commands(XHCIState *xhci)
+ }
+ event.slotid = slotid;
+ xhci_event(xhci, &event, 0);
++
++ if (count++ > COMMAND_LIMIT) {
++ trace_usb_xhci_enforced_limit("commands");
++ return;
++ }
+ }
+ }
+
+diff --git a/hw/usb/trace-events b/hw/usb/trace-events
+index fdd1d29..0c323d4 100644
+--- a/hw/usb/trace-events
++++ b/hw/usb/trace-events
+@@ -174,6 +174,7 @@ usb_xhci_xfer_retry(void *xfer) "%p"
+ usb_xhci_xfer_success(void *xfer, uint32_t bytes) "%p: len %d"
+ usb_xhci_xfer_error(void *xfer, uint32_t ret) "%p: ret %d"
+ usb_xhci_unimplemented(const char *item, int nr) "%s (0x%x)"
++usb_xhci_enforced_limit(const char *item) "%s"
+
+ # hw/usb/desc.c
+ usb_desc_device(int addr, int len, int ret) "dev %d query device, len %d, ret %d"
+--
+1.8.3.1
+
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-5987.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-5987.patch
new file mode 100644
index 0000000000..bfde2e9d4b
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-5987.patch
@@ -0,0 +1,50 @@
+From: Prasad J Pandit <address@hidden>
+
+In the SDHCI protocol, the transfer mode register value
+is used during multi block transfer to check if block count
+register is enabled and should be updated. Transfer mode
+register could be set such that, block count register would
+not be updated, thus leading to an infinite loop. Add check
+to avoid it.
+
+Reported-by: Wjjzhang <address@hidden>
+Reported-by: Jiang Xin <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/sd/sdhci.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+Update: use qemu_log_mask(LOG_UNIMP, ...)
+ -> https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg02354.html
+
+diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
+index 5bd5ab6..a9c744b 100644
+--- a/hw/sd/sdhci.c
++++ b/hw/sd/sdhci.c
+@@ -486,6 +486,11 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s)
+ uint32_t boundary_chk = 1 << (((s->blksize & 0xf000) >> 12) + 12);
+ uint32_t boundary_count = boundary_chk - (s->sdmasysad % boundary_chk);
+
++ if (!(s->trnmod & SDHC_TRNS_BLK_CNT_EN) || !s->blkcnt) {
++ qemu_log_mask(LOG_UNIMP, "infinite transfer is not supported\n");
++ return;
++ }
++
+ /* XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account for
+ * possible stop at page boundary if initial address is not page aligned,
+ * allow them to work properly */
+@@ -797,11 +802,6 @@ static void sdhci_data_transfer(void *opaque)
+ if (s->trnmod & SDHC_TRNS_DMA) {
+ switch (SDHC_DMA_TYPE(s->hostctl)) {
+ case SDHC_CTRL_SDMA:
+- if ((s->trnmod & SDHC_TRNS_MULTI) &&
+- (!(s->trnmod & SDHC_TRNS_BLK_CNT_EN) || s->blkcnt == 0)) {
+- break;
+- }
+-
+ if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) {
+ sdhci_sdma_transfer_single_block(s);
+ } else {
+--
+2.9.3
+
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-6058.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-6058.patch
new file mode 100644
index 0000000000..666c18ccea
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-6058.patch
@@ -0,0 +1,112 @@
+This patch fixed a problem that was introduced in commit eb700029.
+
+When net_rx_pkt_attach_iovec() calls eth_strip_vlan()
+this can result in pkt->ehdr_buf being overflowed, because
+ehdr_buf is only sizeof(struct eth_header) bytes large
+but eth_strip_vlan() can write
+sizeof(struct eth_header) + sizeof(struct vlan_header)
+bytes into it.
+
+Devices affected by this problem: vmxnet3.
+
+Reported-by: Peter Maydell <address@hidden>
+Signed-off-by: Dmitry Fleytman <address@hidden>
+---
+ hw/net/net_rx_pkt.c | 34 +++++++++++++++++-----------------
+ 1 file changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c
+index 1019b50..7c0beac 100644
+--- a/hw/net/net_rx_pkt.c
++++ b/hw/net/net_rx_pkt.c
+@@ -23,13 +23,13 @@
+
+ struct NetRxPkt {
+ struct virtio_net_hdr virt_hdr;
+- uint8_t ehdr_buf[sizeof(struct eth_header)];
++ uint8_t ehdr_buf[sizeof(struct eth_header) + sizeof(struct vlan_header)];
+ struct iovec *vec;
+ uint16_t vec_len_total;
+ uint16_t vec_len;
+ uint32_t tot_len;
+ uint16_t tci;
+- bool vlan_stripped;
++ size_t ehdr_buf_len;
+ bool has_virt_hdr;
+ eth_pkt_types_e packet_type;
+
+@@ -88,15 +88,13 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt,
+ const struct iovec *iov, int iovcnt,
+ size_t ploff)
+ {
+- if (pkt->vlan_stripped) {
++ if (pkt->ehdr_buf_len) {
+ net_rx_pkt_iovec_realloc(pkt, iovcnt + 1);
+
+ pkt->vec[0].iov_base = pkt->ehdr_buf;
+- pkt->vec[0].iov_len = sizeof(pkt->ehdr_buf);
+-
+- pkt->tot_len =
+- iov_size(iov, iovcnt) - ploff + sizeof(struct eth_header);
++ pkt->vec[0].iov_len = pkt->ehdr_buf_len;
+
++ pkt->tot_len = iov_size(iov, iovcnt) - ploff + pkt->ehdr_buf_len;
+ pkt->vec_len = iov_copy(pkt->vec + 1, pkt->vec_len_total - 1,
+ iov, iovcnt, ploff, pkt->tot_len);
+ } else {
+@@ -123,11 +121,12 @@ void net_rx_pkt_attach_iovec(struct NetRxPkt *pkt,
+ uint16_t tci = 0;
+ uint16_t ploff = iovoff;
+ assert(pkt);
+- pkt->vlan_stripped = false;
+
+ if (strip_vlan) {
+- pkt->vlan_stripped = eth_strip_vlan(iov, iovcnt, iovoff, pkt->ehdr_buf,
+- &ploff, &tci);
++ pkt->ehdr_buf_len = eth_strip_vlan(iov, iovcnt, iovoff, pkt->ehdr_buf,
++ &ploff, &tci);
++ } else {
++ pkt->ehdr_buf_len = 0;
+ }
+
+ pkt->tci = tci;
+@@ -143,12 +142,13 @@ void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt,
+ uint16_t tci = 0;
+ uint16_t ploff = iovoff;
+ assert(pkt);
+- pkt->vlan_stripped = false;
+
+ if (strip_vlan) {
+- pkt->vlan_stripped = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet,
+- pkt->ehdr_buf,
+- &ploff, &tci);
++ pkt->ehdr_buf_len = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet,
++ pkt->ehdr_buf,
++ &ploff, &tci);
++ } else {
++ pkt->ehdr_buf_len = 0;
+ }
+
+ pkt->tci = tci;
+@@ -162,8 +162,8 @@ void net_rx_pkt_dump(struct NetRxPkt *pkt)
+ NetRxPkt *pkt = (NetRxPkt *)pkt;
+ assert(pkt);
+
+- printf("RX PKT: tot_len: %d, vlan_stripped: %d, vlan_tag: %d\n",
+- pkt->tot_len, pkt->vlan_stripped, pkt->tci);
++ printf("RX PKT: tot_len: %d, ehdr_buf_len: %lu, vlan_tag: %d\n",
++ pkt->tot_len, pkt->ehdr_buf_len, pkt->tci);
+ #endif
+ }
+
+@@ -426,7 +426,7 @@ bool net_rx_pkt_is_vlan_stripped(struct NetRxPkt *pkt)
+ {
+ assert(pkt);
+
+- return pkt->vlan_stripped;
++ return pkt->ehdr_buf_len ? true : false;
+ }
+
+ bool net_rx_pkt_has_virt_hdr(struct NetRxPkt *pkt)
+--
+2.7.4
diff --git a/app-emulation/qemu/qemu-2.8.0-r3.ebuild b/app-emulation/qemu/qemu-2.8.0-r3.ebuild
new file mode 100644
index 0000000000..6fcd5aff50
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.8.0-r3.ebuild
@@ -0,0 +1,699 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-2
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
+gnutls gtk gtk2 infiniband iscsi +jpeg \
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
++png pulseaudio python \
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
+static-user systemtap tci test +threads usb usbredir vde +vhost-net \
+virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64
+x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-softmmu static-user )
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+#
+# Older versions of gnutls are supported, but it's simpler to just require
+# the latest versions. This is also why we require nettle.
+#
+# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
+# system binaries and tools, not user binaries.
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? ( app-accessibility/brltty[static-libs(+)] )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ )
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
+X86_FIRMWARE_DEPEND="
+ >=sys-firmware/ipxe-1.0.0_p20130624
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.10.1
+ ~sys-firmware/sgabios-0.1_pre8
+ ~sys-firmware/vgabios-0.7a
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/seabios
+ sys-firmware/sgabios
+ sys-firmware/vgabios
+ )"
+CDEPEND="
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xen? ( app-emulation/xen-tools:= )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )
+"
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or32
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
+you have the kernel module loaded before running kvm. The easiest way to
+ensure that the kernel module is loaded is to load it on boot.\n
+For AMD CPUs the module is called 'kvm-amd'.\n
+For Intel CPUs the module is called 'kvm-intel'.\n
+Please review /etc/conf.d/modules for how to load these.\n\n
+Make sure your user is in the 'kvm' group\n
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
+For brand new installs, the default permissions on /dev/kvm might not let you
+access it. You can tell udev to reset ownership/perms:\n
+udevadm trigger -c add /dev/kvm"
+
+qemu_support_kvm() {
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
+ use qemu_softmmu_targets_s390x; then
+ return 0
+ fi
+
+ return 1
+}
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-1.patch #597108
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9908.patch #601826
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9912.patch #602630
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-10028.patch #603444
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-10155.patch #606720
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-2615.patch #608034
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-2630.patch #609396
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5525-1.patch #606264
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5525-2.patch
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5552.patch #606722
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5578.patch #607000
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5579.patch #607100
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5667.patch #607766
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5856.patch #608036
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5857.patch #608038
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5898.patch #608520
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5931.patch #608728
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5973.patch #609334
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5987.patch #609398
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-6058.patch #609638
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2017-2620.patch #609206
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ epatch_user
+
+ # Run after we've applied all patches.
+ handle_locales
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+ local static_flag="static-${buildtype}"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets as the default configure
+ # options will autoprobe and try to link in a bunch of unused junk.
+ conf_softmmu() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_softmmu accessibility brlapi)
+ $(conf_softmmu aio linux-aio)
+ $(conf_softmmu bzip2)
+ $(conf_softmmu bluetooth bluez)
+ $(conf_softmmu caps cap-ng)
+ $(conf_softmmu curl)
+ $(conf_softmmu fdt)
+ $(conf_softmmu glusterfs)
+ $(conf_softmmu gnutls)
+ $(conf_softmmu gnutls nettle)
+ $(conf_softmmu gtk)
+ $(conf_softmmu infiniband rdma)
+ $(conf_softmmu iscsi libiscsi)
+ $(conf_softmmu jpeg vnc-jpeg)
+ $(conf_softmmu kernel_linux kvm)
+ $(conf_softmmu lzo)
+ $(conf_softmmu ncurses curses)
+ $(conf_softmmu nfs libnfs)
+ $(conf_softmmu numa)
+ $(conf_softmmu opengl)
+ $(conf_softmmu png vnc-png)
+ $(conf_softmmu rbd)
+ $(conf_softmmu sasl vnc-sasl)
+ $(conf_softmmu sdl)
+ $(conf_softmmu seccomp)
+ $(conf_softmmu smartcard)
+ $(conf_softmmu snappy)
+ $(conf_softmmu spice)
+ $(conf_softmmu ssh libssh2)
+ $(conf_softmmu usb libusb)
+ $(conf_softmmu usbredir usb-redir)
+ $(conf_softmmu vde)
+ $(conf_softmmu vhost-net)
+ $(conf_softmmu virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_softmmu vnc)
+ $(conf_softmmu vte)
+ $(conf_softmmu xen)
+ $(conf_softmmu xen xen-pci-passthrough)
+ $(conf_softmmu xfs xfsctl)
+ )
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ ;;
+ softmmu)
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --with-system-pixman
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ $(use_enable bzip2)
+ )
+ static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ gcc-specs-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ default
+ fi
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ # Remove the docdir placed qmp-commands.txt
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp-*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ fi
+
+ # Remove vgabios since we're using the vgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ qemu_support_kvm && readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if qemu_support_kvm; then
+ readme.gentoo_print_elog
+ fi
+
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/vgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-04-12 5:03 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-04-12 5:03 UTC (permalink / raw
To: gentoo-commits
commit: a583bc5ee0c01d906b5cb29e5aeb428f0a39a1f7
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 12 05:01:44 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Wed Apr 12 05:03:12 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a583bc5e
app-emulation/qemu: apply patch for CVE-2017-7377, bug #614744
Package-Manager: Portage-2.3.5, Repoman-2.3.2
.../qemu/files/qemu-2.8.0-CVE-2017-7377.patch | 49 ++++++++++++++++++++++
app-emulation/qemu/qemu-2.8.0-r10.ebuild | 1 +
app-emulation/qemu/qemu-2.8.1.ebuild | 1 +
3 files changed, 51 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-7377.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-7377.patch
new file mode 100644
index 00000000000..f2d317c3c94
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2017-7377.patch
@@ -0,0 +1,49 @@
+From d63fb193e71644a073b77ff5ac6f1216f2f6cf6e Mon Sep 17 00:00:00 2001
+From: Li Qiang <liq3ea@gmail.com>
+Date: Mon, 27 Mar 2017 21:13:19 +0200
+Subject: [PATCH] 9pfs: fix file descriptor leak
+
+The v9fs_create() and v9fs_lcreate() functions are used to create a file
+on the backend and to associate it to a fid. The fid shouldn't be already
+in-use, otherwise both functions may silently leak a file descriptor or
+allocated memory. The current code doesn't check that.
+
+This patch ensures that the fid isn't already associated to anything
+before using it.
+
+Signed-off-by: Li Qiang <liqiang6-s@360.cn>
+(reworded the changelog, Greg Kurz)
+Signed-off-by: Greg Kurz <groug@kaod.org>
+---
+ hw/9pfs/9p.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
+index b8c0b99..48babce 100644
+--- a/hw/9pfs/9p.c
++++ b/hw/9pfs/9p.c
+@@ -1550,6 +1550,10 @@ static void coroutine_fn v9fs_lcreate(void *opaque)
+ err = -ENOENT;
+ goto out_nofid;
+ }
++ if (fidp->fid_type != P9_FID_NONE) {
++ err = -EINVAL;
++ goto out;
++ }
+
+ flags = get_dotl_openflags(pdu->s, flags);
+ err = v9fs_co_open2(pdu, fidp, &name, gid,
+@@ -2153,6 +2157,10 @@ static void coroutine_fn v9fs_create(void *opaque)
+ err = -EINVAL;
+ goto out_nofid;
+ }
++ if (fidp->fid_type != P9_FID_NONE) {
++ err = -EINVAL;
++ goto out;
++ }
+ if (perm & P9_STAT_MODE_DIR) {
+ err = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777,
+ fidp->uid, -1, &stbuf);
+--
+2.10.2
+
diff --git a/app-emulation/qemu/qemu-2.8.0-r10.ebuild b/app-emulation/qemu/qemu-2.8.0-r10.ebuild
index 8c8c3bdb820..4e6a2220fba 100644
--- a/app-emulation/qemu/qemu-2.8.0-r10.ebuild
+++ b/app-emulation/qemu/qemu-2.8.0-r10.ebuild
@@ -218,6 +218,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.8.0-CVE-2017-6058.patch #609638
"${FILESDIR}"/${PN}-2.8.0-CVE-2017-2620.patch #609206
"${FILESDIR}"/${PN}-2.8.0-CVE-2017-6505.patch #612220
+ "${FILESDIR}"/${PN}-2.8.0-CVE-2017-7377.patch #614744
"${S}-CVE-2016-9602-patches"
)
diff --git a/app-emulation/qemu/qemu-2.8.1.ebuild b/app-emulation/qemu/qemu-2.8.1.ebuild
index f4352217474..60572f21d30 100644
--- a/app-emulation/qemu/qemu-2.8.1.ebuild
+++ b/app-emulation/qemu/qemu-2.8.1.ebuild
@@ -208,6 +208,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.8.0-CVE-2017-5973.patch #609334
"${FILESDIR}"/${PN}-2.8.0-CVE-2017-5987.patch #609398
"${FILESDIR}"/${PN}-2.8.0-CVE-2017-6505.patch #612220
+ "${FILESDIR}"/${PN}-2.8.0-CVE-2017-7377.patch #614744
)
STRIP_MASK="/usr/share/qemu/palcode-clipper"
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-04-29 21:32 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-04-29 21:32 UTC (permalink / raw
To: gentoo-commits
commit: ea97b0c7b7466e74a67ad714b07509c752f5870c
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 29 21:01:30 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sat Apr 29 21:31:56 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea97b0c7
app-emulation/qemu: Various security patches for 2.9.0
bug 616636, CVE-2017-8112
bug 616870 [1]
bug 616872 [2]
bug 616874 [1]
[1] minor change, queued upstream, no CVE assigned yet
[2] queued upstream, no CVE assigned yet
Package-Manager: Portage-2.3.3, Repoman-2.3.2
.../qemu/files/qemu-2.9.0-CVE-2017-8112.patch | 22 +++++++
.../qemu/files/qemu-2.9.0-bug616870.patch | 22 +++++++
.../qemu/files/qemu-2.9.0-bug616872.patch | 76 ++++++++++++++++++++++
.../qemu/files/qemu-2.9.0-bug616874.patch | 34 ++++++++++
.../{qemu-2.9.0.ebuild => qemu-2.9.0-r1.ebuild} | 4 ++
5 files changed, 158 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-8112.patch b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-8112.patch
new file mode 100644
index 00000000000..31fb69bf897
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-8112.patch
@@ -0,0 +1,22 @@
+CVE-2017-8112
+
+https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg04494.html
+---
+ hw/scsi/vmw_pvscsi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
+index 7557546..4a106da 100644
+--- a/hw/scsi/vmw_pvscsi.c
++++ b/hw/scsi/vmw_pvscsi.c
+@@ -202,7 +202,7 @@ pvscsi_ring_init_msg(PVSCSIRingInfo *m, PVSCSICmdDescSetupMsgRing *ri)
+ uint32_t len_log2;
+ uint32_t ring_size;
+
+- if (ri->numPages > PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES) {
++ if (!ri->numPages || ri->numPages > PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES) {
+ return -1;
+ }
+ ring_size = ri->numPages * PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE;
+--
+2.9.3
diff --git a/app-emulation/qemu/files/qemu-2.9.0-bug616870.patch b/app-emulation/qemu/files/qemu-2.9.0-bug616870.patch
new file mode 100644
index 00000000000..4f7f870210c
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.9.0-bug616870.patch
@@ -0,0 +1,22 @@
+bug #616870
+
+https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg05587.html
+---
+ audio/audio.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/audio/audio.c b/audio/audio.c
+index c8898d8422..beafed209b 100644
+--- a/audio/audio.c
++++ b/audio/audio.c
+@@ -2028,6 +2028,8 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
+ sw = sw1;
+ }
+ QLIST_REMOVE (cap, entries);
++ g_free (cap->hw.mix_buf);
++ g_free (cap->buf);
+ g_free (cap);
+ }
+ return;
+--
+2.9.3
diff --git a/app-emulation/qemu/files/qemu-2.9.0-bug616872.patch b/app-emulation/qemu/files/qemu-2.9.0-bug616872.patch
new file mode 100644
index 00000000000..0a34dae671c
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.9.0-bug616872.patch
@@ -0,0 +1,76 @@
+bug #616872
+
+https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg05599.html
+---
+ ui/input.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/ui/input.c b/ui/input.c
+index ed88cda6d6..fb1f404095 100644
+--- a/ui/input.c
++++ b/ui/input.c
+@@ -41,6 +41,8 @@ static QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) kbd_queue =
+ QTAILQ_HEAD_INITIALIZER(kbd_queue);
+ static QEMUTimer *kbd_timer;
+ static uint32_t kbd_default_delay_ms = 10;
++static uint32_t queue_count;
++static uint32_t queue_limit = 1024;
+
+ QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev,
+ QemuInputHandler *handler)
+@@ -268,6 +270,7 @@ static void qemu_input_queue_process(void *opaque)
+ break;
+ }
+ QTAILQ_REMOVE(queue, item, node);
++ queue_count--;
+ g_free(item);
+ }
+ }
+@@ -282,6 +285,7 @@ static void qemu_input_queue_delay(struct QemuInputEventQueueHead *queue,
+ item->delay_ms = delay_ms;
+ item->timer = timer;
+ QTAILQ_INSERT_TAIL(queue, item, node);
++ queue_count++;
+
+ if (start_timer) {
+ timer_mod(item->timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)
+@@ -298,6 +302,7 @@ static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue,
+ item->src = src;
+ item->evt = evt;
+ QTAILQ_INSERT_TAIL(queue, item, node);
++ queue_count++;
+ }
+
+ static void qemu_input_queue_sync(struct QemuInputEventQueueHead *queue)
+@@ -306,6 +311,7 @@ static void qemu_input_queue_sync(struct QemuInputEventQueueHead *queue)
+
+ item->type = QEMU_INPUT_QUEUE_SYNC;
+ QTAILQ_INSERT_TAIL(queue, item, node);
++ queue_count++;
+ }
+
+ void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt)
+@@ -381,7 +387,7 @@ void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down)
+ qemu_input_event_send(src, evt);
+ qemu_input_event_sync();
+ qapi_free_InputEvent(evt);
+- } else {
++ } else if (queue_count < queue_limit) {
+ qemu_input_queue_event(&kbd_queue, src, evt);
+ qemu_input_queue_sync(&kbd_queue);
+ }
+@@ -409,8 +415,10 @@ void qemu_input_event_send_key_delay(uint32_t delay_ms)
+ kbd_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, qemu_input_queue_process,
+ &kbd_queue);
+ }
+- qemu_input_queue_delay(&kbd_queue, kbd_timer,
+- delay_ms ? delay_ms : kbd_default_delay_ms);
++ if (queue_count < queue_limit) {
++ qemu_input_queue_delay(&kbd_queue, kbd_timer,
++ delay_ms ? delay_ms : kbd_default_delay_ms);
++ }
+ }
+
+ InputEvent *qemu_input_event_new_btn(InputButton btn, bool down)
+--
+2.9.3
diff --git a/app-emulation/qemu/files/qemu-2.9.0-bug616874.patch b/app-emulation/qemu/files/qemu-2.9.0-bug616874.patch
new file mode 100644
index 00000000000..08911dd0bfb
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.9.0-bug616874.patch
@@ -0,0 +1,34 @@
+bug #616874
+
+https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg04147.html
+---
+ hw/scsi/megasas.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
+index 84b8caf..804122a 100644
+--- a/hw/scsi/megasas.c
++++ b/hw/scsi/megasas.c
+@@ -2138,15 +2138,15 @@ static void megasas_mmio_write(void *opaque, hwaddr addr,
+ case MFI_SEQ:
+ trace_megasas_mmio_writel("MFI_SEQ", val);
+ /* Magic sequence to start ADP reset */
+- if (adp_reset_seq[s->adp_reset] == val) {
+- s->adp_reset++;
++ if (adp_reset_seq[s->adp_reset++] == val) {
++ if (s->adp_reset == 6) {
++ s->adp_reset = 0;
++ s->diag = MFI_DIAG_WRITE_ENABLE;
++ }
+ } else {
+ s->adp_reset = 0;
+ s->diag = 0;
+ }
+- if (s->adp_reset == 6) {
+- s->diag = MFI_DIAG_WRITE_ENABLE;
+- }
+ break;
+ case MFI_DIAG:
+ trace_megasas_mmio_writel("MFI_DIAG", val);
+--
+2.9.3
diff --git a/app-emulation/qemu/qemu-2.9.0.ebuild b/app-emulation/qemu/qemu-2.9.0-r1.ebuild
similarity index 99%
rename from app-emulation/qemu/qemu-2.9.0.ebuild
rename to app-emulation/qemu/qemu-2.9.0-r1.ebuild
index 5ec3aac1a10..2d6bed861d6 100644
--- a/app-emulation/qemu/qemu-2.9.0.ebuild
+++ b/app-emulation/qemu/qemu-2.9.0-r1.ebuild
@@ -190,6 +190,10 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.5.0-cflags.patch
"${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ "${FILESDIR}"/${PN}-2.9.0-bug616870.patch
+ "${FILESDIR}"/${PN}-2.9.0-bug616872.patch
+ "${FILESDIR}"/${PN}-2.9.0-bug616874.patch
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8112.patch
)
STRIP_MASK="/usr/share/qemu/palcode-clipper"
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-05-18 4:20 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-05-18 4:20 UTC (permalink / raw
To: gentoo-commits
commit: 33cfc7b69e6a25e0b66687e28f7b29ae1a43e2d4
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Thu May 18 04:08:31 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Thu May 18 04:20:12 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=33cfc7b6
app-emulation/qemu: patch for CVE-2017-7493, bug #618808
Package-Manager: Portage-2.3.5, Repoman-2.3.2
.../qemu/files/qemu-2.9.0-CVE-2017-7493.patch | 174 +++++++++++++++++++++
.../{qemu-2.9.0-r1.ebuild => qemu-2.9.0-r2.ebuild} | 9 +-
...qemu-2.9.0-r53.ebuild => qemu-2.9.0-r54.ebuild} | 9 +-
3 files changed, 184 insertions(+), 8 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7493.patch b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7493.patch
new file mode 100644
index 00000000000..346e7713f74
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7493.patch
@@ -0,0 +1,174 @@
+From 7a95434e0ca8a037fd8aa1a2e2461f92585eb77b Mon Sep 17 00:00:00 2001
+From: Greg Kurz <groug@kaod.org>
+Date: Fri, 5 May 2017 14:48:08 +0200
+Subject: [PATCH] 9pfs: local: forbid client access to metadata (CVE-2017-7493)
+
+When using the mapped-file security mode, we shouldn't let the client mess
+with the metadata. The current code already tries to hide the metadata dir
+from the client by skipping it in local_readdir(). But the client can still
+access or modify it through several other operations. This can be used to
+escalate privileges in the guest.
+
+Affected backend operations are:
+- local_mknod()
+- local_mkdir()
+- local_open2()
+- local_symlink()
+- local_link()
+- local_unlinkat()
+- local_renameat()
+- local_rename()
+- local_name_to_path()
+
+Other operations are safe because they are only passed a fid path, which
+is computed internally in local_name_to_path().
+
+This patch converts all the functions listed above to fail and return
+EINVAL when being passed the name of the metadata dir. This may look
+like a poor choice for errno, but there's no such thing as an illegal
+path name on Linux and I could not think of anything better.
+
+This fixes CVE-2017-7493.
+
+Reported-by: Leo Gaspard <leo@gaspard.io>
+Signed-off-by: Greg Kurz <groug@kaod.org>
+Reviewed-by: Eric Blake <eblake@redhat.com>
+---
+ hw/9pfs/9p-local.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 56 insertions(+), 2 deletions(-)
+
+diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
+index f3ebca4f7a..a2486566af 100644
+--- a/hw/9pfs/9p-local.c
++++ b/hw/9pfs/9p-local.c
+@@ -452,6 +452,11 @@ static off_t local_telldir(FsContext *ctx, V9fsFidOpenState *fs)
+ return telldir(fs->dir.stream);
+ }
+
++static bool local_is_mapped_file_metadata(FsContext *fs_ctx, const char *name)
++{
++ return !strcmp(name, VIRTFS_META_DIR);
++}
++
+ static struct dirent *local_readdir(FsContext *ctx, V9fsFidOpenState *fs)
+ {
+ struct dirent *entry;
+@@ -465,8 +470,8 @@ again:
+ if (ctx->export_flags & V9FS_SM_MAPPED) {
+ entry->d_type = DT_UNKNOWN;
+ } else if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
+- if (!strcmp(entry->d_name, VIRTFS_META_DIR)) {
+- /* skp the meta data directory */
++ if (local_is_mapped_file_metadata(ctx, entry->d_name)) {
++ /* skip the meta data directory */
+ goto again;
+ }
+ entry->d_type = DT_UNKNOWN;
+@@ -559,6 +564,12 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
+ int err = -1;
+ int dirfd;
+
++ if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE &&
++ local_is_mapped_file_metadata(fs_ctx, name)) {
++ errno = EINVAL;
++ return -1;
++ }
++
+ dirfd = local_opendir_nofollow(fs_ctx, dir_path->data);
+ if (dirfd == -1) {
+ return -1;
+@@ -605,6 +616,12 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
+ int err = -1;
+ int dirfd;
+
++ if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE &&
++ local_is_mapped_file_metadata(fs_ctx, name)) {
++ errno = EINVAL;
++ return -1;
++ }
++
+ dirfd = local_opendir_nofollow(fs_ctx, dir_path->data);
+ if (dirfd == -1) {
+ return -1;
+@@ -694,6 +711,12 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
+ int err = -1;
+ int dirfd;
+
++ if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE &&
++ local_is_mapped_file_metadata(fs_ctx, name)) {
++ errno = EINVAL;
++ return -1;
++ }
++
+ /*
+ * Mark all the open to not follow symlinks
+ */
+@@ -752,6 +775,12 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
+ int err = -1;
+ int dirfd;
+
++ if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE &&
++ local_is_mapped_file_metadata(fs_ctx, name)) {
++ errno = EINVAL;
++ return -1;
++ }
++
+ dirfd = local_opendir_nofollow(fs_ctx, dir_path->data);
+ if (dirfd == -1) {
+ return -1;
+@@ -826,6 +855,12 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
+ int ret = -1;
+ int odirfd, ndirfd;
+
++ if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
++ local_is_mapped_file_metadata(ctx, name)) {
++ errno = EINVAL;
++ return -1;
++ }
++
+ odirfd = local_opendir_nofollow(ctx, odirpath);
+ if (odirfd == -1) {
+ goto out;
+@@ -1096,6 +1131,12 @@ static int local_lremovexattr(FsContext *ctx, V9fsPath *fs_path,
+ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
+ const char *name, V9fsPath *target)
+ {
++ if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
++ local_is_mapped_file_metadata(ctx, name)) {
++ errno = EINVAL;
++ return -1;
++ }
++
+ if (dir_path) {
+ v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
+ } else if (strcmp(name, "/")) {
+@@ -1116,6 +1157,13 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir,
+ int ret;
+ int odirfd, ndirfd;
+
++ if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
++ (local_is_mapped_file_metadata(ctx, old_name) ||
++ local_is_mapped_file_metadata(ctx, new_name))) {
++ errno = EINVAL;
++ return -1;
++ }
++
+ odirfd = local_opendir_nofollow(ctx, olddir->data);
+ if (odirfd == -1) {
+ return -1;
+@@ -1206,6 +1254,12 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
+ int ret;
+ int dirfd;
+
++ if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
++ local_is_mapped_file_metadata(ctx, name)) {
++ errno = EINVAL;
++ return -1;
++ }
++
+ dirfd = local_opendir_nofollow(ctx, dir->data);
+ if (dirfd == -1) {
+ return -1;
+--
+2.13.0
+
diff --git a/app-emulation/qemu/qemu-2.9.0-r1.ebuild b/app-emulation/qemu/qemu-2.9.0-r2.ebuild
similarity index 98%
rename from app-emulation/qemu/qemu-2.9.0-r1.ebuild
rename to app-emulation/qemu/qemu-2.9.0-r2.ebuild
index 9fdaa1ebac5..6289ced538e 100644
--- a/app-emulation/qemu/qemu-2.9.0-r1.ebuild
+++ b/app-emulation/qemu/qemu-2.9.0-r2.ebuild
@@ -191,10 +191,11 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.5.0-cflags.patch
"${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
- "${FILESDIR}"/${PN}-2.9.0-bug616870.patch
- "${FILESDIR}"/${PN}-2.9.0-bug616872.patch
- "${FILESDIR}"/${PN}-2.9.0-bug616874.patch
- "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8112.patch
+ "${FILESDIR}"/${PN}-2.9.0-bug616870.patch # bug 616870
+ "${FILESDIR}"/${PN}-2.9.0-bug616872.patch # bug 616872
+ "${FILESDIR}"/${PN}-2.9.0-bug616874.patch # bug 616874
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8112.patch # bug 616636
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-7493.patch # bug 618808
)
STRIP_MASK="/usr/share/qemu/palcode-clipper"
diff --git a/app-emulation/qemu/qemu-2.9.0-r53.ebuild b/app-emulation/qemu/qemu-2.9.0-r54.ebuild
similarity index 98%
rename from app-emulation/qemu/qemu-2.9.0-r53.ebuild
rename to app-emulation/qemu/qemu-2.9.0-r54.ebuild
index 5518e2e813b..0d8029910fc 100644
--- a/app-emulation/qemu/qemu-2.9.0-r53.ebuild
+++ b/app-emulation/qemu/qemu-2.9.0-r54.ebuild
@@ -194,10 +194,11 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.5.0-cflags.patch
"${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
- "${FILESDIR}"/${PN}-2.9.0-bug616870.patch
- "${FILESDIR}"/${PN}-2.9.0-bug616872.patch
- "${FILESDIR}"/${PN}-2.9.0-bug616874.patch
- "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8112.patch
+ "${FILESDIR}"/${PN}-2.9.0-bug616870.patch # bug 616870
+ "${FILESDIR}"/${PN}-2.9.0-bug616872.patch # bug 616872
+ "${FILESDIR}"/${PN}-2.9.0-bug616874.patch # bug 616874
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8112.patch # bug 616636
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-7493.patch # bug 618808
)
STRIP_MASK="/usr/share/qemu/palcode-clipper"
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-07-26 18:57 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-07-26 18:57 UTC (permalink / raw
To: gentoo-commits
commit: 606c4d5b81243fb243bd38a21326e60c3318138c
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 26 18:53:25 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Wed Jul 26 18:57:05 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=606c4d5b
app-emulation/qemu: security patches
CVE-2017-7539, bug #625850
CVE-2017-10664, bug #623016
CVE-2017-10806, bug #624088
Package-Manager: Portage-2.3.6, Repoman-2.3.3
.../qemu/files/qemu-2.9.0-CVE-2017-10664.patch | 47 +++
.../qemu/files/qemu-2.9.0-CVE-2017-10806.patch | 50 +++
.../qemu/files/qemu-2.9.0-CVE-2017-7539.patch | 433 ++++++++++++++++++---
...qemu-2.9.0-r55.ebuild => qemu-2.9.0-r56.ebuild} | 4 +-
4 files changed, 481 insertions(+), 53 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-10664.patch b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-10664.patch
new file mode 100644
index 00000000000..7db06929cf2
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-10664.patch
@@ -0,0 +1,47 @@
+From 041e32b8d9d076980b4e35317c0339e57ab888f1 Mon Sep 17 00:00:00 2001
+From: Max Reitz <mreitz@redhat.com>
+Date: Sun, 11 Jun 2017 14:37:14 +0200
+Subject: [PATCH] qemu-nbd: Ignore SIGPIPE
+
+qemu proper has done so for 13 years
+(8a7ddc38a60648257dc0645ab4a05b33d6040063), qemu-img and qemu-io have
+done so for four years (526eda14a68d5b3596be715505289b541288ef2a).
+Ignoring this signal is especially important in qemu-nbd because
+otherwise a client can easily take down the qemu-nbd server by dropping
+the connection when the server wants to send something, for example:
+
+$ qemu-nbd -x foo -f raw -t null-co:// &
+[1] 12726
+$ qemu-io -c quit nbd://localhost/bar
+can't open device nbd://localhost/bar: No export with name 'bar' available
+[1] + 12726 broken pipe qemu-nbd -x foo -f raw -t null-co://
+
+In this case, the client sends an NBD_OPT_ABORT and closes the
+connection (because it is not required to wait for a reply), but the
+server replies with an NBD_REP_ACK (because it is required to reply).
+
+Signed-off-by: Max Reitz <mreitz@redhat.com>
+Message-Id: <20170611123714.31292-1-mreitz@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+---
+ qemu-nbd.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/qemu-nbd.c b/qemu-nbd.c
+index 9464a0461c..4dd3fd4732 100644
+--- a/qemu-nbd.c
++++ b/qemu-nbd.c
+@@ -581,6 +581,10 @@ int main(int argc, char **argv)
+ sa_sigterm.sa_handler = termsig_handler;
+ sigaction(SIGTERM, &sa_sigterm, NULL);
+
++#ifdef CONFIG_POSIX
++ signal(SIGPIPE, SIG_IGN);
++#endif
++
+ module_call_init(MODULE_INIT_TRACE);
+ qcrypto_init(&error_fatal);
+
+--
+2.13.0
+
diff --git a/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-10806.patch b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-10806.patch
new file mode 100644
index 00000000000..0074f5f8c77
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-10806.patch
@@ -0,0 +1,50 @@
+From bd4a683505b27adc1ac809f71e918e58573d851d Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Tue, 9 May 2017 13:01:28 +0200
+Subject: [PATCH] usb-redir: fix stack overflow in usbredir_log_data
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Don't reinvent a broken wheel, just use the hexdump function we have.
+
+Impact: low, broken code doesn't run unless you have debug logging
+enabled.
+
+Reported-by: 李强 <liqiang6-s@360.cn>
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Message-id: 20170509110128.27261-1-kraxel@redhat.com
+---
+ hw/usb/redirect.c | 13 +------------
+ 1 file changed, 1 insertion(+), 12 deletions(-)
+
+diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
+index b001a27f05..ad5ef783a6 100644
+--- a/hw/usb/redirect.c
++++ b/hw/usb/redirect.c
+@@ -229,21 +229,10 @@ static void usbredir_log(void *priv, int level, const char *msg)
+ static void usbredir_log_data(USBRedirDevice *dev, const char *desc,
+ const uint8_t *data, int len)
+ {
+- int i, j, n;
+-
+ if (dev->debug < usbredirparser_debug_data) {
+ return;
+ }
+-
+- for (i = 0; i < len; i += j) {
+- char buf[128];
+-
+- n = sprintf(buf, "%s", desc);
+- for (j = 0; j < 8 && i + j < len; j++) {
+- n += sprintf(buf + n, " %02X", data[i + j]);
+- }
+- error_report("%s", buf);
+- }
++ qemu_hexdump((char *)data, stderr, desc, len);
+ }
+
+ /*
+--
+2.13.0
+
diff --git a/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7539.patch b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7539.patch
index 0b5987c6623..3af16977b93 100644
--- a/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7539.patch
+++ b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7539.patch
@@ -23,8 +23,281 @@ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd/server.c | 107 ++++++++++++-----------------------------------------------
1 file changed, 22 insertions(+), 85 deletions(-)
+diff --git a/nbd/client.c b/nbd/client.c
+index a58fb02..6b74a62 100644
+--- a/nbd/client.c
++++ b/nbd/client.c
+@@ -86,9 +86,9 @@ static QTAILQ_HEAD(, NBDExport) exports = QTAILQ_HEAD_INITIALIZER(exports);
+
+ */
+
+-/* Discard length bytes from channel. Return -errno on failure, or
+- * the amount of bytes consumed. */
+-static ssize_t drop_sync(QIOChannel *ioc, size_t size)
++/* Discard length bytes from channel. Return -errno on failure and 0 on
++ * success*/
++static int drop_sync(QIOChannel *ioc, size_t size)
+ {
+ ssize_t ret = 0;
+ char small[1024];
+@@ -96,14 +96,13 @@ static ssize_t drop_sync(QIOChannel *ioc, size_t size)
+
+ buffer = sizeof(small) >= size ? small : g_malloc(MIN(65536, size));
+ while (size > 0) {
+- ssize_t count = read_sync(ioc, buffer, MIN(65536, size));
++ ssize_t count = MIN(65536, size);
++ ret = read_sync(ioc, buffer, MIN(65536, size));
+
+- if (count <= 0) {
++ if (ret < 0) {
+ goto cleanup;
+ }
+- assert(count <= size);
+ size -= count;
+- ret += count;
+ }
+
+ cleanup:
+@@ -136,12 +135,12 @@ static int nbd_send_option_request(QIOChannel *ioc, uint32_t opt,
+ stl_be_p(&req.option, opt);
+ stl_be_p(&req.length, len);
+
+- if (write_sync(ioc, &req, sizeof(req)) != sizeof(req)) {
++ if (write_sync(ioc, &req, sizeof(req)) < 0) {
+ error_setg(errp, "Failed to send option request header");
+ return -1;
+ }
+
+- if (len && write_sync(ioc, (char *) data, len) != len) {
++ if (len && write_sync(ioc, (char *) data, len) < 0) {
+ error_setg(errp, "Failed to send option request data");
+ return -1;
+ }
+@@ -170,7 +169,7 @@ static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt,
+ nbd_opt_reply *reply, Error **errp)
+ {
+ QEMU_BUILD_BUG_ON(sizeof(*reply) != 20);
+- if (read_sync(ioc, reply, sizeof(*reply)) != sizeof(*reply)) {
++ if (read_sync(ioc, reply, sizeof(*reply)) < 0) {
+ error_setg(errp, "failed to read option reply");
+ nbd_send_opt_abort(ioc);
+ return -1;
+@@ -219,7 +218,7 @@ static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply,
+ goto cleanup;
+ }
+ msg = g_malloc(reply->length + 1);
+- if (read_sync(ioc, msg, reply->length) != reply->length) {
++ if (read_sync(ioc, msg, reply->length) < 0) {
+ error_setg(errp, "failed to read option error message");
+ goto cleanup;
+ }
+@@ -321,7 +320,7 @@ static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
+ nbd_send_opt_abort(ioc);
+ return -1;
+ }
+- if (read_sync(ioc, &namelen, sizeof(namelen)) != sizeof(namelen)) {
++ if (read_sync(ioc, &namelen, sizeof(namelen)) < 0) {
+ error_setg(errp, "failed to read option name length");
+ nbd_send_opt_abort(ioc);
+ return -1;
+@@ -334,7 +333,7 @@ static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
+ return -1;
+ }
+ if (namelen != strlen(want)) {
+- if (drop_sync(ioc, len) != len) {
++ if (drop_sync(ioc, len) < 0) {
+ error_setg(errp, "failed to skip export name with wrong length");
+ nbd_send_opt_abort(ioc);
+ return -1;
+@@ -343,14 +342,14 @@ static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
+ }
+
+ assert(namelen < sizeof(name));
+- if (read_sync(ioc, name, namelen) != namelen) {
++ if (read_sync(ioc, name, namelen) < 0) {
+ error_setg(errp, "failed to read export name");
+ nbd_send_opt_abort(ioc);
+ return -1;
+ }
+ name[namelen] = '\0';
+ len -= namelen;
+- if (drop_sync(ioc, len) != len) {
++ if (drop_sync(ioc, len) < 0) {
+ error_setg(errp, "failed to read export description");
+ nbd_send_opt_abort(ioc);
+ return -1;
+@@ -477,7 +476,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
+ goto fail;
+ }
+
+- if (read_sync(ioc, buf, 8) != 8) {
++ if (read_sync(ioc, buf, 8) < 0) {
+ error_setg(errp, "Failed to read data");
+ goto fail;
+ }
+@@ -503,7 +502,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
+ goto fail;
+ }
+
+- if (read_sync(ioc, &magic, sizeof(magic)) != sizeof(magic)) {
++ if (read_sync(ioc, &magic, sizeof(magic)) < 0) {
+ error_setg(errp, "Failed to read magic");
+ goto fail;
+ }
+@@ -515,8 +514,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
+ uint16_t globalflags;
+ bool fixedNewStyle = false;
+
+- if (read_sync(ioc, &globalflags, sizeof(globalflags)) !=
+- sizeof(globalflags)) {
++ if (read_sync(ioc, &globalflags, sizeof(globalflags)) < 0) {
+ error_setg(errp, "Failed to read server flags");
+ goto fail;
+ }
+@@ -534,8 +532,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
+ }
+ /* client requested flags */
+ clientflags = cpu_to_be32(clientflags);
+- if (write_sync(ioc, &clientflags, sizeof(clientflags)) !=
+- sizeof(clientflags)) {
++ if (write_sync(ioc, &clientflags, sizeof(clientflags)) < 0) {
+ error_setg(errp, "Failed to send clientflags field");
+ goto fail;
+ }
+@@ -573,13 +570,13 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
+ }
+
+ /* Read the response */
+- if (read_sync(ioc, &s, sizeof(s)) != sizeof(s)) {
++ if (read_sync(ioc, &s, sizeof(s)) < 0) {
+ error_setg(errp, "Failed to read export length");
+ goto fail;
+ }
+ *size = be64_to_cpu(s);
+
+- if (read_sync(ioc, flags, sizeof(*flags)) != sizeof(*flags)) {
++ if (read_sync(ioc, flags, sizeof(*flags)) < 0) {
+ error_setg(errp, "Failed to read export flags");
+ goto fail;
+ }
+@@ -596,14 +593,14 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
+ goto fail;
+ }
+
+- if (read_sync(ioc, &s, sizeof(s)) != sizeof(s)) {
++ if (read_sync(ioc, &s, sizeof(s)) < 0) {
+ error_setg(errp, "Failed to read export length");
+ goto fail;
+ }
+ *size = be64_to_cpu(s);
+ TRACE("Size is %" PRIu64, *size);
+
+- if (read_sync(ioc, &oldflags, sizeof(oldflags)) != sizeof(oldflags)) {
++ if (read_sync(ioc, &oldflags, sizeof(oldflags)) < 0) {
+ error_setg(errp, "Failed to read export flags");
+ goto fail;
+ }
+@@ -619,7 +616,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
+ }
+
+ TRACE("Size is %" PRIu64 ", export flags %" PRIx16, *size, *flags);
+- if (zeroes && drop_sync(ioc, 124) != 124) {
++ if (zeroes && drop_sync(ioc, 124) < 0) {
+ error_setg(errp, "Failed to read reserved block");
+ goto fail;
+ }
+@@ -744,7 +741,6 @@ int nbd_disconnect(int fd)
+ ssize_t nbd_send_request(QIOChannel *ioc, NBDRequest *request)
+ {
+ uint8_t buf[NBD_REQUEST_SIZE];
+- ssize_t ret;
+
+ TRACE("Sending request to server: "
+ "{ .from = %" PRIu64", .len = %" PRIu32 ", .handle = %" PRIu64
+@@ -759,16 +755,7 @@ ssize_t nbd_send_request(QIOChannel *ioc, NBDRequest *request)
+ stq_be_p(buf + 16, request->from);
+ stl_be_p(buf + 24, request->len);
+
+- ret = write_sync(ioc, buf, sizeof(buf));
+- if (ret < 0) {
+- return ret;
+- }
+-
+- if (ret != sizeof(buf)) {
+- LOG("writing to socket failed");
+- return -EINVAL;
+- }
+- return 0;
++ return write_sync(ioc, buf, sizeof(buf));
+ }
+
+ ssize_t nbd_receive_reply(QIOChannel *ioc, NBDReply *reply)
+@@ -777,7 +764,7 @@ ssize_t nbd_receive_reply(QIOChannel *ioc, NBDReply *reply)
+ uint32_t magic;
+ ssize_t ret;
+
+- ret = read_sync(ioc, buf, sizeof(buf));
++ ret = read_sync_eof(ioc, buf, sizeof(buf));
+ if (ret <= 0) {
+ return ret;
+ }
+diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h
+index f43d990..e6bbc7c 100644
+--- a/nbd/nbd-internal.h
++++ b/nbd/nbd-internal.h
+@@ -94,7 +94,13 @@
+ #define NBD_ENOSPC 28
+ #define NBD_ESHUTDOWN 108
+
+-static inline ssize_t read_sync(QIOChannel *ioc, void *buffer, size_t size)
++/* read_sync_eof
++ * Tries to read @size bytes from @ioc. Returns number of bytes actually read.
++ * May return a value >= 0 and < size only on EOF, i.e. when iteratively called
++ * qio_channel_readv() returns 0. So, there are no needs to call read_sync_eof
++ * iteratively.
++ */
++static inline ssize_t read_sync_eof(QIOChannel *ioc, void *buffer, size_t size)
+ {
+ struct iovec iov = { .iov_base = buffer, .iov_len = size };
+ /* Sockets are kept in blocking mode in the negotiation phase. After
+@@ -105,12 +111,32 @@ static inline ssize_t read_sync(QIOChannel *ioc, void *buffer, size_t size)
+ return nbd_wr_syncv(ioc, &iov, 1, size, true);
+ }
+
+-static inline ssize_t write_sync(QIOChannel *ioc, const void *buffer,
+- size_t size)
++/* read_sync
++ * Reads @size bytes from @ioc. Returns 0 on success.
++ */
++static inline int read_sync(QIOChannel *ioc, void *buffer, size_t size)
++{
++ ssize_t ret = read_sync_eof(ioc, buffer, size);
++
++ if (ret >= 0 && ret != size) {
++ ret = -EINVAL;
++ }
++
++ return ret < 0 ? ret : 0;
++}
++
++/* write_sync
++ * Writes @size bytes to @ioc. Returns 0 on success.
++ */
++static inline int write_sync(QIOChannel *ioc, const void *buffer, size_t size)
+ {
+ struct iovec iov = { .iov_base = (void *) buffer, .iov_len = size };
+
+- return nbd_wr_syncv(ioc, &iov, 1, size, false);
++ ssize_t ret = nbd_wr_syncv(ioc, &iov, 1, size, false);
++
++ assert(ret < 0 || ret == size);
++
++ return ret < 0 ? ret : 0;
+ }
+
+ struct NBDTLSHandshakeData {
diff --git a/nbd/server.c b/nbd/server.c
-index d8bd927013..7f44ef0b15 100644
+index 924a1fe..a1f106b 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -104,69 +104,6 @@ struct NBDClient {
@@ -39,7 +312,7 @@ index d8bd927013..7f44ef0b15 100644
- return TRUE;
-}
-
--static int nbd_negotiate_read(QIOChannel *ioc, void *buffer, size_t size)
+-static ssize_t nbd_negotiate_read(QIOChannel *ioc, void *buffer, size_t size)
-{
- ssize_t ret;
- guint watch;
@@ -51,13 +324,14 @@ index d8bd927013..7f44ef0b15 100644
- nbd_negotiate_continue,
- qemu_coroutine_self(),
- NULL);
-- ret = nbd_read(ioc, buffer, size, NULL);
+- ret = read_sync(ioc, buffer, size);
- g_source_remove(watch);
- return ret;
-
-}
-
--static int nbd_negotiate_write(QIOChannel *ioc, const void *buffer, size_t size)
+-static ssize_t nbd_negotiate_write(QIOChannel *ioc, const void *buffer,
+- size_t size)
-{
- ssize_t ret;
- guint watch;
@@ -69,204 +343,259 @@ index d8bd927013..7f44ef0b15 100644
- nbd_negotiate_continue,
- qemu_coroutine_self(),
- NULL);
-- ret = nbd_write(ioc, buffer, size, NULL);
+- ret = write_sync(ioc, buffer, size);
- g_source_remove(watch);
- return ret;
-}
-
--static int nbd_negotiate_drop_sync(QIOChannel *ioc, size_t size)
+-static ssize_t nbd_negotiate_drop_sync(QIOChannel *ioc, size_t size)
-{
-- ssize_t ret;
+- ssize_t ret, dropped = size;
- uint8_t *buffer = g_malloc(MIN(65536, size));
-
- while (size > 0) {
-- size_t count = MIN(65536, size);
-- ret = nbd_negotiate_read(ioc, buffer, count);
+- ret = nbd_negotiate_read(ioc, buffer, MIN(65536, size));
- if (ret < 0) {
- g_free(buffer);
- return ret;
- }
-
-- size -= count;
+- assert(ret <= size);
+- size -= ret;
- }
-
- g_free(buffer);
-- return 0;
+- return dropped;
-}
--
+
/* Basic flow for negotiation
- Server Client
-@@ -205,22 +142,22 @@ static int nbd_negotiate_send_rep_len(QIOChannel *ioc, uint32_t type,
+@@ -206,22 +143,22 @@ static int nbd_negotiate_send_rep_len(QIOChannel *ioc, uint32_t type,
type, opt, len);
magic = cpu_to_be64(NBD_REP_MAGIC);
-- if (nbd_negotiate_write(ioc, &magic, sizeof(magic)) < 0) {
+- if (nbd_negotiate_write(ioc, &magic, sizeof(magic)) != sizeof(magic)) {
+ if (nbd_write(ioc, &magic, sizeof(magic), NULL) < 0) {
LOG("write failed (rep magic)");
return -EINVAL;
}
opt = cpu_to_be32(opt);
-- if (nbd_negotiate_write(ioc, &opt, sizeof(opt)) < 0) {
+- if (nbd_negotiate_write(ioc, &opt, sizeof(opt)) != sizeof(opt)) {
+ if (nbd_write(ioc, &opt, sizeof(opt), NULL) < 0) {
LOG("write failed (rep opt)");
return -EINVAL;
}
type = cpu_to_be32(type);
-- if (nbd_negotiate_write(ioc, &type, sizeof(type)) < 0) {
+- if (nbd_negotiate_write(ioc, &type, sizeof(type)) != sizeof(type)) {
+ if (nbd_write(ioc, &type, sizeof(type), NULL) < 0) {
LOG("write failed (rep type)");
return -EINVAL;
}
len = cpu_to_be32(len);
-- if (nbd_negotiate_write(ioc, &len, sizeof(len)) < 0) {
+- if (nbd_negotiate_write(ioc, &len, sizeof(len)) != sizeof(len)) {
+ if (nbd_write(ioc, &len, sizeof(len), NULL) < 0) {
LOG("write failed (rep data length)");
return -EINVAL;
}
-@@ -255,7 +192,7 @@ nbd_negotiate_send_rep_err(QIOChannel *ioc, uint32_t type,
+@@ -256,7 +193,7 @@ nbd_negotiate_send_rep_err(QIOChannel *ioc, uint32_t type,
if (ret < 0) {
goto out;
}
-- if (nbd_negotiate_write(ioc, msg, len) < 0) {
+- if (nbd_negotiate_write(ioc, msg, len) != len) {
+ if (nbd_write(ioc, msg, len, NULL) < 0) {
LOG("write failed (error message)");
ret = -EIO;
} else {
-@@ -286,15 +223,15 @@ static int nbd_negotiate_send_rep_list(QIOChannel *ioc, NBDExport *exp)
+@@ -287,15 +224,15 @@ static int nbd_negotiate_send_rep_list(QIOChannel *ioc, NBDExport *exp)
}
len = cpu_to_be32(name_len);
-- if (nbd_negotiate_write(ioc, &len, sizeof(len)) < 0) {
+- if (nbd_negotiate_write(ioc, &len, sizeof(len)) != sizeof(len)) {
+ if (nbd_write(ioc, &len, sizeof(len), NULL) < 0) {
LOG("write failed (name length)");
return -EINVAL;
}
-- if (nbd_negotiate_write(ioc, name, name_len) < 0) {
+- if (nbd_negotiate_write(ioc, name, name_len) != name_len) {
+ if (nbd_write(ioc, name, name_len, NULL) < 0) {
LOG("write failed (name buffer)");
return -EINVAL;
}
-- if (nbd_negotiate_write(ioc, desc, desc_len) < 0) {
+- if (nbd_negotiate_write(ioc, desc, desc_len) != desc_len) {
+ if (nbd_write(ioc, desc, desc_len, NULL) < 0) {
LOG("write failed (description buffer)");
return -EINVAL;
}
-@@ -308,7 +245,7 @@ static int nbd_negotiate_handle_list(NBDClient *client, uint32_t length)
+@@ -309,7 +246,7 @@ static int nbd_negotiate_handle_list(NBDClient *client, uint32_t length)
NBDExport *exp;
if (length) {
-- if (nbd_negotiate_drop_sync(client->ioc, length) < 0) {
+- if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
+ if (nbd_drop(client->ioc, length, NULL) < 0) {
return -EIO;
}
return nbd_negotiate_send_rep_err(client->ioc,
-@@ -339,7 +276,7 @@ static int nbd_negotiate_handle_export_name(NBDClient *client, uint32_t length)
+@@ -340,7 +277,7 @@ static int nbd_negotiate_handle_export_name(NBDClient *client, uint32_t length)
LOG("Bad length received");
goto fail;
}
-- if (nbd_negotiate_read(client->ioc, name, length) < 0) {
+- if (nbd_negotiate_read(client->ioc, name, length) != length) {
+ if (nbd_read(client->ioc, name, length, NULL) < 0) {
LOG("read failed");
goto fail;
}
-@@ -372,7 +309,7 @@ static QIOChannel *nbd_negotiate_handle_starttls(NBDClient *client,
+@@ -373,7 +310,7 @@ static QIOChannel *nbd_negotiate_handle_starttls(NBDClient *client,
TRACE("Setting up TLS");
ioc = client->ioc;
if (length) {
-- if (nbd_negotiate_drop_sync(ioc, length) < 0) {
+- if (nbd_negotiate_drop_sync(ioc, length) != length) {
+ if (nbd_drop(ioc, length, NULL) < 0) {
return NULL;
}
nbd_negotiate_send_rep_err(ioc, NBD_REP_ERR_INVALID, NBD_OPT_STARTTLS,
-@@ -436,7 +373,7 @@ static int nbd_negotiate_options(NBDClient *client)
+@@ -437,8 +374,7 @@ static int nbd_negotiate_options(NBDClient *client)
... Rest of request
*/
-- if (nbd_negotiate_read(client->ioc, &flags, sizeof(flags)) < 0) {
+- if (nbd_negotiate_read(client->ioc, &flags, sizeof(flags)) !=
+- sizeof(flags)) {
+ if (nbd_read(client->ioc, &flags, sizeof(flags), NULL) < 0) {
LOG("read failed");
return -EIO;
}
-@@ -462,7 +399,7 @@ static int nbd_negotiate_options(NBDClient *client)
+@@ -464,8 +400,7 @@ static int nbd_negotiate_options(NBDClient *client)
uint32_t clientflags, length;
uint64_t magic;
-- if (nbd_negotiate_read(client->ioc, &magic, sizeof(magic)) < 0) {
+- if (nbd_negotiate_read(client->ioc, &magic, sizeof(magic)) !=
+- sizeof(magic)) {
+ if (nbd_read(client->ioc, &magic, sizeof(magic), NULL) < 0) {
LOG("read failed");
return -EINVAL;
}
-@@ -472,15 +409,15 @@ static int nbd_negotiate_options(NBDClient *client)
+@@ -475,15 +410,15 @@ static int nbd_negotiate_options(NBDClient *client)
return -EINVAL;
}
- if (nbd_negotiate_read(client->ioc, &clientflags,
-- sizeof(clientflags)) < 0)
+- sizeof(clientflags)) != sizeof(clientflags)) {
+ if (nbd_read(client->ioc, &clientflags,
+ sizeof(clientflags), NULL) < 0)
- {
++ {
LOG("read failed");
return -EINVAL;
}
clientflags = be32_to_cpu(clientflags);
-- if (nbd_negotiate_read(client->ioc, &length, sizeof(length)) < 0) {
+- if (nbd_negotiate_read(client->ioc, &length, sizeof(length)) !=
+- sizeof(length)) {
+ if (nbd_read(client->ioc, &length, sizeof(length), NULL) < 0) {
LOG("read failed");
return -EINVAL;
}
-@@ -510,7 +447,7 @@ static int nbd_negotiate_options(NBDClient *client)
+@@ -513,7 +448,7 @@ static int nbd_negotiate_options(NBDClient *client)
return -EINVAL;
default:
-- if (nbd_negotiate_drop_sync(client->ioc, length) < 0) {
+- if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
+ if (nbd_drop(client->ioc, length, NULL) < 0) {
return -EIO;
}
ret = nbd_negotiate_send_rep_err(client->ioc,
-@@ -548,7 +485,7 @@ static int nbd_negotiate_options(NBDClient *client)
+@@ -551,7 +486,7 @@ static int nbd_negotiate_options(NBDClient *client)
return nbd_negotiate_handle_export_name(client, length);
case NBD_OPT_STARTTLS:
-- if (nbd_negotiate_drop_sync(client->ioc, length) < 0) {
+- if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
+ if (nbd_drop(client->ioc, length, NULL) < 0) {
return -EIO;
}
if (client->tlscreds) {
-@@ -567,7 +504,7 @@ static int nbd_negotiate_options(NBDClient *client)
+@@ -570,7 +505,7 @@ static int nbd_negotiate_options(NBDClient *client)
}
break;
default:
-- if (nbd_negotiate_drop_sync(client->ioc, length) < 0) {
+- if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
+ if (nbd_drop(client->ioc, length, NULL) < 0) {
return -EIO;
}
ret = nbd_negotiate_send_rep_err(client->ioc,
-@@ -656,12 +593,12 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data)
+@@ -659,12 +594,12 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data)
TRACE("TLS cannot be enabled with oldstyle protocol");
goto fail;
}
-- if (nbd_negotiate_write(client->ioc, buf, sizeof(buf)) < 0) {
+- if (nbd_negotiate_write(client->ioc, buf, sizeof(buf)) != sizeof(buf)) {
+ if (nbd_write(client->ioc, buf, sizeof(buf), NULL) < 0) {
LOG("write failed");
goto fail;
}
} else {
-- if (nbd_negotiate_write(client->ioc, buf, 18) < 0) {
+- if (nbd_negotiate_write(client->ioc, buf, 18) != 18) {
+ if (nbd_write(client->ioc, buf, 18, NULL) < 0) {
LOG("write failed");
goto fail;
}
-@@ -676,7 +613,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data)
+@@ -679,7 +614,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data)
stq_be_p(buf + 18, client->exp->size);
stw_be_p(buf + 26, client->exp->nbdflags | myflags);
len = client->no_zeroes ? 10 : sizeof(buf) - 18;
-- if (nbd_negotiate_write(client->ioc, buf + 18, len) < 0) {
+- if (nbd_negotiate_write(client->ioc, buf + 18, len) != len) {
+ if (nbd_write(client->ioc, buf + 18, len, NULL) < 0) {
LOG("write failed");
goto fail;
}
---
-2.13.0
-
+@@ -702,11 +637,6 @@ static ssize_t nbd_receive_request(QIOChannel *ioc, NBDRequest *request)
+ return ret;
+ }
+
+- if (ret != sizeof(buf)) {
+- LOG("read failed");
+- return -EINVAL;
+- }
+-
+ /* Request
+ [ 0 .. 3] magic (NBD_REQUEST_MAGIC)
+ [ 4 .. 5] flags (NBD_CMD_FLAG_FUA, ...)
+@@ -737,7 +667,6 @@ static ssize_t nbd_receive_request(QIOChannel *ioc, NBDRequest *request)
+ static ssize_t nbd_send_reply(QIOChannel *ioc, NBDReply *reply)
+ {
+ uint8_t buf[NBD_REPLY_SIZE];
+- ssize_t ret;
+
+ reply->error = system_errno_to_nbd_errno(reply->error);
+
+@@ -754,16 +683,7 @@ static ssize_t nbd_send_reply(QIOChannel *ioc, NBDReply *reply)
+ stl_be_p(buf + 4, reply->error);
+ stq_be_p(buf + 8, reply->handle);
+
+- ret = write_sync(ioc, buf, sizeof(buf));
+- if (ret < 0) {
+- return ret;
+- }
+-
+- if (ret != sizeof(buf)) {
+- LOG("writing to socket failed");
+- return -EINVAL;
+- }
+- return 0;
++ return write_sync(ioc, buf, sizeof(buf));
+ }
+
+ #define MAX_NBD_REQUESTS 16
+@@ -1067,7 +987,7 @@ static ssize_t nbd_co_send_reply(NBDRequestData *req, NBDReply *reply,
+ rc = nbd_send_reply(client->ioc, reply);
+ if (rc >= 0) {
+ ret = write_sync(client->ioc, req->data, len);
+- if (ret != len) {
++ if (ret < 0) {
+ rc = -EIO;
+ }
+ }
+@@ -1141,7 +1061,7 @@ static ssize_t nbd_co_receive_request(NBDRequestData *req,
+ if (request->type == NBD_CMD_WRITE) {
+ TRACE("Reading %" PRIu32 " byte(s)", request->len);
+
+- if (read_sync(client->ioc, req->data, request->len) != request->len) {
++ if (read_sync(client->ioc, req->data, request->len) < 0) {
+ LOG("reading from socket failed");
+ rc = -EIO;
+ goto out;
diff --git a/app-emulation/qemu/qemu-2.9.0-r55.ebuild b/app-emulation/qemu/qemu-2.9.0-r56.ebuild
similarity index 99%
rename from app-emulation/qemu/qemu-2.9.0-r55.ebuild
rename to app-emulation/qemu/qemu-2.9.0-r56.ebuild
index 4a7f4b1c5f1..438834b538e 100644
--- a/app-emulation/qemu/qemu-2.9.0-r55.ebuild
+++ b/app-emulation/qemu/qemu-2.9.0-r56.ebuild
@@ -205,9 +205,11 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.9.0-CVE-2017-9524-2.patch
"${FILESDIR}"/${PN}-2.9.0-CVE-2017-9503-1.patch # bug 621184
"${FILESDIR}"/${PN}-2.9.0-CVE-2017-9503-2.patch
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-10664.patch # bug 623016
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-10806.patch # bug 624088
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-7539.patch # bug 625850
)
-
STRIP_MASK="/usr/share/qemu/palcode-clipper"
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-07-26 19:37 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-07-26 19:37 UTC (permalink / raw
To: gentoo-commits
commit: c1cfb0a6fc70ace0f86c41dfd6bc8e0b1a441320
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 26 19:28:54 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Wed Jul 26 19:37:33 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1cfb0a6
app-emulation/qemu: Remove faulty patch
Package-Manager: Portage-2.3.6, Repoman-2.3.3
.../qemu/files/qemu-2.9.0-CVE-2017-7539.patch | 601 ---------------------
app-emulation/qemu/qemu-2.9.0-r56.ebuild | 1 -
2 files changed, 602 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7539.patch b/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7539.patch
deleted file mode 100644
index ee77a59373e..00000000000
--- a/app-emulation/qemu/files/qemu-2.9.0-CVE-2017-7539.patch
+++ /dev/null
@@ -1,601 +0,0 @@
-From 2b0bbc4f8809c972bad134bc1a2570dbb01dea0b Mon Sep 17 00:00:00 2001
-From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
-Date: Fri, 2 Jun 2017 18:01:41 +0300
-Subject: [PATCH] nbd/server: get rid of nbd_negotiate_read and friends
-
-Functions nbd_negotiate_{read,write,drop_sync} were introduced in
-1a6245a5b, when nbd_rwv (was nbd_wr_sync) was working through
-qemu_co_sendv_recvv (the path is nbd_wr_sync -> qemu_co_{recv/send} ->
-qemu_co_send_recv -> qemu_co_sendv_recvv), which just yields, without
-setting any handlers. But starting from ff82911cd nbd_rwv (was
-nbd_wr_syncv) works through qio_channel_yield() which sets handlers, so
-watchers are redundant in nbd_negotiate_{read,write,drop_sync}, then,
-let's just use nbd_{read,write,drop} functions.
-
-Functions nbd_{read,write,drop} has errp parameter, which is unused in
-this patch. This will be fixed later.
-
-Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Message-Id: <20170602150150.258222-4-vsementsov@virtuozzo.com>
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- nbd/server.c | 107 ++++++++++++-----------------------------------------------
- 1 file changed, 22 insertions(+), 85 deletions(-)
-
-diff --git a/nbd/client.c b/nbd/client.c
-index a58fb02..6b74a62 100644
---- a/nbd/client.c
-+++ b/nbd/client.c
-@@ -86,9 +86,9 @@ static QTAILQ_HEAD(, NBDExport) exports = QTAILQ_HEAD_INITIALIZER(exports);
-
- */
-
--/* Discard length bytes from channel. Return -errno on failure, or
-- * the amount of bytes consumed. */
--static ssize_t drop_sync(QIOChannel *ioc, size_t size)
-+/* Discard length bytes from channel. Return -errno on failure and 0 on
-+ * success*/
-+static int drop_sync(QIOChannel *ioc, size_t size)
- {
- ssize_t ret = 0;
- char small[1024];
-@@ -96,14 +96,13 @@ static ssize_t drop_sync(QIOChannel *ioc, size_t size)
-
- buffer = sizeof(small) >= size ? small : g_malloc(MIN(65536, size));
- while (size > 0) {
-- ssize_t count = read_sync(ioc, buffer, MIN(65536, size));
-+ ssize_t count = MIN(65536, size);
-+ ret = read_sync(ioc, buffer, MIN(65536, size));
-
-- if (count <= 0) {
-+ if (ret < 0) {
- goto cleanup;
- }
-- assert(count <= size);
- size -= count;
-- ret += count;
- }
-
- cleanup:
-@@ -136,12 +135,12 @@ static int nbd_send_option_request(QIOChannel *ioc, uint32_t opt,
- stl_be_p(&req.option, opt);
- stl_be_p(&req.length, len);
-
-- if (write_sync(ioc, &req, sizeof(req)) != sizeof(req)) {
-+ if (write_sync(ioc, &req, sizeof(req)) < 0) {
- error_setg(errp, "Failed to send option request header");
- return -1;
- }
-
-- if (len && write_sync(ioc, (char *) data, len) != len) {
-+ if (len && write_sync(ioc, (char *) data, len) < 0) {
- error_setg(errp, "Failed to send option request data");
- return -1;
- }
-@@ -170,7 +169,7 @@ static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt,
- nbd_opt_reply *reply, Error **errp)
- {
- QEMU_BUILD_BUG_ON(sizeof(*reply) != 20);
-- if (read_sync(ioc, reply, sizeof(*reply)) != sizeof(*reply)) {
-+ if (read_sync(ioc, reply, sizeof(*reply)) < 0) {
- error_setg(errp, "failed to read option reply");
- nbd_send_opt_abort(ioc);
- return -1;
-@@ -219,7 +218,7 @@ static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply,
- goto cleanup;
- }
- msg = g_malloc(reply->length + 1);
-- if (read_sync(ioc, msg, reply->length) != reply->length) {
-+ if (read_sync(ioc, msg, reply->length) < 0) {
- error_setg(errp, "failed to read option error message");
- goto cleanup;
- }
-@@ -321,7 +320,7 @@ static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
- nbd_send_opt_abort(ioc);
- return -1;
- }
-- if (read_sync(ioc, &namelen, sizeof(namelen)) != sizeof(namelen)) {
-+ if (read_sync(ioc, &namelen, sizeof(namelen)) < 0) {
- error_setg(errp, "failed to read option name length");
- nbd_send_opt_abort(ioc);
- return -1;
-@@ -334,7 +333,7 @@ static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
- return -1;
- }
- if (namelen != strlen(want)) {
-- if (drop_sync(ioc, len) != len) {
-+ if (drop_sync(ioc, len) < 0) {
- error_setg(errp, "failed to skip export name with wrong length");
- nbd_send_opt_abort(ioc);
- return -1;
-@@ -343,14 +342,14 @@ static int nbd_receive_list(QIOChannel *ioc, const char *want, bool *match,
- }
-
- assert(namelen < sizeof(name));
-- if (read_sync(ioc, name, namelen) != namelen) {
-+ if (read_sync(ioc, name, namelen) < 0) {
- error_setg(errp, "failed to read export name");
- nbd_send_opt_abort(ioc);
- return -1;
- }
- name[namelen] = '\0';
- len -= namelen;
-- if (drop_sync(ioc, len) != len) {
-+ if (drop_sync(ioc, len) < 0) {
- error_setg(errp, "failed to read export description");
- nbd_send_opt_abort(ioc);
- return -1;
-@@ -477,7 +476,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
- goto fail;
- }
-
-- if (read_sync(ioc, buf, 8) != 8) {
-+ if (read_sync(ioc, buf, 8) < 0) {
- error_setg(errp, "Failed to read data");
- goto fail;
- }
-@@ -503,7 +502,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
- goto fail;
- }
-
-- if (read_sync(ioc, &magic, sizeof(magic)) != sizeof(magic)) {
-+ if (read_sync(ioc, &magic, sizeof(magic)) < 0) {
- error_setg(errp, "Failed to read magic");
- goto fail;
- }
-@@ -515,8 +514,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
- uint16_t globalflags;
- bool fixedNewStyle = false;
-
-- if (read_sync(ioc, &globalflags, sizeof(globalflags)) !=
-- sizeof(globalflags)) {
-+ if (read_sync(ioc, &globalflags, sizeof(globalflags)) < 0) {
- error_setg(errp, "Failed to read server flags");
- goto fail;
- }
-@@ -534,8 +532,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
- }
- /* client requested flags */
- clientflags = cpu_to_be32(clientflags);
-- if (write_sync(ioc, &clientflags, sizeof(clientflags)) !=
-- sizeof(clientflags)) {
-+ if (write_sync(ioc, &clientflags, sizeof(clientflags)) < 0) {
- error_setg(errp, "Failed to send clientflags field");
- goto fail;
- }
-@@ -573,13 +570,13 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
- }
-
- /* Read the response */
-- if (read_sync(ioc, &s, sizeof(s)) != sizeof(s)) {
-+ if (read_sync(ioc, &s, sizeof(s)) < 0) {
- error_setg(errp, "Failed to read export length");
- goto fail;
- }
- *size = be64_to_cpu(s);
-
-- if (read_sync(ioc, flags, sizeof(*flags)) != sizeof(*flags)) {
-+ if (read_sync(ioc, flags, sizeof(*flags)) < 0) {
- error_setg(errp, "Failed to read export flags");
- goto fail;
- }
-@@ -596,14 +593,14 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
- goto fail;
- }
-
-- if (read_sync(ioc, &s, sizeof(s)) != sizeof(s)) {
-+ if (read_sync(ioc, &s, sizeof(s)) < 0) {
- error_setg(errp, "Failed to read export length");
- goto fail;
- }
- *size = be64_to_cpu(s);
- TRACE("Size is %" PRIu64, *size);
-
-- if (read_sync(ioc, &oldflags, sizeof(oldflags)) != sizeof(oldflags)) {
-+ if (read_sync(ioc, &oldflags, sizeof(oldflags)) < 0) {
- error_setg(errp, "Failed to read export flags");
- goto fail;
- }
-@@ -619,7 +616,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
- }
-
- TRACE("Size is %" PRIu64 ", export flags %" PRIx16, *size, *flags);
-- if (zeroes && drop_sync(ioc, 124) != 124) {
-+ if (zeroes && drop_sync(ioc, 124) < 0) {
- error_setg(errp, "Failed to read reserved block");
- goto fail;
- }
-@@ -744,7 +741,6 @@ int nbd_disconnect(int fd)
- ssize_t nbd_send_request(QIOChannel *ioc, NBDRequest *request)
- {
- uint8_t buf[NBD_REQUEST_SIZE];
-- ssize_t ret;
-
- TRACE("Sending request to server: "
- "{ .from = %" PRIu64", .len = %" PRIu32 ", .handle = %" PRIu64
-@@ -759,16 +755,7 @@ ssize_t nbd_send_request(QIOChannel *ioc, NBDRequest *request)
- stq_be_p(buf + 16, request->from);
- stl_be_p(buf + 24, request->len);
-
-- ret = write_sync(ioc, buf, sizeof(buf));
-- if (ret < 0) {
-- return ret;
-- }
--
-- if (ret != sizeof(buf)) {
-- LOG("writing to socket failed");
-- return -EINVAL;
-- }
-- return 0;
-+ return write_sync(ioc, buf, sizeof(buf));
- }
-
- ssize_t nbd_receive_reply(QIOChannel *ioc, NBDReply *reply)
-@@ -777,7 +764,7 @@ ssize_t nbd_receive_reply(QIOChannel *ioc, NBDReply *reply)
- uint32_t magic;
- ssize_t ret;
-
-- ret = read_sync(ioc, buf, sizeof(buf));
-+ ret = read_sync_eof(ioc, buf, sizeof(buf));
- if (ret <= 0) {
- return ret;
- }
-diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h
-index f43d990..e6bbc7c 100644
---- a/nbd/nbd-internal.h
-+++ b/nbd/nbd-internal.h
-@@ -94,7 +94,13 @@
- #define NBD_ENOSPC 28
- #define NBD_ESHUTDOWN 108
-
--static inline ssize_t read_sync(QIOChannel *ioc, void *buffer, size_t size)
-+/* read_sync_eof
-+ * Tries to read @size bytes from @ioc. Returns number of bytes actually read.
-+ * May return a value >= 0 and < size only on EOF, i.e. when iteratively called
-+ * qio_channel_readv() returns 0. So, there are no needs to call read_sync_eof
-+ * iteratively.
-+ */
-+static inline ssize_t read_sync_eof(QIOChannel *ioc, void *buffer, size_t size)
- {
- struct iovec iov = { .iov_base = buffer, .iov_len = size };
- /* Sockets are kept in blocking mode in the negotiation phase. After
-@@ -105,12 +111,32 @@ static inline ssize_t read_sync(QIOChannel *ioc, void *buffer, size_t size)
- return nbd_wr_syncv(ioc, &iov, 1, size, true);
- }
-
--static inline ssize_t write_sync(QIOChannel *ioc, const void *buffer,
-- size_t size)
-+/* read_sync
-+ * Reads @size bytes from @ioc. Returns 0 on success.
-+ */
-+static inline int read_sync(QIOChannel *ioc, void *buffer, size_t size)
-+{
-+ ssize_t ret = read_sync_eof(ioc, buffer, size);
-+
-+ if (ret >= 0 && ret != size) {
-+ ret = -EINVAL;
-+ }
-+
-+ return ret < 0 ? ret : 0;
-+}
-+
-+/* write_sync
-+ * Writes @size bytes to @ioc. Returns 0 on success.
-+ */
-+static inline int write_sync(QIOChannel *ioc, const void *buffer, size_t size)
- {
- struct iovec iov = { .iov_base = (void *) buffer, .iov_len = size };
-
-- return nbd_wr_syncv(ioc, &iov, 1, size, false);
-+ ssize_t ret = nbd_wr_syncv(ioc, &iov, 1, size, false);
-+
-+ assert(ret < 0 || ret == size);
-+
-+ return ret < 0 ? ret : 0;
- }
-
- struct NBDTLSHandshakeData {
-diff --git a/nbd/server.c b/nbd/server.c
-index 924a1fe..a1f106b 100644
---- a/nbd/server.c
-+++ b/nbd/server.c
-@@ -104,69 +104,6 @@ struct NBDClient {
-
- static void nbd_client_receive_next_request(NBDClient *client);
-
--static gboolean nbd_negotiate_continue(QIOChannel *ioc,
-- GIOCondition condition,
-- void *opaque)
--{
-- qemu_coroutine_enter(opaque);
-- return TRUE;
--}
--
--static ssize_t nbd_negotiate_read(QIOChannel *ioc, void *buffer, size_t size)
--{
-- ssize_t ret;
-- guint watch;
--
-- assert(qemu_in_coroutine());
-- /* Negotiation are always in main loop. */
-- watch = qio_channel_add_watch(ioc,
-- G_IO_IN,
-- nbd_negotiate_continue,
-- qemu_coroutine_self(),
-- NULL);
-- ret = read_sync(ioc, buffer, size);
-- g_source_remove(watch);
-- return ret;
--
--}
--
--static ssize_t nbd_negotiate_write(QIOChannel *ioc, const void *buffer,
-- size_t size)
--{
-- ssize_t ret;
-- guint watch;
--
-- assert(qemu_in_coroutine());
-- /* Negotiation are always in main loop. */
-- watch = qio_channel_add_watch(ioc,
-- G_IO_OUT,
-- nbd_negotiate_continue,
-- qemu_coroutine_self(),
-- NULL);
-- ret = write_sync(ioc, buffer, size);
-- g_source_remove(watch);
-- return ret;
--}
--
--static ssize_t nbd_negotiate_drop_sync(QIOChannel *ioc, size_t size)
--{
-- ssize_t ret, dropped = size;
-- uint8_t *buffer = g_malloc(MIN(65536, size));
--
-- while (size > 0) {
-- ret = nbd_negotiate_read(ioc, buffer, MIN(65536, size));
-- if (ret < 0) {
-- g_free(buffer);
-- return ret;
-- }
--
-- assert(ret <= size);
-- size -= ret;
-- }
--
-- g_free(buffer);
-- return dropped;
--}
-
- /* Basic flow for negotiation
-
-@@ -206,22 +143,22 @@ static int nbd_negotiate_send_rep_len(QIOChannel *ioc, uint32_t type,
- type, opt, len);
-
- magic = cpu_to_be64(NBD_REP_MAGIC);
-- if (nbd_negotiate_write(ioc, &magic, sizeof(magic)) != sizeof(magic)) {
-+ if (write_sync(ioc, &magic, sizeof(magic), NULL) < 0) {
- LOG("write failed (rep magic)");
- return -EINVAL;
- }
- opt = cpu_to_be32(opt);
-- if (nbd_negotiate_write(ioc, &opt, sizeof(opt)) != sizeof(opt)) {
-+ if (write_sync(ioc, &opt, sizeof(opt), NULL) < 0) {
- LOG("write failed (rep opt)");
- return -EINVAL;
- }
- type = cpu_to_be32(type);
-- if (nbd_negotiate_write(ioc, &type, sizeof(type)) != sizeof(type)) {
-+ if (write_sync(ioc, &type, sizeof(type), NULL) < 0) {
- LOG("write failed (rep type)");
- return -EINVAL;
- }
- len = cpu_to_be32(len);
-- if (nbd_negotiate_write(ioc, &len, sizeof(len)) != sizeof(len)) {
-+ if (write_sync(ioc, &len, sizeof(len), NULL) < 0) {
- LOG("write failed (rep data length)");
- return -EINVAL;
- }
-@@ -256,7 +193,7 @@ nbd_negotiate_send_rep_err(QIOChannel *ioc, uint32_t type,
- if (ret < 0) {
- goto out;
- }
-- if (nbd_negotiate_write(ioc, msg, len) != len) {
-+ if (write_sync(ioc, msg, len, NULL) < 0) {
- LOG("write failed (error message)");
- ret = -EIO;
- } else {
-@@ -287,15 +224,15 @@ static int nbd_negotiate_send_rep_list(QIOChannel *ioc, NBDExport *exp)
- }
-
- len = cpu_to_be32(name_len);
-- if (nbd_negotiate_write(ioc, &len, sizeof(len)) != sizeof(len)) {
-+ if (write_sync(ioc, &len, sizeof(len), NULL) < 0) {
- LOG("write failed (name length)");
- return -EINVAL;
- }
-- if (nbd_negotiate_write(ioc, name, name_len) != name_len) {
-+ if (write_sync(ioc, name, name_len, NULL) < 0) {
- LOG("write failed (name buffer)");
- return -EINVAL;
- }
-- if (nbd_negotiate_write(ioc, desc, desc_len) != desc_len) {
-+ if (write_sync(ioc, desc, desc_len, NULL) < 0) {
- LOG("write failed (description buffer)");
- return -EINVAL;
- }
-@@ -309,7 +246,7 @@ static int nbd_negotiate_handle_list(NBDClient *client, uint32_t length)
- NBDExport *exp;
-
- if (length) {
-- if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
-+ if (nbd_drop(client->ioc, length, NULL) < 0) {
- return -EIO;
- }
- return nbd_negotiate_send_rep_err(client->ioc,
-@@ -340,7 +277,7 @@ static int nbd_negotiate_handle_export_name(NBDClient *client, uint32_t length)
- LOG("Bad length received");
- goto fail;
- }
-- if (nbd_negotiate_read(client->ioc, name, length) != length) {
-+ if (nbd_read(client->ioc, name, length, NULL) < 0) {
- LOG("read failed");
- goto fail;
- }
-@@ -373,7 +310,7 @@ static QIOChannel *nbd_negotiate_handle_starttls(NBDClient *client,
- TRACE("Setting up TLS");
- ioc = client->ioc;
- if (length) {
-- if (nbd_negotiate_drop_sync(ioc, length) != length) {
-+ if (nbd_drop(ioc, length, NULL) < 0) {
- return NULL;
- }
- nbd_negotiate_send_rep_err(ioc, NBD_REP_ERR_INVALID, NBD_OPT_STARTTLS,
-@@ -437,8 +374,7 @@ static int nbd_negotiate_options(NBDClient *client)
- ... Rest of request
- */
-
-- if (nbd_negotiate_read(client->ioc, &flags, sizeof(flags)) !=
-- sizeof(flags)) {
-+ if (nbd_read(client->ioc, &flags, sizeof(flags), NULL) < 0) {
- LOG("read failed");
- return -EIO;
- }
-@@ -464,8 +400,7 @@ static int nbd_negotiate_options(NBDClient *client)
- uint32_t clientflags, length;
- uint64_t magic;
-
-- if (nbd_negotiate_read(client->ioc, &magic, sizeof(magic)) !=
-- sizeof(magic)) {
-+ if (nbd_read(client->ioc, &magic, sizeof(magic), NULL) < 0) {
- LOG("read failed");
- return -EINVAL;
- }
-@@ -475,15 +410,15 @@ static int nbd_negotiate_options(NBDClient *client)
- return -EINVAL;
- }
-
-- if (nbd_negotiate_read(client->ioc, &clientflags,
-- sizeof(clientflags)) != sizeof(clientflags)) {
-+ if (nbd_read(client->ioc, &clientflags,
-+ sizeof(clientflags), NULL) < 0)
-+ {
- LOG("read failed");
- return -EINVAL;
- }
- clientflags = be32_to_cpu(clientflags);
-
-- if (nbd_negotiate_read(client->ioc, &length, sizeof(length)) !=
-- sizeof(length)) {
-+ if (nbd_read(client->ioc, &length, sizeof(length), NULL) < 0) {
- LOG("read failed");
- return -EINVAL;
- }
-@@ -513,7 +448,7 @@ static int nbd_negotiate_options(NBDClient *client)
- return -EINVAL;
-
- default:
-- if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
-+ if (nbd_drop(client->ioc, length, NULL) < 0) {
- return -EIO;
- }
- ret = nbd_negotiate_send_rep_err(client->ioc,
-@@ -551,7 +486,7 @@ static int nbd_negotiate_options(NBDClient *client)
- return nbd_negotiate_handle_export_name(client, length);
-
- case NBD_OPT_STARTTLS:
-- if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
-+ if (nbd_drop(client->ioc, length, NULL) < 0) {
- return -EIO;
- }
- if (client->tlscreds) {
-@@ -570,7 +505,7 @@ static int nbd_negotiate_options(NBDClient *client)
- }
- break;
- default:
-- if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
-+ if (nbd_drop(client->ioc, length, NULL) < 0) {
- return -EIO;
- }
- ret = nbd_negotiate_send_rep_err(client->ioc,
-@@ -659,12 +594,12 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data)
- TRACE("TLS cannot be enabled with oldstyle protocol");
- goto fail;
- }
-- if (nbd_negotiate_write(client->ioc, buf, sizeof(buf)) != sizeof(buf)) {
-+ if (write_sync(client->ioc, buf, sizeof(buf), NULL) < 0) {
- LOG("write failed");
- goto fail;
- }
- } else {
-- if (nbd_negotiate_write(client->ioc, buf, 18) != 18) {
-+ if (write_sync(client->ioc, buf, 18, NULL) < 0) {
- LOG("write failed");
- goto fail;
- }
-@@ -679,7 +614,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data)
- stq_be_p(buf + 18, client->exp->size);
- stw_be_p(buf + 26, client->exp->nbdflags | myflags);
- len = client->no_zeroes ? 10 : sizeof(buf) - 18;
-- if (nbd_negotiate_write(client->ioc, buf + 18, len) != len) {
-+ if (write_sync(client->ioc, buf + 18, len, NULL) < 0) {
- LOG("write failed");
- goto fail;
- }
-@@ -702,11 +637,6 @@ static ssize_t nbd_receive_request(QIOChannel *ioc, NBDRequest *request)
- return ret;
- }
-
-- if (ret != sizeof(buf)) {
-- LOG("read failed");
-- return -EINVAL;
-- }
--
- /* Request
- [ 0 .. 3] magic (NBD_REQUEST_MAGIC)
- [ 4 .. 5] flags (NBD_CMD_FLAG_FUA, ...)
-@@ -737,7 +667,6 @@ static ssize_t nbd_receive_request(QIOChannel *ioc, NBDRequest *request)
- static ssize_t nbd_send_reply(QIOChannel *ioc, NBDReply *reply)
- {
- uint8_t buf[NBD_REPLY_SIZE];
-- ssize_t ret;
-
- reply->error = system_errno_to_nbd_errno(reply->error);
-
-@@ -754,16 +683,7 @@ static ssize_t nbd_send_reply(QIOChannel *ioc, NBDReply *reply)
- stl_be_p(buf + 4, reply->error);
- stq_be_p(buf + 8, reply->handle);
-
-- ret = write_sync(ioc, buf, sizeof(buf));
-- if (ret < 0) {
-- return ret;
-- }
--
-- if (ret != sizeof(buf)) {
-- LOG("writing to socket failed");
-- return -EINVAL;
-- }
-- return 0;
-+ return write_sync(ioc, buf, sizeof(buf));
- }
-
- #define MAX_NBD_REQUESTS 16
-@@ -1067,7 +987,7 @@ static ssize_t nbd_co_send_reply(NBDRequestData *req, NBDReply *reply,
- rc = nbd_send_reply(client->ioc, reply);
- if (rc >= 0) {
- ret = write_sync(client->ioc, req->data, len);
-- if (ret != len) {
-+ if (ret < 0) {
- rc = -EIO;
- }
- }
-@@ -1141,7 +1061,7 @@ static ssize_t nbd_co_receive_request(NBDRequestData *req,
- if (request->type == NBD_CMD_WRITE) {
- TRACE("Reading %" PRIu32 " byte(s)", request->len);
-
-- if (read_sync(client->ioc, req->data, request->len) != request->len) {
-+ if (read_sync(client->ioc, req->data, request->len) < 0) {
- LOG("reading from socket failed");
- rc = -EIO;
- goto out;
diff --git a/app-emulation/qemu/qemu-2.9.0-r56.ebuild b/app-emulation/qemu/qemu-2.9.0-r56.ebuild
index 438834b538e..c27df42275a 100644
--- a/app-emulation/qemu/qemu-2.9.0-r56.ebuild
+++ b/app-emulation/qemu/qemu-2.9.0-r56.ebuild
@@ -207,7 +207,6 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.9.0-CVE-2017-9503-2.patch
"${FILESDIR}"/${PN}-2.9.0-CVE-2017-10664.patch # bug 623016
"${FILESDIR}"/${PN}-2.9.0-CVE-2017-10806.patch # bug 624088
- "${FILESDIR}"/${PN}-2.9.0-CVE-2017-7539.patch # bug 625850
)
STRIP_MASK="/usr/share/qemu/palcode-clipper"
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2017-09-01 1:32 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2017-09-01 1:32 UTC (permalink / raw
To: gentoo-commits
commit: ecbdc929ac2d3b34812aa3b3ac07054198a0547c
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 1 01:31:14 2017 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Fri Sep 1 01:31:14 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ecbdc929
app-emulation/qemu: version bump to 2.10.0, bug #629350
This version bump also addresses a number of security issues
CVE-2017-12809, bug #628498
CVE-2017-13673, bug #629316
CVE-2017-13711, bug #629350
Package-Manager: Portage-2.3.6, Repoman-2.3.3
app-emulation/qemu/Manifest | 1 +
.../qemu/files/qemu-2.10.0-CVE-2017-13711.patch | 80 +++
app-emulation/qemu/qemu-2.10.0.ebuild | 781 +++++++++++++++++++++
3 files changed, 862 insertions(+)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index fb4bf044093..0c8db490a09 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1 +1,2 @@
+DIST qemu-2.10.0.tar.bz2 30955656 SHA256 7e9f39e1306e6dcc595494e91c1464d4b03f55ddd2053183e0e1b69f7f776d48 SHA512 ea21c014030f8a902df159641e6ccb45f0850ac5cb1cb8ab6845124c44ea5def54845e7bc66a6e80d624c78069f9baa913ee5119704076ae4ff47ab018ace9f9 WHIRLPOOL 58f846788fdf2b0c90e6d17ce921a1fe02556968d38ffc11be7e32b81ebc723dfeaa790f22d8085d4f388eb01fe0daa3ddbc00630c5ecba083df33cc9709fb39
DIST qemu-2.9.0.tar.bz2 28720490 SHA256 00bfb217b1bb03c7a6c3261b819cfccbfb5a58e3e2ceff546327d271773c6c14 SHA512 4b28966eec0ca44681e35fcfb64a4eaef7c280b8d65c91d03f2efa37f76278fd8c1680e5798c7a30dbfcc8f3c05f4a803f48b8a2dfec3a4181bac079b2a5e422 WHIRLPOOL d79fe89eb271a56aee0cbd328e5f96999176b711afb5683d164b7b99d91e6dd2bfaf6e2ff4cd820a941c94f28116765cb07ffd5809d75c2f9654a67d56bfc0c1
diff --git a/app-emulation/qemu/files/qemu-2.10.0-CVE-2017-13711.patch b/app-emulation/qemu/files/qemu-2.10.0-CVE-2017-13711.patch
new file mode 100644
index 00000000000..9d026568492
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.10.0-CVE-2017-13711.patch
@@ -0,0 +1,80 @@
+From 1201d308519f1e915866d7583d5136d03cc1d384 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date: Fri, 25 Aug 2017 01:35:53 +0200
+Subject: [PATCH] slirp: fix clearing ifq_so from pending packets
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The if_fastq and if_batchq contain not only packets, but queues of packets
+for the same socket. When sofree frees a socket, it thus has to clear ifq_so
+from all the packets from the queues, not only the first.
+
+Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+---
+ slirp/socket.c | 39 +++++++++++++++++++++++----------------
+ 1 file changed, 23 insertions(+), 16 deletions(-)
+
+diff --git a/slirp/socket.c b/slirp/socket.c
+index ecec0295a9..cb7b5b608d 100644
+--- a/slirp/socket.c
++++ b/slirp/socket.c
+@@ -60,29 +60,36 @@ socreate(Slirp *slirp)
+ }
+
+ /*
++ * Remove references to so from the given message queue.
++ */
++static void
++soqfree(struct socket *so, struct quehead *qh)
++{
++ struct mbuf *ifq;
++
++ for (ifq = (struct mbuf *) qh->qh_link;
++ (struct quehead *) ifq != qh;
++ ifq = ifq->ifq_next) {
++ if (ifq->ifq_so == so) {
++ struct mbuf *ifm;
++ ifq->ifq_so = NULL;
++ for (ifm = ifq->ifs_next; ifm != ifq; ifm = ifm->ifs_next) {
++ ifm->ifq_so = NULL;
++ }
++ }
++ }
++}
++
++/*
+ * remque and free a socket, clobber cache
+ */
+ void
+ sofree(struct socket *so)
+ {
+ Slirp *slirp = so->slirp;
+- struct mbuf *ifm;
+
+- for (ifm = (struct mbuf *) slirp->if_fastq.qh_link;
+- (struct quehead *) ifm != &slirp->if_fastq;
+- ifm = ifm->ifq_next) {
+- if (ifm->ifq_so == so) {
+- ifm->ifq_so = NULL;
+- }
+- }
+-
+- for (ifm = (struct mbuf *) slirp->if_batchq.qh_link;
+- (struct quehead *) ifm != &slirp->if_batchq;
+- ifm = ifm->ifq_next) {
+- if (ifm->ifq_so == so) {
+- ifm->ifq_so = NULL;
+- }
+- }
++ soqfree(so, &slirp->if_fastq);
++ soqfree(so, &slirp->if_batchq);
+
+ if (so->so_emu==EMU_RSH && so->extra) {
+ sofree(so->extra);
+--
+2.13.5
+
diff --git a/app-emulation/qemu/qemu-2.10.0.ebuild b/app-emulation/qemu/qemu-2.10.0.ebuild
new file mode 100644
index 00000000000..e9342fbc380
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.10.0.ebuild
@@ -0,0 +1,781 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+FIRMWARE_ABI_VERSION="2.9.0-r52"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt
+ glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
+ pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy
+ spice ssh static static-user systemtap tci test usb usbredir vde
+ +vhost-net virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 s390x sh4 sh4eb sparc
+ sparc64 x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ armeb hppa mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ )
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:=[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-2017_pre20170505[binary]
+ ~sys-firmware/ipxe-1.0.0_p20160620
+ ~sys-firmware/seabios-1.10.2[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ "${FILESDIR}"/${PN}-2.10.0-CVE-2017-13711.patch # bug 629350
+)
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ default
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser bluetooth bluez)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser seccomp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh2)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ )
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+ conf_opts+=(
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ --with-system-pixman
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+ dodoc docs/qmp-*.txt
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ! version_is_at_least ${FIRMWARE_ABI_VERSION} ${pv}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2018-02-11 20:27 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2018-02-11 20:27 UTC (permalink / raw
To: gentoo-commits
commit: 725631c3eee62d147ea634c969ab90d1c70f5612
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 11 20:16:02 2018 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sun Feb 11 20:27:01 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=725631c3
app-emulation/qemu: version bump to 2.11.0, important security fixes
- Added slot operator for libnfs
- Added patch for glibc-2.27 compatibility
- Added patch for CVE-2017-16845
- Backported upstream msr / spec ctrl patches:
6cfbc54e89 i386: Add EPYC-IBPB CPU model
ac96c41354 i386: Add new -IBRS versions of Intel CPU models
1b3420e1c4 i386: Add FEAT_8000_0008_EBX CPUID feature word
a2381f0934 i386: Add spec-ctrl CPUID bit
a33a2cfe2f i386: Add support for SPEC_CTRL MSR
- CVEs addressed by bump:
CVE-2017-17381
CVE-2017-18030
CVE-2017-18043
- CVEs addressed by patchset:
CVE-2017-15124
CVE-2017-16845
CVE-2018-5683
- CVE-2018-5748 is a libvirt vulnerability, not a qemu issue...
Bug: https://bugs.gentoo.org/638506
Bug: https://bugs.gentoo.org/643432
Bug: https://bugs.gentoo.org/646814
Closes: https://bugs.gentoo.org/641100
Closes: https://bugs.gentoo.org/646568
Closes: https://bugs.gentoo.org/646710
Package-Manager: Portage-2.3.24, Repoman-2.3.6
app-emulation/qemu/Manifest | 2 +
.../qemu/files/qemu-2.11.0-glibc-2.27.patch | 54 ++
app-emulation/qemu/qemu-2.11.0.ebuild | 803 +++++++++++++++++++++
3 files changed, 859 insertions(+)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 2aded65fd90..9f60936fb82 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1 +1,3 @@
DIST qemu-2.10.1.tar.bz2 30821108 BLAKE2B bb096139f6b387a3cf3933dd3aeb97777479022b1b34ed0212b51d7061f9a19b3e83a4e9a13c6cf81c14718731ddf8646226a5b0d99ebbc9abb387d7eec94238 SHA512 1a4a6ebf700ec6851c83cc2a71eaea8d95f14c685d094eaaa86c740eb9401e49a79074b72385f58681ca7646771a99bb6bbd9bebb39162f7220626d37ed0654f
+DIST qemu-2.11.0-patches-r0.tar.xz 16140 BLAKE2B 2e23908075195a7c28df574525a159e171277a2da6d7c0656a341a2db6a622237106d2dd8de5c9d61b5fb62fa5a163e9657406a2996cebc05baa53d42c5f5d15 SHA512 f7d92c2232398565b8cde294d38dc281c13503fb5967cc7871a2233b7fa354799619445e9ec89c285ef051f62ecef0bd38a135b0093bf5528c0b28c6e580c839
+DIST qemu-2.11.0.tar.bz2 32816398 BLAKE2B 2014a8246f3cba9069186629d9ec8c221672fcfd3e8cd28a7e57f467add81f7bd84363183ef5cc5d18af91bde9186a4da49c0133c8ead83eae4626b9fc364e99 SHA512 3681700833573c0aa6283af950bfa298970056f1b44489088d8863840a7694512138321f86961ef43b256abf15eddd2612fb9cdbe3d9a358542d4e7037cc2004
diff --git a/app-emulation/qemu/files/qemu-2.11.0-glibc-2.27.patch b/app-emulation/qemu/files/qemu-2.11.0-glibc-2.27.patch
new file mode 100644
index 00000000000..1562bb3c64a
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.11.0-glibc-2.27.patch
@@ -0,0 +1,54 @@
+From 75e5b70e6b5dcc4f2219992d7cffa462aa406af0 Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Tue, 28 Nov 2017 11:51:27 +0100
+Subject: [PATCH] memfd: fix configure test
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Recent glibc added memfd_create in sys/mman.h. This conflicts with
+the definition in util/memfd.c:
+
+ /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration
+
+Fix the configure test, and remove the sys/memfd.h inclusion since the
+file actually does not exist---it is a typo in the memfd_create(2) man
+page.
+
+Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+---
+ configure | 2 +-
+ util/memfd.c | 4 +---
+ 2 files changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/configure b/configure
+index 9c8aa5a98b..99ccc1725a 100755
+--- a/configure
++++ b/configure
+@@ -3923,7 +3923,7 @@ fi
+ # check if memfd is supported
+ memfd=no
+ cat > $TMPC << EOF
+-#include <sys/memfd.h>
++#include <sys/mman.h>
+
+ int main(void)
+ {
+diff --git a/util/memfd.c b/util/memfd.c
+index 4571d1aba8..412e94a405 100644
+--- a/util/memfd.c
++++ b/util/memfd.c
+@@ -31,9 +31,7 @@
+
+ #include "qemu/memfd.h"
+
+-#ifdef CONFIG_MEMFD
+-#include <sys/memfd.h>
+-#elif defined CONFIG_LINUX
++#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
+ #include <sys/syscall.h>
+ #include <asm/unistd.h>
+
+--
+2.11.0
diff --git a/app-emulation/qemu/qemu-2.11.0.ebuild b/app-emulation/qemu/qemu-2.11.0.ebuild
new file mode 100644
index 00000000000..6a81020bf7e
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.11.0.ebuild
@@ -0,0 +1,803 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+FIRMWARE_ABI_VERSION="2.9.0-r52"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+
+ # Gentoo specific patchsets:
+ SRC_URI+=" https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r0.tar.xz"
+fi
+
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt
+ glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
+ pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy
+ spice ssh static static-user systemtap tci test usb usbredir vde
+ +vhost-net virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 s390x sh4 sh4eb sparc
+ sparc64 x86_64"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ armeb hppa mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the extranl library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.2[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ )
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:=[static-libs(+)] )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-2017_pre20170505[binary]
+ ~sys-firmware/ipxe-1.0.0_p20160620
+ ~sys-firmware/seabios-1.10.2[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.10.2[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ "${FILESDIR}"/${PN}-2.11.0-glibc-2.27.patch
+ "${WORKDIR}"/patches
+)
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ default
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser bluetooth bluez)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser seccomp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh2)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ )
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+ conf_opts+=(
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ! version_is_at_least ${FIRMWARE_ABI_VERSION} ${pv}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2018-02-12 22:48 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2018-02-12 22:48 UTC (permalink / raw
To: gentoo-commits
commit: f1930d8b843ff1fd0296c6757b540f0ab5e27044
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 12 22:47:34 2018 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Mon Feb 12 22:48:29 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1930d8b
app-emulation/qemu: drop vulnerable version
Bug: https://bugs.gentoo.org/646814
Package-Manager: Portage-2.3.24, Repoman-2.3.6
app-emulation/qemu/Manifest | 1 -
.../qemu/files/qemu-2.10.1-CVE-2017-15268.patch | 54 --
.../qemu/files/qemu-2.10.1-CVE-2017-15289.patch | 58 --
app-emulation/qemu/qemu-2.10.1-r1.ebuild | 800 ---------------------
4 files changed, 913 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 9f60936fb82..d653bcd5536 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,3 +1,2 @@
-DIST qemu-2.10.1.tar.bz2 30821108 BLAKE2B bb096139f6b387a3cf3933dd3aeb97777479022b1b34ed0212b51d7061f9a19b3e83a4e9a13c6cf81c14718731ddf8646226a5b0d99ebbc9abb387d7eec94238 SHA512 1a4a6ebf700ec6851c83cc2a71eaea8d95f14c685d094eaaa86c740eb9401e49a79074b72385f58681ca7646771a99bb6bbd9bebb39162f7220626d37ed0654f
DIST qemu-2.11.0-patches-r0.tar.xz 16140 BLAKE2B 2e23908075195a7c28df574525a159e171277a2da6d7c0656a341a2db6a622237106d2dd8de5c9d61b5fb62fa5a163e9657406a2996cebc05baa53d42c5f5d15 SHA512 f7d92c2232398565b8cde294d38dc281c13503fb5967cc7871a2233b7fa354799619445e9ec89c285ef051f62ecef0bd38a135b0093bf5528c0b28c6e580c839
DIST qemu-2.11.0.tar.bz2 32816398 BLAKE2B 2014a8246f3cba9069186629d9ec8c221672fcfd3e8cd28a7e57f467add81f7bd84363183ef5cc5d18af91bde9186a4da49c0133c8ead83eae4626b9fc364e99 SHA512 3681700833573c0aa6283af950bfa298970056f1b44489088d8863840a7694512138321f86961ef43b256abf15eddd2612fb9cdbe3d9a358542d4e7037cc2004
diff --git a/app-emulation/qemu/files/qemu-2.10.1-CVE-2017-15268.patch b/app-emulation/qemu/files/qemu-2.10.1-CVE-2017-15268.patch
deleted file mode 100644
index 7d08b32b027..00000000000
--- a/app-emulation/qemu/files/qemu-2.10.1-CVE-2017-15268.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From a7b20a8efa28e5f22c26c06cd06c2f12bc863493 Mon Sep 17 00:00:00 2001
-From: "Daniel P. Berrange" <berrange@redhat.com>
-Date: Mon, 9 Oct 2017 14:43:42 +0100
-Subject: [PATCH] io: monitor encoutput buffer size from websocket GSource
-
-The websocket GSource is monitoring the size of the rawoutput
-buffer to determine if the channel can accepts more writes.
-The rawoutput buffer, however, is merely a temporary staging
-buffer before data is copied into the encoutput buffer. Thus
-its size will always be zero when the GSource runs.
-
-This flaw causes the encoutput buffer to grow without bound
-if the other end of the underlying data channel doesn't
-read data being sent. This can be seen with VNC if a client
-is on a slow WAN link and the guest OS is sending many screen
-updates. A malicious VNC client can act like it is on a slow
-link by playing a video in the guest and then reading data
-very slowly, causing QEMU host memory to expand arbitrarily.
-
-This issue is assigned CVE-2017-15268, publically reported in
-
- https://bugs.launchpad.net/qemu/+bug/1718964
-
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
----
- io/channel-websock.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/io/channel-websock.c b/io/channel-websock.c
-index d1d471f86e..04bcc059cd 100644
---- a/io/channel-websock.c
-+++ b/io/channel-websock.c
-@@ -28,7 +28,7 @@
- #include <time.h>
-
-
--/* Max amount to allow in rawinput/rawoutput buffers */
-+/* Max amount to allow in rawinput/encoutput buffers */
- #define QIO_CHANNEL_WEBSOCK_MAX_BUFFER 8192
-
- #define QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN 24
-@@ -1208,7 +1208,7 @@ qio_channel_websock_source_check(GSource *source)
- if (wsource->wioc->rawinput.offset || wsource->wioc->io_eof) {
- cond |= G_IO_IN;
- }
-- if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
-+ if (wsource->wioc->encoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
- cond |= G_IO_OUT;
- }
-
---
-2.13.6
-
diff --git a/app-emulation/qemu/files/qemu-2.10.1-CVE-2017-15289.patch b/app-emulation/qemu/files/qemu-2.10.1-CVE-2017-15289.patch
deleted file mode 100644
index a4ad2d5e435..00000000000
--- a/app-emulation/qemu/files/qemu-2.10.1-CVE-2017-15289.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From eb38e1bc3740725ca29a535351de94107ec58d51 Mon Sep 17 00:00:00 2001
-From: Gerd Hoffmann <kraxel@redhat.com>
-Date: Wed, 11 Oct 2017 10:43:14 +0200
-Subject: [PATCH] cirrus: fix oob access in mode4and5 write functions
-
-Move dst calculation into the loop, so we apply the mask on each
-interation and will not overflow vga memory.
-
-Cc: Prasad J Pandit <pjp@fedoraproject.org>
-Reported-by: Niu Guoxiang <niuguoxiang@huawei.com>
-Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-Message-id: 20171011084314.21752-1-kraxel@redhat.com
----
- hw/display/cirrus_vga.c | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
-index b4d579857a..bc32bf1e39 100644
---- a/hw/display/cirrus_vga.c
-+++ b/hw/display/cirrus_vga.c
-@@ -2038,15 +2038,14 @@ static void cirrus_mem_writeb_mode4and5_8bpp(CirrusVGAState * s,
- unsigned val = mem_value;
- uint8_t *dst;
-
-- dst = s->vga.vram_ptr + (offset &= s->cirrus_addr_mask);
- for (x = 0; x < 8; x++) {
-+ dst = s->vga.vram_ptr + ((offset + x) & s->cirrus_addr_mask);
- if (val & 0x80) {
- *dst = s->cirrus_shadow_gr1;
- } else if (mode == 5) {
- *dst = s->cirrus_shadow_gr0;
- }
- val <<= 1;
-- dst++;
- }
- memory_region_set_dirty(&s->vga.vram, offset, 8);
- }
-@@ -2060,8 +2059,8 @@ static void cirrus_mem_writeb_mode4and5_16bpp(CirrusVGAState * s,
- unsigned val = mem_value;
- uint8_t *dst;
-
-- dst = s->vga.vram_ptr + (offset &= s->cirrus_addr_mask);
- for (x = 0; x < 8; x++) {
-+ dst = s->vga.vram_ptr + ((offset + 2 * x) & s->cirrus_addr_mask & ~1);
- if (val & 0x80) {
- *dst = s->cirrus_shadow_gr1;
- *(dst + 1) = s->vga.gr[0x11];
-@@ -2070,7 +2069,6 @@ static void cirrus_mem_writeb_mode4and5_16bpp(CirrusVGAState * s,
- *(dst + 1) = s->vga.gr[0x10];
- }
- val <<= 1;
-- dst += 2;
- }
- memory_region_set_dirty(&s->vga.vram, offset, 16);
- }
---
-2.13.6
-
diff --git a/app-emulation/qemu/qemu-2.10.1-r1.ebuild b/app-emulation/qemu/qemu-2.10.1-r1.ebuild
deleted file mode 100644
index dcf84b71ab6..00000000000
--- a/app-emulation/qemu/qemu-2.10.1-r1.ebuild
+++ /dev/null
@@ -1,800 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="6"
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
-
-FIRMWARE_ABI_VERSION="2.9.0-r52"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo-r1 pax-utils l10n
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
- KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt
- glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux
- kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
- pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy
- spice ssh static static-user systemtap tci test usb usbredir vde
- +vhost-net virgl virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel
- mips mips64 mips64el mipsel nios2 or1k ppc ppc64 s390x sh4 sh4eb sparc
- sparc64 x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
- lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS}
- armeb hppa mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.2[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- )
- infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? (
- sys-libs/ncurses:0=[unicode]
- sys-libs/ncurses:0=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gbm]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:=[static-libs(+)] )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-2017_pre20170505[binary]
- ~sys-firmware/ipxe-1.0.0_p20160620
- ~sys-firmware/seabios-1.10.2[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre8
- )
- !pin-upstream-blobs? (
- sys-firmware/edk2-ovmf
- sys-firmware/ipxe
- >=sys-firmware/seabios-1.10.2[seavgabios]
- sys-firmware/sgabios
- )"
-PPC64_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.10.2[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-1.10.2[seavgabios]
- )
-"
-
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.5.0-cflags.patch
- "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
- "${FILESDIR}"/${PN}-2.10.1-CVE-2017-15268.patch
- "${FILESDIR}"/${PN}-2.10.1-CVE-2017-15289.patch
-)
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-handle_locales() {
- # Make sure locale list is kept up-to-date.
- local detected sorted
- detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
- sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "PLOCALES: ${sorted}"
- eerror " po/*.po: ${detected}"
- die "sync PLOCALES"
- fi
-
- # Deal with selective install of locales.
- if use nls ; then
- # Delete locales the user does not want. #577814
- rm_loc() { rm po/$1.po || die; }
- l10n_for_each_disabled_locale_do rm_loc
- else
- # Cheap hack to disable gettext .mo generation.
- rm -f po/*.po
- fi
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- default
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Run after we've applied all patches.
- handle_locales
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_notuser bzip2)
- $(conf_notuser bluetooth bluez)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_notuser fdt)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_notuser seccomp)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh2)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser virgl virglrenderer)
- $(conf_notuser virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- )
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
- conf_opts+=(
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- --with-system-pixman
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ! version_is_at_least ${FIRMWARE_ABI_VERSION} ${pv}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2018-03-27 16:18 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2018-03-27 16:18 UTC (permalink / raw
To: gentoo-commits
commit: e72dd222963922024b61be4c5b02ed5166287f65
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 27 16:16:12 2018 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Tue Mar 27 16:18:28 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e72dd222
app-emulation/qemu: Revert: add rule to fix permissions on /dev/vfio/vfio
This reverts commit 2fc1bc6c7b1f41a3a7df74ce8e170996eb7e36d9.
app-emulation/qemu/files/65-vfio.rules | 2 --
app-emulation/qemu/{qemu-2.11.1-r2.ebuild => qemu-2.11.1-r1.ebuild} | 1 -
2 files changed, 3 deletions(-)
diff --git a/app-emulation/qemu/files/65-vfio.rules b/app-emulation/qemu/files/65-vfio.rules
deleted file mode 100644
index 099b655683d..00000000000
--- a/app-emulation/qemu/files/65-vfio.rules
+++ /dev/null
@@ -1,2 +0,0 @@
-SUBSYSTEM=="vfio", OWNER="root", GROUP="kvm"
-KERNEL=="vfio", OWNER="root", GROUP="kvm", MODE="0660"
diff --git a/app-emulation/qemu/qemu-2.11.1-r2.ebuild b/app-emulation/qemu/qemu-2.11.1-r1.ebuild
similarity index 99%
rename from app-emulation/qemu/qemu-2.11.1-r2.ebuild
rename to app-emulation/qemu/qemu-2.11.1-r1.ebuild
index 1eea347cd1d..d0d85a2ac09 100644
--- a/app-emulation/qemu/qemu-2.11.1-r2.ebuild
+++ b/app-emulation/qemu/qemu-2.11.1-r1.ebuild
@@ -679,7 +679,6 @@ src_install() {
if use kernel_linux; then
udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
- udev_newrules "${FILESDIR}"/65-vfio.rules 65-vfio.rules
fi
if use python; then
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2018-06-15 17:47 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2018-06-15 17:47 UTC (permalink / raw
To: gentoo-commits
commit: b42da7ebd3516c4f32c1724e59d01c85b6b0ef35
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 15 17:46:02 2018 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Fri Jun 15 17:47:02 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b42da7eb
app-emulation/qemu: rearrange patches
Package-Manager: Portage-2.3.40, Repoman-2.3.9
app-emulation/qemu/Manifest | 2 +-
.../qemu-2.12.0-tcg-instruction-overflow.patch | 183 ---------------------
app-emulation/qemu/qemu-2.12.0-r3.ebuild | 3 +-
3 files changed, 2 insertions(+), 186 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 735a99a99de..c93f84bcbf9 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,4 +1,4 @@
DIST qemu-2.11.1-patches-r1.tar.xz 2064 BLAKE2B 533c916b01c014bcfa6c733b76aa6da1f12cdf5f0d4ae33136453705a8aca9fdfeef998747cfdc72d19e08fa40ea97e2fd4c21412c030af314605059282f49ef SHA512 12de7b4777ec98871d0786291534f61b37534feef64b556caeab72e020ff14d61fe19d24cb151ebfdb912df2a7ba72c0d882566b368d88d02c9f1354c2adae4a
DIST qemu-2.11.1.tar.bz2 32819412 BLAKE2B 6b6d4e7b8dcf33aeedb0b33bad267da07ad17c2eeeb5fbd2c038d760bc03224e55ba0f03eb248c62bc0e8636c2c660ea76b367eaea96bee16388053f82c8b8a9 SHA512 1b692bbdfc3dc785738c7192aa2a3f9cf53d9f5bf3b3f49fa8692050dc50f7056c8a4d1b527d48ffb2a674a0fd3a46d87addd1eaaa758f35eec1ab5adfe32354
-DIST qemu-2.12.0-patches-r3.tar.xz 2936 BLAKE2B dd4d7e5d3f48df43d21a990129ff4a9bfb25a2e208166b0b8fc2d1d7d2e6c1b944178f2a6b724fba21c6f12e332ff135a0ab152d525a5141bf8b7a216a984074 SHA512 a2dd1c716c189ac8f98472f6a36d1494606ae6f09f0fd20818cf714ba058f526370f727a170592c3b029ce013de481b70e0ba6947bf2afb712340834d45aaff8
+DIST qemu-2.12.0-patches-r4.tar.xz 5376 BLAKE2B 7abc107b7971798c039cb99546dced0807a1904064e8397d93ba35b7b2ea22bdccf0c4f5ff8233ea7932534bd7320b506eff1ff7bb969d67d2752a7d8f81fbea SHA512 71c03ef3d6f9021d775201330ed08ace0bc34c7c3c4632a30486d54872fa457f8256e055034bbe2efcd98d718a7d714f00710961b3819568678444db6b457d92
DIST qemu-2.12.0.tar.bz2 41196232 BLAKE2B f258e570558249ea647c3571908f90b8bacdcef9a1814009b98571cf0e96406194d44aa041fd0a97c9b673f39a9eaae8d873824745509778a6784cd85f8398b0 SHA512 91d829f44c431e4c1cd335f3efea5afff9da62d832b0296a92417463ea0826d09ce226c2ea8ac167fe7b99b6bb976c7cb1357aaf17735ee57af6602161e46346
diff --git a/app-emulation/qemu/files/qemu-2.12.0-tcg-instruction-overflow.patch b/app-emulation/qemu/files/qemu-2.12.0-tcg-instruction-overflow.patch
deleted file mode 100644
index 24df138a777..00000000000
--- a/app-emulation/qemu/files/qemu-2.12.0-tcg-instruction-overflow.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-diff -ru qemu-2.12.0/tcg/aarch64/tcg-target.inc.c qemu-2.12.0-modified/tcg/aarch64/tcg-target.inc.c
---- qemu-2.12.0/tcg/aarch64/tcg-target.inc.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/aarch64/tcg-target.inc.c 2018-06-15 15:47:20.557969818 +0200
-@@ -1733,7 +1733,7 @@
- tcg_out_insn(s, 3305, LDR, offset, TCG_REG_TMP);
- }
- tcg_out_insn(s, 3207, BR, TCG_REG_TMP);
-- s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s);
-+ set_jmp_reset_offset(s, a0);
- break;
-
- case INDEX_op_goto_ptr:
-diff -ru qemu-2.12.0/tcg/arm/tcg-target.inc.c qemu-2.12.0-modified/tcg/arm/tcg-target.inc.c
---- qemu-2.12.0/tcg/arm/tcg-target.inc.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/arm/tcg-target.inc.c 2018-06-15 15:47:20.557969818 +0200
-@@ -1822,7 +1822,7 @@
- tcg_out_movi32(s, COND_AL, base, ptr - dil);
- }
- tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, base, dil);
-- s->tb_jmp_reset_offset[args[0]] = tcg_current_code_size(s);
-+ set_jmp_reset_offset(s, args[0]);
- }
- break;
- case INDEX_op_goto_ptr:
-diff -ru qemu-2.12.0/tcg/i386/tcg-target.inc.c qemu-2.12.0-modified/tcg/i386/tcg-target.inc.c
---- qemu-2.12.0/tcg/i386/tcg-target.inc.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/i386/tcg-target.inc.c 2018-06-15 15:47:20.558969815 +0200
-@@ -2245,7 +2245,7 @@
- tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, -1,
- (intptr_t)(s->tb_jmp_target_addr + a0));
- }
-- s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s);
-+ set_jmp_reset_offset(s, a0);
- break;
- case INDEX_op_goto_ptr:
- /* jmp to the given host address (could be epilogue) */
-diff -ru qemu-2.12.0/tcg/mips/tcg-target.inc.c qemu-2.12.0-modified/tcg/mips/tcg-target.inc.c
---- qemu-2.12.0/tcg/mips/tcg-target.inc.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/mips/tcg-target.inc.c 2018-06-15 15:47:20.558969815 +0200
-@@ -1744,7 +1744,7 @@
- tcg_out_opc_reg(s, OPC_JR, 0, TCG_TMP0, 0);
- }
- tcg_out_nop(s);
-- s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s);
-+ set_jmp_reset_offset(s, a0);
- break;
- case INDEX_op_goto_ptr:
- /* jmp to the given host address (could be epilogue) */
-diff -ru qemu-2.12.0/tcg/ppc/tcg-target.inc.c qemu-2.12.0-modified/tcg/ppc/tcg-target.inc.c
---- qemu-2.12.0/tcg/ppc/tcg-target.inc.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/ppc/tcg-target.inc.c 2018-06-15 15:47:20.558969815 +0200
-@@ -2025,10 +2025,10 @@
- }
- tcg_out32(s, MTSPR | RS(TCG_REG_TB) | CTR);
- tcg_out32(s, BCCTR | BO_ALWAYS);
-- s->tb_jmp_reset_offset[args[0]] = c = tcg_current_code_size(s);
-+ set_jmp_reset_offset(s, args[0]);
- if (USE_REG_TB) {
- /* For the unlinked case, need to reset TCG_REG_TB. */
-- c = -c;
-+ c = -tcg_current_code_size(s);
- assert(c == (int16_t)c);
- tcg_out32(s, ADDI | TAI(TCG_REG_TB, TCG_REG_TB, c));
- }
-diff -ru qemu-2.12.0/tcg/s390/tcg-target.inc.c qemu-2.12.0-modified/tcg/s390/tcg-target.inc.c
---- qemu-2.12.0/tcg/s390/tcg-target.inc.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/s390/tcg-target.inc.c 2018-06-15 15:47:20.558969815 +0200
-@@ -1783,7 +1783,7 @@
- /* and go there */
- tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, TCG_REG_TB);
- }
-- s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s);
-+ set_jmp_reset_offset(s, a0);
-
- /* For the unlinked path of goto_tb, we need to reset
- TCG_REG_TB to the beginning of this TB. */
-diff -ru qemu-2.12.0/tcg/sparc/tcg-target.inc.c qemu-2.12.0-modified/tcg/sparc/tcg-target.inc.c
---- qemu-2.12.0/tcg/sparc/tcg-target.inc.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/sparc/tcg-target.inc.c 2018-06-15 15:47:20.559969811 +0200
-@@ -1388,12 +1388,12 @@
- tcg_out_arithi(s, TCG_REG_G0, TCG_REG_TB, 0, JMPL);
- tcg_out_nop(s);
- }
-- s->tb_jmp_reset_offset[a0] = c = tcg_current_code_size(s);
-+ set_jmp_reset_offset(s, a0);
-
- /* For the unlinked path of goto_tb, we need to reset
- TCG_REG_TB to the beginning of this TB. */
- if (USE_REG_TB) {
-- c = -c;
-+ c = -tcg_current_code_size(s);
- if (check_fit_i32(c, 13)) {
- tcg_out_arithi(s, TCG_REG_TB, TCG_REG_TB, c, ARITH_ADD);
- } else {
-diff -ru qemu-2.12.0/tcg/tcg.c qemu-2.12.0-modified/tcg/tcg.c
---- qemu-2.12.0/tcg/tcg.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/tcg.c 2018-06-15 16:02:55.042712421 +0200
-@@ -293,6 +293,14 @@
- return l;
- }
-
-+static void set_jmp_reset_offset(TCGContext *s, int which)
-+{
-+ size_t off = tcg_current_code_size(s);
-+ s->tb_jmp_reset_offset[which] = off;
-+ /* Make sure that we didn't overflow the stored offset. */
-+ assert(s->tb_jmp_reset_offset[which] == off);
-+}
-+
- #include "tcg-target.inc.c"
-
- static void tcg_region_bounds(size_t curr_region, void **pstart, void **pend)
-@@ -866,6 +874,7 @@
- /* No temps have been previously allocated for size or locality. */
- memset(s->free_temps, 0, sizeof(s->free_temps));
-
-+ s->nb_ops = 0;
- s->nb_labels = 0;
- s->current_frame_offset = s->frame_start;
-
-@@ -1983,6 +1992,7 @@
- {
- QTAILQ_REMOVE(&s->ops, op, link);
- QTAILQ_INSERT_TAIL(&s->free_ops, op, link);
-+ s->nb_ops--;
-
- #ifdef CONFIG_PROFILER
- atomic_set(&s->prof.del_op_count, s->prof.del_op_count + 1);
-@@ -2002,6 +2012,7 @@
- }
- memset(op, 0, offsetof(TCGOp, link));
- op->opc = opc;
-+ s->nb_ops++;
-
- return op;
- }
-@@ -3351,7 +3362,10 @@
- break;
- case INDEX_op_insn_start:
- if (num_insns >= 0) {
-- s->gen_insn_end_off[num_insns] = tcg_current_code_size(s);
-+ size_t off = tcg_current_code_size(s);
-+ s->gen_insn_end_off[num_insns] = off;
-+ /* Assert that we do not overflow our stored offset. */
-+ assert(s->gen_insn_end_off[num_insns] == off);
- }
- num_insns++;
- for (i = 0; i < TARGET_INSN_START_WORDS; ++i) {
-Only in qemu-2.12.0-modified/tcg: tcg.c.orig
-diff -ru qemu-2.12.0/tcg/tcg.h qemu-2.12.0-modified/tcg/tcg.h
---- qemu-2.12.0/tcg/tcg.h 2018-06-15 16:03:35.881570182 +0200
-+++ qemu-2.12.0-modified/tcg/tcg.h 2018-06-15 16:04:06.514463493 +0200
-@@ -655,6 +655,7 @@
- int nb_globals;
- int nb_temps;
- int nb_indirects;
-+ int nb_ops;
-
- /* goto_tb support */
- tcg_insn_unit *code_buf;
-@@ -844,7 +845,7 @@
- /* Test for whether to terminate the TB for using too many opcodes. */
- static inline bool tcg_op_buf_full(void)
- {
-- return false;
-+ return tcg_ctx->nb_ops >= 4000;
- }
-
- /* pool based memory allocation */
-Only in qemu-2.12.0-modified/tcg: tcg.h.orig
-Only in qemu-2.12.0-modified/tcg: tcg.h.rej
-diff -ru qemu-2.12.0/tcg/tci/tcg-target.inc.c qemu-2.12.0-modified/tcg/tci/tcg-target.inc.c
---- qemu-2.12.0/tcg/tci/tcg-target.inc.c 2018-04-24 18:30:47.000000000 +0200
-+++ qemu-2.12.0-modified/tcg/tci/tcg-target.inc.c 2018-06-15 15:47:20.559969811 +0200
-@@ -574,7 +574,7 @@
- /* Indirect jump method. */
- TODO();
- }
-- s->tb_jmp_reset_offset[args[0]] = tcg_current_code_size(s);
-+ set_jmp_reset_offset(s, args[0]);
- break;
- case INDEX_op_br:
- tci_out_label(s, arg_label(args[0]));
diff --git a/app-emulation/qemu/qemu-2.12.0-r3.ebuild b/app-emulation/qemu/qemu-2.12.0-r3.ebuild
index 8a89d0ca6da..9e4303a6042 100644
--- a/app-emulation/qemu/qemu-2.12.0-r3.ebuild
+++ b/app-emulation/qemu/qemu-2.12.0-r3.ebuild
@@ -22,7 +22,7 @@ else
KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
# Gentoo specific patchsets:
- SRC_URI+=" https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r3.tar.xz"
+ SRC_URI+=" https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r4.tar.xz"
fi
DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
@@ -216,7 +216,6 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.5.0-cflags.patch
"${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${P}-tcg-instruction-overflow.patch # Will be fixed in 2.12.1
"${WORKDIR}"/patches
)
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2018-07-23 15:06 Jason Donenfeld
0 siblings, 0 replies; 66+ messages in thread
From: Jason Donenfeld @ 2018-07-23 15:06 UTC (permalink / raw
To: gentoo-commits
commit: fd6a9690eddc378b1c85996206f33396a6aefff2
Author: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 23 12:34:41 2018 +0000
Commit: Jason Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Mon Jul 23 15:06:00 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd6a9690
app-emulation/qemu: fix aarch64 tcg simd crash
QEMU mailing list thread is here:
https://marc.info/?l=qemu-devel&m=153229252602494&w=2
The patch is here:
https://marc.info/?l=qemu-devel&m=153230940005574&w=2
Package-Manager: Portage-2.3.43, Repoman-2.3.10
.../qemu/files/qemu-2.12.0-aarch64-simd-fix.patch | 36 +
app-emulation/qemu/qemu-2.12.0-r4.ebuild | 819 +++++++++++++++++++++
2 files changed, 855 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-2.12.0-aarch64-simd-fix.patch b/app-emulation/qemu/files/qemu-2.12.0-aarch64-simd-fix.patch
new file mode 100644
index 00000000000..c8b8a02354c
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.12.0-aarch64-simd-fix.patch
@@ -0,0 +1,36 @@
+From: Richard Henderson <richard.henderson@linaro.org>
+To: qemu-devel@nongnu.org
+Cc: Jason@zx2c4.com,
+ qemu-stable@nongnu.org
+Subject: [PATCH for-3.0] tcg/i386: Mark xmm registers call-clobbered
+Date: Sun, 22 Jul 2018 18:29:41 -0700
+Message-Id: <20180723012941.16920-1-richard.henderson@linaro.org>
+X-Mailer: git-send-email 2.17.1
+
+When host vector registers and operations were introduced, I failed
+to mark the registers call clobbered as required by the ABI.
+
+Fixes: 770c2fc7bb7
+Cc: qemu-stable@nongnu.org
+Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
+---
+ tcg/i386/tcg-target.inc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
+index e87b0d445e..a91e4f1313 100644
+--- a/tcg/i386/tcg-target.inc.c
++++ b/tcg/i386/tcg-target.inc.c
+@@ -3532,7 +3532,7 @@ static void tcg_target_init(TCGContext *s)
+ tcg_target_available_regs[TCG_TYPE_V256] = ALL_VECTOR_REGS;
+ }
+
+- tcg_target_call_clobber_regs = 0;
++ tcg_target_call_clobber_regs = ALL_VECTOR_REGS;
+ tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_EAX);
+ tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_EDX);
+ tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_ECX);
+--
+2.17.1
+
diff --git a/app-emulation/qemu/qemu-2.12.0-r4.ebuild b/app-emulation/qemu/qemu-2.12.0-r4.ebuild
new file mode 100644
index 00000000000..6ece9e3bd0a
--- /dev/null
+++ b/app-emulation/qemu/qemu-2.12.0-r4.ebuild
@@ -0,0 +1,819 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+FIRMWARE_ABI_VERSION="2.11.1-r50"
+
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+
+ # Gentoo specific patchsets:
+ SRC_URI+=" https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r5.tar.xz"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bluetooth bzip2 capstone +caps +curl debug
+ +fdt glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
+ pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy
+ spice ssh static static-user systemtap tci test usb usbredir vde
+ +vhost-net virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ lm32 moxie ppcemb tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ gtk2? ( gtk )
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ sdl2? ( sdl )
+ static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio !snappy )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ x11-libs/libxkbcommon[static-libs(+)]
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bluetooth? ( net-wireless/bluez )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.4.2[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ gtk2? (
+ x11-libs/gtk+:2
+ vte? ( x11-libs/vte:0 )
+ )
+ !gtk2? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ !sdl2? (
+ media-libs/libsdl[X]
+ >=media-libs/libsdl-1.2.11[static-libs(+)]
+ )
+ sdl2? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-2017_p20180211[binary]
+ ~sys-firmware/ipxe-1.0.0_p20180211[binary]
+ ~sys-firmware/seabios-1.11.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.11.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ =dev-lang/python-2*
+ sys-apps/texinfo
+ virtual/pkgconfig
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-2.12.0-aarch64-simd-fix.patch
+ "${WORKDIR}"/patches
+)
+
+STRIP_MASK="/usr/share/qemu/palcode-clipper"
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ # Alter target makefiles to accept CFLAGS set via flag-o
+ sed -i -r \
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
+ Makefile Makefile.target || die
+
+ default
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser bluetooth bluez)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser seccomp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh2)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+ conf_opts+=(
+ --audio-drv-list="${audio_opts}"
+ )
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/scripts/qmp/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ! version_is_at_least ${FIRMWARE_ABI_VERSION} ${pv}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2018-08-19 17:49 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2018-08-19 17:49 UTC (permalink / raw
To: gentoo-commits
commit: 55679e9cfb47c803931db687f2e3f510d66d91d1
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 19 17:37:22 2018 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sun Aug 19 17:37:22 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55679e9c
app-emulation/qemu: drop version 2.11.*
Bug: https://bugs.gentoo.org/663502
Package-Manager: Portage-2.3.47, Repoman-2.3.10
app-emulation/qemu/Manifest | 2 -
.../qemu/files/qemu-2.11.0-glibc-2.27.patch | 54 --
app-emulation/qemu/qemu-2.11.1-r2.ebuild | 805 ---------------------
3 files changed, 861 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 8534038d8e8..0146a02dfc3 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,5 +1,3 @@
-DIST qemu-2.11.1-patches-r1.tar.xz 2064 BLAKE2B 533c916b01c014bcfa6c733b76aa6da1f12cdf5f0d4ae33136453705a8aca9fdfeef998747cfdc72d19e08fa40ea97e2fd4c21412c030af314605059282f49ef SHA512 12de7b4777ec98871d0786291534f61b37534feef64b556caeab72e020ff14d61fe19d24cb151ebfdb912df2a7ba72c0d882566b368d88d02c9f1354c2adae4a
-DIST qemu-2.11.1.tar.bz2 32819412 BLAKE2B 6b6d4e7b8dcf33aeedb0b33bad267da07ad17c2eeeb5fbd2c038d760bc03224e55ba0f03eb248c62bc0e8636c2c660ea76b367eaea96bee16388053f82c8b8a9 SHA512 1b692bbdfc3dc785738c7192aa2a3f9cf53d9f5bf3b3f49fa8692050dc50f7056c8a4d1b527d48ffb2a674a0fd3a46d87addd1eaaa758f35eec1ab5adfe32354
DIST qemu-2.12.0-patches-r5.tar.xz 5536 BLAKE2B 751a0fd7a6dd2433542dbfc8a1c9726fb612270b5a526e2e67729478b0f9b45689e23a70e077fb6b3b9cee115ff48d5334b16aba39efb79eff16baae3e1d349e SHA512 5c735632a3ca7ae7fbd9619b01683917749c02e7cdba85564fb157ef8d382ec999c1e1577eb00d4248a26c0f0ab9cb5af6355ca7fc68bcba054ffcca1947eebc
DIST qemu-2.12.0.tar.bz2 41196232 BLAKE2B f258e570558249ea647c3571908f90b8bacdcef9a1814009b98571cf0e96406194d44aa041fd0a97c9b673f39a9eaae8d873824745509778a6784cd85f8398b0 SHA512 91d829f44c431e4c1cd335f3efea5afff9da62d832b0296a92417463ea0826d09ce226c2ea8ac167fe7b99b6bb976c7cb1357aaf17735ee57af6602161e46346
DIST qemu-2.12.1-patches-r1.tar.xz 3648 BLAKE2B 07908004d0b56e60274cb59d4163770290d8fa6e31646e7d96db08427a219638ac53bdd988c9557471b95321a72982d740a29778d843652274a126737a0a6c00 SHA512 1c7768c14a8e168053f0322554214ba59932a9fa23c982b06dbb1b8fdcfc280ae1d97b20244600f357485bfbcb9ad8bd7968787550c8a4e5e243ac8502eff05e
diff --git a/app-emulation/qemu/files/qemu-2.11.0-glibc-2.27.patch b/app-emulation/qemu/files/qemu-2.11.0-glibc-2.27.patch
deleted file mode 100644
index 1562bb3c64a..00000000000
--- a/app-emulation/qemu/files/qemu-2.11.0-glibc-2.27.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 75e5b70e6b5dcc4f2219992d7cffa462aa406af0 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Tue, 28 Nov 2017 11:51:27 +0100
-Subject: [PATCH] memfd: fix configure test
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Recent glibc added memfd_create in sys/mman.h. This conflicts with
-the definition in util/memfd.c:
-
- /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration
-
-Fix the configure test, and remove the sys/memfd.h inclusion since the
-file actually does not exist---it is a typo in the memfd_create(2) man
-page.
-
-Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- configure | 2 +-
- util/memfd.c | 4 +---
- 2 files changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/configure b/configure
-index 9c8aa5a98b..99ccc1725a 100755
---- a/configure
-+++ b/configure
-@@ -3923,7 +3923,7 @@ fi
- # check if memfd is supported
- memfd=no
- cat > $TMPC << EOF
--#include <sys/memfd.h>
-+#include <sys/mman.h>
-
- int main(void)
- {
-diff --git a/util/memfd.c b/util/memfd.c
-index 4571d1aba8..412e94a405 100644
---- a/util/memfd.c
-+++ b/util/memfd.c
-@@ -31,9 +31,7 @@
-
- #include "qemu/memfd.h"
-
--#ifdef CONFIG_MEMFD
--#include <sys/memfd.h>
--#elif defined CONFIG_LINUX
-+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
- #include <sys/syscall.h>
- #include <asm/unistd.h>
-
---
-2.11.0
diff --git a/app-emulation/qemu/qemu-2.11.1-r2.ebuild b/app-emulation/qemu/qemu-2.11.1-r2.ebuild
deleted file mode 100644
index 0c0f70a126a..00000000000
--- a/app-emulation/qemu/qemu-2.11.1-r2.ebuild
+++ /dev/null
@@ -1,805 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="6"
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="ncurses,readline"
-
-PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
-
-FIRMWARE_ABI_VERSION="2.9.0-r52"
-
-inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
- user udev fcaps readme.gentoo-r1 pax-utils l10n versionator
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="git://git.qemu.org/qemu.git"
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
- KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
-
- # Gentoo specific patchsets:
- SRC_URI+=" https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r1.tar.xz"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt
- glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux
- kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
- pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy
- spice ssh static static-user systemtap tci test usb usbredir vde
- +vhost-net virgl virtfs +vnc vte xattr xen xfs"
-
-COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel
- mips mips64 mips64el mipsel nios2 or1k ppc ppc64 s390x sh4 sh4eb sparc
- sparc64 x86_64"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
- lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb"
-IUSE_USER_TARGETS="${COMMON_TARGETS}
- armeb hppa mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- gtk2? ( gtk )
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- sdl2? ( sdl )
- static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio !snappy )
- virtfs? ( xattr )
- vte? ( gtk )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the extranl library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.4.2[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- gtk2? (
- x11-libs/gtk+:2
- vte? ( x11-libs/vte:0 )
- )
- !gtk2? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- )
- infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? (
- sys-libs/ncurses:0=[unicode]
- sys-libs/ncurses:0=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gbm]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph[static-libs(+)] )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- !sdl2? (
- media-libs/libsdl[X]
- >=media-libs/libsdl-1.2.11[static-libs(+)]
- )
- sdl2? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:= )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-2017_pre20170505[binary]
- ~sys-firmware/ipxe-1.0.0_p20160620
- ~sys-firmware/seabios-1.10.2[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre8
- )
- !pin-upstream-blobs? (
- sys-firmware/edk2-ovmf
- sys-firmware/ipxe
- >=sys-firmware/seabios-1.10.2[seavgabios]
- sys-firmware/sgabios
- )"
-PPC64_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.10.2[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-1.10.2[seavgabios]
- )
-"
-
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- dev-lang/perl
- =dev-lang/python-2*
- sys-apps/texinfo
- virtual/pkgconfig
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- gtk? ( nls? ( sys-devel/gettext ) )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )"
-RDEPEND="${CDEPEND}
- selinux? ( sec-policy/selinux-qemu )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.5.0-cflags.patch
- "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
- "${FILESDIR}"/${PN}-2.11.0-glibc-2.27.patch
- "${WORKDIR}"/patches
-)
-
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
-QA_PREBUILT="
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-pkg_setup() {
- enewgroup kvm 78
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-handle_locales() {
- # Make sure locale list is kept up-to-date.
- local detected sorted
- detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
- sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "PLOCALES: ${sorted}"
- eerror " po/*.po: ${detected}"
- die "sync PLOCALES"
- fi
-
- # Deal with selective install of locales.
- if use nls ; then
- # Delete locales the user does not want. #577814
- rm_loc() { rm po/$1.po || die; }
- l10n_for_each_disabled_locale_do rm_loc
- else
- # Cheap hack to disable gettext .mo generation.
- rm -f po/*.po
- fi
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- # Alter target makefiles to accept CFLAGS set via flag-o
- sed -i -r \
- -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
- Makefile Makefile.target || die
-
- default
-
- # Fix ld and objcopy being called directly
- tc-export AR LD OBJCOPY
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Run after we've applied all patches.
- handle_locales
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --libdir=/usr/$(get_libdir)
- --docdir=/usr/share/doc/${PF}/html
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- --enable-docs
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_notuser bzip2)
- $(conf_notuser bluetooth bluez)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_notuser fdt)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_notuser seccomp)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh2)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser virgl virglrenderer)
- $(conf_notuser virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- )
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts="oss"
- use alsa && audio_opts="alsa,${audio_opts}"
- use sdl && audio_opts="sdl,${audio_opts}"
- use pulseaudio && audio_opts="pa,${audio_opts}"
- conf_opts+=(
- --audio-drv-list="${audio_opts}"
- )
- use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
- use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- #bug #647570
- conf_opts+=( --disable-capstone )
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/scripts/qmp/qmp.py"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dohtml check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ! version_is_at_least ${FIRMWARE_ABI_VERSION} ${pv}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2018-12-19 21:47 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2018-12-19 21:47 UTC (permalink / raw
To: gentoo-commits
commit: 40e4d2a3c32609b313962224ee9d2a96075734b8
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 19 21:11:21 2018 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Wed Dec 19 21:46:41 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40e4d2a3
app-emulation/qemu: version bump to 3.1.0
- use RESTRICT=strip, bug #651422
- switch to tar.xz, bug #666726
- add missing use constraints, bug #664474
qemu_softmmu_targets_riscv32? ( fdt )
qemu_softmmu_targets_riscv64? ( fdt )
- 3.1.0 already contains patches for CVE-2018-15746
- applied patch for CVE-2018-20123
- disable bt subsystem entirely as a "workaround" for CVE-2018-19665.
Upstream deprecated the subsystem in November and states that it had
been dysfunctional for years with likely no users.
Bug: https://bugs.gentoo.org/664740
Bug: https://bugs.gentoo.org/672346
Bug: https://bugs.gentoo.org/673108
Closes: https://bugs.gentoo.org/651422
Closes: https://bugs.gentoo.org/664474
Closes: https://bugs.gentoo.org/666726
Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
app-emulation/qemu/Manifest | 1 +
.../qemu/files/qemu-3.1.0-CVE-2018-20123.patch | 35 ++++++++++++++++++++++
app-emulation/qemu/files/qemu-binfmt.initd.head | 2 +-
app-emulation/qemu/qemu-2.12.0-r3.ebuild | 2 +-
app-emulation/qemu/qemu-2.12.1.ebuild | 2 +-
.../{qemu-2.12.0-r3.ebuild => qemu-3.1.0.ebuild} | 28 +++++++++--------
6 files changed, 54 insertions(+), 16 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 0146a02dfc3..fa80aeeb8bf 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -3,3 +3,4 @@ DIST qemu-2.12.0.tar.bz2 41196232 BLAKE2B f258e570558249ea647c3571908f90b8bacdce
DIST qemu-2.12.1-patches-r1.tar.xz 3648 BLAKE2B 07908004d0b56e60274cb59d4163770290d8fa6e31646e7d96db08427a219638ac53bdd988c9557471b95321a72982d740a29778d843652274a126737a0a6c00 SHA512 1c7768c14a8e168053f0322554214ba59932a9fa23c982b06dbb1b8fdcfc280ae1d97b20244600f357485bfbcb9ad8bd7968787550c8a4e5e243ac8502eff05e
DIST qemu-2.12.1.tar.bz2 41192583 BLAKE2B ff903a5850e406ab542ad1a84300852599fa9c199e0f3290e4d6ddad5284192577351278a18dd5706463b08e817b49340989a35987a04672f7cede2097d1d18d SHA512 4c85e6180bf7ec61c0bdddb20e104a7c93fe6b1de27f6aa50d75633eb78491cb844798a9e3f536245eff7b4ebe9a6227f5f66b418ced44095b8e59c5cb33d4cd
DIST qemu-3.0.0.tar.bz2 41491935 BLAKE2B 715ccca4fced730425eb5c24a78d89d2ab59f64007e0fc199d78c31c6ab72b5a0dbcf1840f214774c711d679c4166996790e93b2416c7d4f323d5b93ffa862ac SHA512 b82b78a063d60fa1372d9400934b47250138c438050d974113b1b2ea433eea0531be6cda1e82d14fcb3bc4ed35657703f62d9aedc095cb8d64badc65c3609ee5
+DIST qemu-3.1.0.tar.xz 36070104 BLAKE2B 9ed7d1b3256d84f2b73d61763e20f5e4bc5b47d56e4e0d56cf4c29cd25669457b0f08e90d7255589c9666400bb310df3dba3b9290232cad18057b20f08013a3b SHA512 7e8dae823937cfac2f0c60406bd3bdcb89df40313dab2a4bed327d5198f7fcc68ac8b31e44692caa09299cc71256ee0b8c17e4f49f78ada8043d424f5daf82fe
diff --git a/app-emulation/qemu/files/qemu-3.1.0-CVE-2018-20123.patch b/app-emulation/qemu/files/qemu-3.1.0-CVE-2018-20123.patch
new file mode 100644
index 00000000000..a021a6a970d
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-3.1.0-CVE-2018-20123.patch
@@ -0,0 +1,35 @@
+From: Prasad J Pandit <address@hidden>
+
+If during pvrdma device initialisation an error occurs,
+pvrdma_realize() does not release memory resources, leading
+to memory leakage.
+
+Reported-by: Li Qiang <address@hidden>
+Signed-off-by: Prasad J Pandit <address@hidden>
+---
+ hw/rdma/vmw/pvrdma_main.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
+index 8a03ab4669..b65f8662df 100644
+--- a/hw/rdma/vmw/pvrdma_main.c
++++ b/hw/rdma/vmw/pvrdma_main.c
+@@ -579,7 +579,7 @@ static void pvrdma_shutdown_notifier(Notifier *n, void *opaque)
+
+ static void pvrdma_realize(PCIDevice *pdev, Error **errp)
+ {
+- int rc;
++ int rc = 0;
+ PVRDMADev *dev = PVRDMA_DEV(pdev);
+ Object *memdev_root;
+ bool ram_shared = false;
+@@ -655,6 +655,7 @@ static void pvrdma_realize(PCIDevice *pdev, Error **errp)
+
+ out:
+ if (rc) {
++ pvrdma_fini(pdev);
+ error_append_hint(errp, "Device fail to load\n");
+ }
+ }
+--
+2.19.2
diff --git a/app-emulation/qemu/files/qemu-binfmt.initd.head b/app-emulation/qemu/files/qemu-binfmt.initd.head
index 858d5d74538..832ddb0b8e5 100644
--- a/app-emulation/qemu/files/qemu-binfmt.initd.head
+++ b/app-emulation/qemu/files/qemu-binfmt.initd.head
@@ -1,5 +1,5 @@
#!/sbin/openrc-run
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Enable automatic non-native program execution by the kernel.
diff --git a/app-emulation/qemu/qemu-2.12.0-r3.ebuild b/app-emulation/qemu/qemu-2.12.0-r3.ebuild
index e3243c485e2..3fb0b9f307f 100644
--- a/app-emulation/qemu/qemu-2.12.0-r3.ebuild
+++ b/app-emulation/qemu/qemu-2.12.0-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="6"
diff --git a/app-emulation/qemu/qemu-2.12.1.ebuild b/app-emulation/qemu/qemu-2.12.1.ebuild
index df4ccb5617b..55529b0483c 100644
--- a/app-emulation/qemu/qemu-2.12.1.ebuild
+++ b/app-emulation/qemu/qemu-2.12.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="6"
diff --git a/app-emulation/qemu/qemu-2.12.0-r3.ebuild b/app-emulation/qemu/qemu-3.1.0.ebuild
similarity index 97%
copy from app-emulation/qemu/qemu-2.12.0-r3.ebuild
copy to app-emulation/qemu/qemu-3.1.0.ebuild
index e3243c485e2..d95a0da86e9 100644
--- a/app-emulation/qemu/qemu-2.12.0-r3.ebuild
+++ b/app-emulation/qemu/qemu-3.1.0.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="6"
-PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6,3_7} )
PYTHON_REQ_USE="ncurses,readline"
PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
@@ -18,11 +18,11 @@ if [[ ${PV} = *9999* ]]; then
inherit git-r3
SRC_URI=""
else
- SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
- KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
# Gentoo specific patchsets:
- SRC_URI+=" https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r5.tar.xz"
+ #SRC_URI+=" https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r1.tar.xz"
fi
DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
@@ -30,13 +30,15 @@ HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
LICENSE="GPL-2 LGPL-2 BSD-2"
SLOT="0"
-IUSE="accessibility +aio alsa bluetooth bzip2 capstone +caps +curl debug
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug
+fdt glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux
kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy
spice ssh static static-user systemtap tci test usb usbredir vde
+vhost-net virgl virtfs +vnc vte xattr xen xfs"
+RESTRICT=strip
+
COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
@@ -57,10 +59,12 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}
qemu_softmmu_targets_arm? ( fdt )
qemu_softmmu_targets_microblaze? ( fdt )
qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
sdl2? ( sdl )
- static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio !snappy )
+ static? ( static-user !alsa !gtk !gtk2 !opengl !pulseaudio !snappy )
virtfs? ( xattr )
vte? ( gtk )"
@@ -91,7 +95,6 @@ SOFTMMU_TOOLS_DEPEND="
)
aio? ( dev-libs/libaio[static-libs(+)] )
alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bluetooth? ( net-wireless/bluez )
bzip2? ( app-arch/bzip2[static-libs(+)] )
capstone? ( dev-libs/capstone )
caps? ( sys-libs/libcap-ng[static-libs(+)] )
@@ -217,11 +220,10 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.5.0-cflags.patch
"${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${WORKDIR}"/patches
+ "${FILESDIR}"/${PN}-3.1.0-CVE-2018-20123.patch
+ #"${WORKDIR}"/patches
)
-STRIP_MASK="/usr/share/qemu/palcode-clipper"
-
QA_PREBUILT="
usr/share/qemu/hppa-firmware.img
usr/share/qemu/openbios-ppc
@@ -441,10 +443,10 @@ qemu_src_configure() {
fi
}
conf_opts+=(
+ --disable-bluez
$(conf_notuser accessibility brlapi)
$(conf_notuser aio linux-aio)
$(conf_notuser bzip2)
- $(conf_notuser bluetooth bluez)
$(conf_notuser capstone)
$(conf_notuser caps cap-ng)
$(conf_notuser curl)
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2019-04-29 6:48 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2019-04-29 6:48 UTC (permalink / raw
To: gentoo-commits
commit: c83a1b469d6e8c77187bf69ad6b74509b3586de3
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 29 03:31:19 2019 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Mon Apr 29 06:48:45 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c83a1b46
app-emulation/qemu: version bump to 4.0.0
- Version bump to 4.0.0 (bug #684274)
- Apply mips fpu mode fix (bug #683640)
- Bug #683458: Reenable stripping. Remove old CFLAGS workaround. Let's
see how far this takes us.
Bug: https://bugs.gentoo.org/683458
Closes: https://bugs.gentoo.org/683640
Closes: https://bugs.gentoo.org/684274
Closes: https://github.com/gentoo/gentoo/pull/11719
Package-Manager: Portage-2.3.64, Repoman-2.3.12
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
app-emulation/qemu/Manifest | 1 +
.../files/qemu-4.0.0-sanitize-interp_info.patch | 32 +
app-emulation/qemu/qemu-4.0.0.ebuild | 799 +++++++++++++++++++++
3 files changed, 832 insertions(+)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 7ba695af5d6..856d34fbff4 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,2 +1,3 @@
DIST qemu-3.1.0-patches-r1.tar.xz 2292 BLAKE2B 0861dcf2eebd7f1f6dd495035fc39a14e44eb8e437127b22105ea2374e5068613c4c3f41227e97e0093062f9448ded2d956dc6c40ae6c64c7258c3dcf87c59c3 SHA512 6eca3f4ec6e62c7a24af15405147d266f8fb77462eb8797da8d7f9e40805160d9431478428baece5b5744fc1edecff988b44c512ae1fbf8f2cc3632ea14962cc
DIST qemu-3.1.0.tar.xz 36070104 BLAKE2B 9ed7d1b3256d84f2b73d61763e20f5e4bc5b47d56e4e0d56cf4c29cd25669457b0f08e90d7255589c9666400bb310df3dba3b9290232cad18057b20f08013a3b SHA512 7e8dae823937cfac2f0c60406bd3bdcb89df40313dab2a4bed327d5198f7fcc68ac8b31e44692caa09299cc71256ee0b8c17e4f49f78ada8043d424f5daf82fe
+DIST qemu-4.0.0.tar.xz 55628624 BLAKE2B 8afd1f54aa13d2e61fd36c4f4544b7c4ffb1a7eee5c69d3aa1d40a432ca296ad8abe6cb83d7c66ac4045ca624d2a00e737f51e4e62ed46fef9766ef71f43b98b SHA512 952e94194ce9e64c15388c59035cb31fb9f761d30095c2fb9441012b609c18c9976285727b93bf37b95e15675802d73f8e1c4619ebecd23606675bb503646b13
diff --git a/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch b/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch
new file mode 100644
index 00000000000..58ff0c78828
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch
@@ -0,0 +1,32 @@
+linux-user: Sanitize interp_info and, for mips
+
+Sanitize interp_info structure in load_elf_binary() and, for mips only,
+init its field fp_abi. This fixes appearances of "Unexpected FPU mode"
+message in some MIPS use cases.
+
+Signed-off-by: Daniel Santos <address@hidden>
+Signed-off-by: Aleksandar Markovic <address@hidden>
+---
+ linux-user/elfload.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/linux-user/elfload.c b/linux-user/elfload.c
+index c1a2602..7f09d57 100644
+--- a/linux-user/elfload.c
++++ b/linux-user/elfload.c
+@@ -2698,6 +2698,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
+ char *elf_interpreter = NULL;
+ char *scratch;
+
++ memset(&interp_info, 0, sizeof(interp_info));
++#ifdef TARGET_MIPS
++ interp_info.fp_abi = MIPS_ABI_FP_UNKNOWN;
++#endif
++
+ info->start_mmap = (abi_ulong)ELF_START_MMAP;
+
+ load_elf_image(bprm->filename, bprm->fd, info,
+--
+2.7.4
+
+
diff --git a/app-emulation/qemu/qemu-4.0.0.ebuild b/app-emulation/qemu/qemu-4.0.0.ebuild
new file mode 100644
index 00000000000..9d2e78ef09c
--- /dev/null
+++ b/app-emulation/qemu/qemu-4.0.0.ebuild
@@ -0,0 +1,799 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+FIRMWARE_ABI_VERSION="2.11.1-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug
+ +fdt glusterfs gnutls gtk infiniband iscsi +jpeg kernel_linux
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
+ pulseaudio python rbd sasl +seccomp sdl selinux smartcard snappy
+ spice ssh static static-user systemtap tci test usb usbredir vde
+ +vhost-net virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ lm32 moxie tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ static? ( static-user !alsa !gtk !opengl !pulseaudio !snappy )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ x11-libs/libxkbcommon[static-libs(+)]
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-2017_p20180211[binary]
+ ~sys-firmware/ipxe-1.0.0_p20180211[binary]
+ ~sys-firmware/seabios-1.11.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.11.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+BDEPEND="
+ ${PYTHON_DEPS}
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ ${PYTHON_DEPS}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${P}-sanitize-interp_info.patch
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ --enable-docs
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ --disable-bluez
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser seccomp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh2)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+ conf_opts+=(
+ --audio-drv-list="${audio_opts}"
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2019-05-19 23:42 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2019-05-19 23:42 UTC (permalink / raw
To: gentoo-commits
commit: 490c1bdd567d908b15ce7a825b4cab6e50a0bba5
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sun May 19 21:57:57 2019 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sun May 19 23:42:11 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=490c1bdd
app-emulation/qemu: ensure directory is created
Closes: https://bugs.gentoo.org/684902
Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
app-emulation/qemu/files/qemu-4.0.0-mkdir_systemtap.patch | 12 ++++++++++++
app-emulation/qemu/qemu-4.0.0-r3.ebuild | 1 +
app-emulation/qemu/qemu-9999.ebuild | 1 +
3 files changed, 14 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-4.0.0-mkdir_systemtap.patch b/app-emulation/qemu/files/qemu-4.0.0-mkdir_systemtap.patch
new file mode 100644
index 00000000000..abfcbd1b9af
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-4.0.0-mkdir_systemtap.patch
@@ -0,0 +1,12 @@
+diff --git a/Makefile b/Makefile
+index 04a0d450..e0013a59 100644
+--- a/Makefile
++++ b/Makefile
+@@ -760,6 +760,7 @@ ifneq ($(TOOLS),)
+ $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
+ endif
+ ifdef CONFIG_TRACE_SYSTEMTAP
++ mkdir -p $(DESTDIR)$(bindir)
+ $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
+ endif
+ ifneq (,$(findstring qemu-ga,$(TOOLS)))
diff --git a/app-emulation/qemu/qemu-4.0.0-r3.ebuild b/app-emulation/qemu/qemu-4.0.0-r3.ebuild
index f513f387747..86e2f9cee00 100644
--- a/app-emulation/qemu/qemu-4.0.0-r3.ebuild
+++ b/app-emulation/qemu/qemu-4.0.0-r3.ebuild
@@ -206,6 +206,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${P}-sanitize-interp_info.patch
"${FILESDIR}"/${PN}-3.1.0-md-clear-md-no.patch
+ "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
)
QA_PREBUILT="
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index c67b7be0387..0eccee5d2fa 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -205,6 +205,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.5.0-cflags.patch
"${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2019-07-28 18:21 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2019-07-28 18:21 UTC (permalink / raw
To: gentoo-commits
commit: f76e446190008f27fbad7ad055ea57c4e124a232
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 28 18:11:01 2019 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sun Jul 28 18:21:26 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f76e4461
app-emulation/qemu: maintenacne patches, revbump
* patch for linux-headers-5.2
* apply upstream patch for pc-q35 regression with windows guests
Closes: https://bugs.gentoo.org/690418
Closes: https://bugs.gentoo.org/690280
Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
| 334 +++++++++
.../qemu/files/qemu-4.0.0-pc-q35-4.0.patch | 135 ++++
app-emulation/qemu/qemu-4.0.0-r4.ebuild | 813 +++++++++++++++++++++
3 files changed, 1282 insertions(+)
--git a/app-emulation/qemu/files/qemu-4.0.0-linux-headers-5.2.patch b/app-emulation/qemu/files/qemu-4.0.0-linux-headers-5.2.patch
new file mode 100644
index 00000000000..43be8629dfa
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-4.0.0-linux-headers-5.2.patch
@@ -0,0 +1,334 @@
+From 6d5d5dde9adb5acb32e6b8e3dfbf47fff0f308d2 Mon Sep 17 00:00:00 2001
+From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
+Date: Thu, 18 Jul 2019 15:06:41 +0200
+Subject: [PATCH] linux-user: fix to handle variably sized SIOCGSTAMP with new
+ kernels
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+The SIOCGSTAMP symbol was previously defined in the
+asm-generic/sockios.h header file. QEMU sees that header
+indirectly via sys/socket.h
+
+In linux kernel commit 0768e17073dc527ccd18ed5f96ce85f9985e9115
+the asm-generic/sockios.h header no longer defines SIOCGSTAMP.
+Instead it provides only SIOCGSTAMP_OLD, which only uses a
+32-bit time_t on 32-bit architectures.
+
+The linux/sockios.h header then defines SIOCGSTAMP using
+either SIOCGSTAMP_OLD or SIOCGSTAMP_NEW as appropriate. If
+SIOCGSTAMP_NEW is used, then the tv_sec field is 64-bit even
+on 32-bit architectures
+
+To cope with this we must now convert the old and new type from
+the target to the host one.
+
+Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
+Signed-off-by: Laurent Vivier <laurent@vivier.eu>
+Reviewed-by: Arnd Bergmann <arnd@arndb.de>
+Message-Id: <20190718130641.15294-1-laurent@vivier.eu>
+Signed-off-by: Laurent Vivier <laurent@vivier.eu>
+---
+ linux-user/ioctls.h | 21 ++++++-
+ linux-user/syscall.c | 140 ++++++++++++++++++++++++++++++++++++---------
+ linux-user/syscall_defs.h | 30 +++++++++-
+ linux-user/syscall_types.h | 6 --
+ 4 files changed, 159 insertions(+), 38 deletions(-)
+
+diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
+index ae895162..e6a27ad9 100644
+--- a/linux-user/ioctls.h
++++ b/linux-user/ioctls.h
+@@ -219,8 +219,25 @@
+ IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
+ IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
+ IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */
+- IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
+- IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
++
++ /*
++ * We can't use IOCTL_SPECIAL() because it will set
++ * host_cmd to XXX_OLD and XXX_NEW and these macros
++ * are not defined with kernel prior to 5.2.
++ * We must set host_cmd to the same value as in target_cmd
++ * otherwise the consistency check in syscall_init()
++ * will trigger an error.
++ * host_cmd is ignored by the do_ioctl_XXX() helpers.
++ * FIXME: create a macro to define this kind of entry
++ */
++ { TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD,
++ "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP },
++ { TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD,
++ "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS },
++ { TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW,
++ "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP },
++ { TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW,
++ "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS },
+
+ IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
+ IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 96cd4bf8..6df480e1 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -37,6 +37,7 @@
+ #include <sched.h>
+ #include <sys/timex.h>
+ #include <sys/socket.h>
++#include <linux/sockios.h>
+ #include <sys/un.h>
+ #include <sys/uio.h>
+ #include <poll.h>
+@@ -1139,8 +1140,9 @@ static inline abi_long copy_from_user_timeval(struct timeval *tv,
+ {
+ struct target_timeval *target_tv;
+
+- if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1))
++ if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1)) {
+ return -TARGET_EFAULT;
++ }
+
+ __get_user(tv->tv_sec, &target_tv->tv_sec);
+ __get_user(tv->tv_usec, &target_tv->tv_usec);
+@@ -1155,8 +1157,26 @@ static inline abi_long copy_to_user_timeval(abi_ulong target_tv_addr,
+ {
+ struct target_timeval *target_tv;
+
+- if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0))
++ if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) {
++ return -TARGET_EFAULT;
++ }
++
++ __put_user(tv->tv_sec, &target_tv->tv_sec);
++ __put_user(tv->tv_usec, &target_tv->tv_usec);
++
++ unlock_user_struct(target_tv, target_tv_addr, 1);
++
++ return 0;
++}
++
++static inline abi_long copy_to_user_timeval64(abi_ulong target_tv_addr,
++ const struct timeval *tv)
++{
++ struct target__kernel_sock_timeval *target_tv;
++
++ if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) {
+ return -TARGET_EFAULT;
++ }
+
+ __put_user(tv->tv_sec, &target_tv->tv_sec);
+ __put_user(tv->tv_usec, &target_tv->tv_usec);
+@@ -1166,6 +1186,48 @@ static inline abi_long copy_to_user_timeval(abi_ulong target_tv_addr,
+ return 0;
+ }
+
++static inline abi_long target_to_host_timespec(struct timespec *host_ts,
++ abi_ulong target_addr)
++{
++ struct target_timespec *target_ts;
++
++ if (!lock_user_struct(VERIFY_READ, target_ts, target_addr, 1)) {
++ return -TARGET_EFAULT;
++ }
++ __get_user(host_ts->tv_sec, &target_ts->tv_sec);
++ __get_user(host_ts->tv_nsec, &target_ts->tv_nsec);
++ unlock_user_struct(target_ts, target_addr, 0);
++ return 0;
++}
++
++static inline abi_long host_to_target_timespec(abi_ulong target_addr,
++ struct timespec *host_ts)
++{
++ struct target_timespec *target_ts;
++
++ if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) {
++ return -TARGET_EFAULT;
++ }
++ __put_user(host_ts->tv_sec, &target_ts->tv_sec);
++ __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
++ unlock_user_struct(target_ts, target_addr, 1);
++ return 0;
++}
++
++static inline abi_long host_to_target_timespec64(abi_ulong target_addr,
++ struct timespec *host_ts)
++{
++ struct target__kernel_timespec *target_ts;
++
++ if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) {
++ return -TARGET_EFAULT;
++ }
++ __put_user(host_ts->tv_sec, &target_ts->tv_sec);
++ __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
++ unlock_user_struct(target_ts, target_addr, 1);
++ return 0;
++}
++
+ static inline abi_long copy_from_user_timezone(struct timezone *tz,
+ abi_ulong target_tz_addr)
+ {
+@@ -4790,6 +4852,54 @@ static abi_long do_ioctl_kdsigaccept(const IOCTLEntry *ie, uint8_t *buf_temp,
+ return get_errno(safe_ioctl(fd, ie->host_cmd, sig));
+ }
+
++static abi_long do_ioctl_SIOCGSTAMP(const IOCTLEntry *ie, uint8_t *buf_temp,
++ int fd, int cmd, abi_long arg)
++{
++ struct timeval tv;
++ abi_long ret;
++
++ ret = get_errno(safe_ioctl(fd, SIOCGSTAMP, &tv));
++ if (is_error(ret)) {
++ return ret;
++ }
++
++ if (cmd == (int)TARGET_SIOCGSTAMP_OLD) {
++ if (copy_to_user_timeval(arg, &tv)) {
++ return -TARGET_EFAULT;
++ }
++ } else {
++ if (copy_to_user_timeval64(arg, &tv)) {
++ return -TARGET_EFAULT;
++ }
++ }
++
++ return ret;
++}
++
++static abi_long do_ioctl_SIOCGSTAMPNS(const IOCTLEntry *ie, uint8_t *buf_temp,
++ int fd, int cmd, abi_long arg)
++{
++ struct timespec ts;
++ abi_long ret;
++
++ ret = get_errno(safe_ioctl(fd, SIOCGSTAMPNS, &ts));
++ if (is_error(ret)) {
++ return ret;
++ }
++
++ if (cmd == (int)TARGET_SIOCGSTAMPNS_OLD) {
++ if (host_to_target_timespec(arg, &ts)) {
++ return -TARGET_EFAULT;
++ }
++ } else{
++ if (host_to_target_timespec64(arg, &ts)) {
++ return -TARGET_EFAULT;
++ }
++ }
++
++ return ret;
++}
++
+ #ifdef TIOCGPTPEER
+ static abi_long do_ioctl_tiocgptpeer(const IOCTLEntry *ie, uint8_t *buf_temp,
+ int fd, int cmd, abi_long arg)
+@@ -6160,32 +6270,6 @@ static inline abi_long target_ftruncate64(void *cpu_env, abi_long arg1,
+ }
+ #endif
+
+-static inline abi_long target_to_host_timespec(struct timespec *host_ts,
+- abi_ulong target_addr)
+-{
+- struct target_timespec *target_ts;
+-
+- if (!lock_user_struct(VERIFY_READ, target_ts, target_addr, 1))
+- return -TARGET_EFAULT;
+- __get_user(host_ts->tv_sec, &target_ts->tv_sec);
+- __get_user(host_ts->tv_nsec, &target_ts->tv_nsec);
+- unlock_user_struct(target_ts, target_addr, 0);
+- return 0;
+-}
+-
+-static inline abi_long host_to_target_timespec(abi_ulong target_addr,
+- struct timespec *host_ts)
+-{
+- struct target_timespec *target_ts;
+-
+- if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0))
+- return -TARGET_EFAULT;
+- __put_user(host_ts->tv_sec, &target_ts->tv_sec);
+- __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
+- unlock_user_struct(target_ts, target_addr, 1);
+- return 0;
+-}
+-
+ static inline abi_long target_to_host_itimerspec(struct itimerspec *host_itspec,
+ abi_ulong target_addr)
+ {
+diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
+index 12c84071..cfb3eeec 100644
+--- a/linux-user/syscall_defs.h
++++ b/linux-user/syscall_defs.h
+@@ -208,16 +208,34 @@ struct target_linger {
+ abi_int l_linger; /* How long to linger for */
+ };
+
++#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
++struct target_timeval {
++ abi_long tv_sec;
++ abi_int tv_usec;
++};
++#define target__kernel_sock_timeval target_timeval
++#else
+ struct target_timeval {
+ abi_long tv_sec;
+ abi_long tv_usec;
+ };
+
++struct target__kernel_sock_timeval {
++ abi_llong tv_sec;
++ abi_llong tv_usec;
++};
++#endif
++
+ struct target_timespec {
+ abi_long tv_sec;
+ abi_long tv_nsec;
+ };
+
++struct target__kernel_timespec {
++ abi_llong tv_sec;
++ abi_llong tv_nsec;
++};
++
+ struct target_timezone {
+ abi_int tz_minuteswest;
+ abi_int tz_dsttime;
+@@ -743,8 +761,17 @@ struct target_pollfd {
+ #define TARGET_SIOCATMARK 0x8905
+ #define TARGET_SIOCGPGRP 0x8904
+ #endif
+-#define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
+-#define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
++
++#if defined(TARGET_SH4)
++#define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval)
++#define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec)
++#else
++#define TARGET_SIOCGSTAMP_OLD 0x8906
++#define TARGET_SIOCGSTAMPNS_OLD 0x8907
++#endif
++
++#define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2])
++#define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2])
+
+ /* Networking ioctls */
+ #define TARGET_SIOCADDRT 0x890B /* add routing table entry */
+diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
+index b98a23b0..4e369838 100644
+--- a/linux-user/syscall_types.h
++++ b/linux-user/syscall_types.h
+@@ -14,12 +14,6 @@ STRUCT(serial_icounter_struct,
+ STRUCT(sockaddr,
+ TYPE_SHORT, MK_ARRAY(TYPE_CHAR, 14))
+
+-STRUCT(timeval,
+- MK_ARRAY(TYPE_LONG, 2))
+-
+-STRUCT(timespec,
+- MK_ARRAY(TYPE_LONG, 2))
+-
+ STRUCT(rtentry,
+ TYPE_ULONG, MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr),
+ TYPE_SHORT, TYPE_SHORT, TYPE_ULONG, TYPE_PTRVOID, TYPE_SHORT, TYPE_PTRVOID,
diff --git a/app-emulation/qemu/files/qemu-4.0.0-pc-q35-4.0.patch b/app-emulation/qemu/files/qemu-4.0.0-pc-q35-4.0.patch
new file mode 100644
index 00000000000..ebabc0c4c29
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-4.0.0-pc-q35-4.0.patch
@@ -0,0 +1,135 @@
+Backport of QEMU v4.1 commit for stable v4.0.1 release
+
+commit c87759ce876a7a0b17c2bf4f0b964bd51f0ee871
+Author: Alex Williamson <address@hidden>
+Date: Tue May 14 14:14:41 2019 -0600
+
+ q35: Revert to kernel irqchip
+
+ Commit b2fc91db8447 ("q35: set split kernel irqchip as default") changed
+ the default for the pc-q35-4.0 machine type to use split irqchip, which
+ turned out to have disasterous effects on vfio-pci INTx support. KVM
+ resampling irqfds are registered for handling these interrupts, but
+ these are non-functional in split irqchip mode. We can't simply test
+ for split irqchip in QEMU as userspace handling of this interrupt is a
+ significant performance regression versus KVM handling (GeForce GPUs
+ assigned to Windows VMs are non-functional without forcing MSI mode or
+ re-enabling kernel irqchip).
+
+ The resolution is to revert the change in default irqchip mode in the
+ pc-q35-4.1 machine and create a pc-q35-4.0.1 machine for the 4.0-stable
+ branch. The qemu-q35-4.0 machine type should not be used in vfio-pci
+ configurations for devices requiring legacy INTx support without
+ explicitly modifying the VM configuration to use kernel irqchip.
+
+Link: https://bugs.launchpad.net/qemu/+bug/1826422
+Fixes: b2fc91db8447 ("q35: set split kernel irqchip as default")
+Cc: address@hidden
+Reviewed-by: Peter Xu <address@hidden>
+Signed-off-by: Alex Williamson <address@hidden>
+---
+
+Same code as v1, just updating the commit log as a formal backport of
+the merged 4.1 commit.
+
+ hw/core/machine.c | 3 +++
+ hw/i386/pc.c | 3 +++
+ hw/i386/pc_q35.c | 16 ++++++++++++++--
+ include/hw/boards.h | 3 +++
+ include/hw/i386/pc.h | 3 +++
+ 5 files changed, 26 insertions(+), 2 deletions(-)
+
+diff --git a/hw/core/machine.c b/hw/core/machine.c
+index 743fef28982c..5d046a43e3d2 100644
+--- a/hw/core/machine.c
++++ b/hw/core/machine.c
+@@ -24,6 +24,9 @@
+ #include "hw/pci/pci.h"
+ #include "hw/mem/nvdimm.h"
+
++GlobalProperty hw_compat_4_0[] = {};
++const size_t hw_compat_4_0_len = G_N_ELEMENTS(hw_compat_4_0);
++
+ GlobalProperty hw_compat_3_1[] = {
+ { "pcie-root-port", "x-speed", "2_5" },
+ { "pcie-root-port", "x-width", "1" },
+diff --git a/hw/i386/pc.c b/hw/i386/pc.c
+index f2c15bf1f2c3..d98b737b8f3b 100644
+--- a/hw/i386/pc.c
++++ b/hw/i386/pc.c
+@@ -115,6 +115,9 @@ struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
+ /* Physical Address of PVH entry point read from kernel ELF NOTE */
+ static size_t pvh_start_addr;
+
++GlobalProperty pc_compat_4_0[] = {};
++const size_t pc_compat_4_0_len = G_N_ELEMENTS(pc_compat_4_0);
++
+ GlobalProperty pc_compat_3_1[] = {
+ { "intel-iommu", "dma-drain", "off" },
+ { "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "off" },
+diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
+index 372c6b73bebd..45cc29d1adb7 100644
+--- a/hw/i386/pc_q35.c
++++ b/hw/i386/pc_q35.c
+@@ -357,7 +357,7 @@ static void pc_q35_machine_options(MachineClass *m)
+ m->units_per_default_bus = 1;
+ m->default_machine_opts = "firmware=bios-256k.bin";
+ m->default_display = "std";
+- m->default_kernel_irqchip_split = true;
++ m->default_kernel_irqchip_split = false;
+ m->no_floppy = 1;
+ machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
+ machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
+@@ -365,12 +365,24 @@ static void pc_q35_machine_options(MachineClass *m)
+ m->max_cpus = 288;
+ }
+
+-static void pc_q35_4_0_machine_options(MachineClass *m)
++static void pc_q35_4_0_1_machine_options(MachineClass *m)
+ {
+ pc_q35_machine_options(m);
+ m->alias = "q35";
+ }
+
++DEFINE_Q35_MACHINE(v4_0_1, "pc-q35-4.0.1", NULL,
++ pc_q35_4_0_1_machine_options);
++
++static void pc_q35_4_0_machine_options(MachineClass *m)
++{
++ pc_q35_4_0_1_machine_options(m);
++ m->default_kernel_irqchip_split = true;
++ m->alias = NULL;
++ compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
++ compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
++}
++
+ DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL,
+ pc_q35_4_0_machine_options);
+
+diff --git a/include/hw/boards.h b/include/hw/boards.h
+index e231860666a1..fe1885cbffa0 100644
+--- a/include/hw/boards.h
++++ b/include/hw/boards.h
+@@ -293,6 +293,9 @@ struct MachineState {
+ } \
+ type_init(machine_initfn##_register_types)
+
++extern GlobalProperty hw_compat_4_0[];
++extern const size_t hw_compat_4_0_len;
++
+ extern GlobalProperty hw_compat_3_1[];
+ extern const size_t hw_compat_3_1_len;
+
+diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
+index ca65ef18afb4..43df7230a22b 100644
+--- a/include/hw/i386/pc.h
++++ b/include/hw/i386/pc.h
+@@ -293,6 +293,9 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
+ int e820_get_num_entries(void);
+ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
+
++extern GlobalProperty pc_compat_4_0[];
++extern const size_t pc_compat_4_0_len;
++
+ extern GlobalProperty pc_compat_3_1[];
+ extern const size_t pc_compat_3_1_len;
diff --git a/app-emulation/qemu/qemu-4.0.0-r4.ebuild b/app-emulation/qemu/qemu-4.0.0-r4.ebuild
new file mode 100644
index 00000000000..9fdb6efecd7
--- /dev/null
+++ b/app-emulation/qemu/qemu-4.0.0-r4.ebuild
@@ -0,0 +1,813 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+FIRMWARE_ABI_VERSION="2.11.1-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+ user udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+ +fdt glusterfs gnutls gtk infiniband iscsi +jpeg kernel_linux
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
+ pulseaudio python rbd sasl +seccomp sdl selinux smartcard snappy
+ spice ssh static static-user systemtap tci test usb usbredir vde
+ +vhost-net virgl virtfs +vnc vte xattr xen xfs"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ lm32 moxie tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ static? ( static-user !alsa !gtk !opengl !pulseaudio !snappy )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ x11-libs/libxkbcommon[static-libs(+)]
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-2017_p20180211[binary]
+ ~sys-firmware/ipxe-1.0.0_p20180211[binary]
+ ~sys-firmware/seabios-1.11.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.11.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${P}-sanitize-interp_info.patch
+ "${FILESDIR}"/${PN}-3.1.0-md-clear-md-no.patch
+ "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
+ "${FILESDIR}"/${PN}-4.0.0-fix_infiniband_include.patch #686412
+ "${FILESDIR}"/${PN}-4.0.0-linux-headers-5.2.patch
+ "${FILESDIR}"/${PN}-4.0.0-pc-q35-4.0.patch
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+pkg_setup() {
+ enewgroup kvm 78
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Fix ld and objcopy being called directly
+ tc-export AR LD OBJCOPY
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --libdir=/usr/$(get_libdir)
+ --docdir=/usr/share/doc/${PF}/html
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable doc docs)
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ --disable-bluez
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser seccomp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh2)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts="oss"
+ use alsa && audio_opts="alsa,${audio_opts}"
+ use sdl && audio_opts="sdl,${audio_opts}"
+ use pulseaudio && audio_opts="pa,${audio_opts}"
+ conf_opts+=(
+ --audio-drv-list="${audio_opts}"
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2019-09-22 2:12 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2019-09-22 2:12 UTC (permalink / raw
To: gentoo-commits
commit: 03f5a8e92ce454db348ec749fed1303795e14e17
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 21 23:12:58 2019 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sun Sep 22 02:12:26 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03f5a8e9
app-emulation/qemu: Version bump to 4.1.0
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
app-emulation/qemu/Manifest | 1 +
.../qemu/files/qemu-4.0.0-xkbcommon.patch | 38 +
app-emulation/qemu/qemu-4.1.0.ebuild | 822 +++++++++++++++++++++
3 files changed, 861 insertions(+)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 5cc79c76494..80902bd6127 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1 +1,2 @@
DIST qemu-4.0.0.tar.xz 55628624 BLAKE2B 8afd1f54aa13d2e61fd36c4f4544b7c4ffb1a7eee5c69d3aa1d40a432ca296ad8abe6cb83d7c66ac4045ca624d2a00e737f51e4e62ed46fef9766ef71f43b98b SHA512 952e94194ce9e64c15388c59035cb31fb9f761d30095c2fb9441012b609c18c9976285727b93bf37b95e15675802d73f8e1c4619ebecd23606675bb503646b13
+DIST qemu-4.1.0.tar.xz 54001708 BLAKE2B fc89d0c967fb31a73cbdca556e79c05c44b241382a83f02150a8e39b00cb7de7fb6f248e82e1364e314680481bfb3843e74804534c0ba91a5bb2ff1b8d771130 SHA512 82fd51702a7b9b1b00b2f1bd3b4a832b80249018dbba1add0b0a73e7d4bee452afd45574b4d8df7ce4477d8711f3bda4ca072a1a6de25895c93eb21cf78fc4b2
diff --git a/app-emulation/qemu/files/qemu-4.0.0-xkbcommon.patch b/app-emulation/qemu/files/qemu-4.0.0-xkbcommon.patch
new file mode 100644
index 00000000000..3d9a5163ecf
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-4.0.0-xkbcommon.patch
@@ -0,0 +1,38 @@
+From cef396dc0b11a09ede85b275ed1ceee71b60a4b3 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 14 Sep 2019 15:47:20 +0100
+Subject: [PATCH] configure: Add xkbcommon configure options
+
+This dependency is currently "automagic", which is bad for distributions.
+
+Signed-off-by: James Le Cuirot <chewi@gentoo.org>
+---
+ configure | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/configure b/configure
+index 30aad233d1..30544f52e6 100755
+--- a/configure
++++ b/configure
+@@ -1521,6 +1521,10 @@ for opt do
+ ;;
+ --disable-libpmem) libpmem=no
+ ;;
++ --enable-xkbcommon) xkbcommon=yes
++ ;;
++ --disable-xkbcommon) xkbcommon=no
++ ;;
+ *)
+ echo "ERROR: unknown option $opt"
+ echo "Try '$0 --help' for more information"
+@@ -1804,6 +1808,7 @@ disabled with --disable-FEATURE, default is enabled if available:
+ capstone capstone disassembler support
+ debug-mutex mutex debugging support
+ libpmem libpmem support
++ xkbcommon xkbcommon support
+
+ NOTE: The object files are built at the place where configure is launched
+ EOF
+--
+2.23.0
+
diff --git a/app-emulation/qemu/qemu-4.1.0.ebuild b/app-emulation/qemu/qemu-4.1.0.ebuild
new file mode 100644
index 00000000000..b79cb23ab0f
--- /dev/null
+++ b/app-emulation/qemu/qemu-4.1.0.ebuild
@@ -0,0 +1,822 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+FIRMWARE_ABI_VERSION="4.0.0-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+ udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git"
+ EGIT_SUBMODULES=(
+ slirp
+ tests/fp/berkeley-{test,soft}float-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+ +fdt glusterfs gnutls gtk infiniband iscsi +jpeg kernel_linux
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+ +png pulseaudio python rbd sasl +seccomp sdl selinux smartcard snappy
+ spice ssh static static-user systemtap tci test usb usbredir vde
+ +vhost-net virgl virtfs +vnc vte xattr xen xfs +xkb"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ lm32 moxie tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ static? ( static-user !alsa !gtk !opengl !pulseaudio !snappy )
+ virtfs? ( xattr )
+ vte? ( gtk )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ xkb? ( x11-libs/libxkbcommon[static-libs(+)] )
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph[static-libs(+)] )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-201905[binary]
+ ~sys-firmware/ipxe-1.0.0_p20190728[binary]
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-4.0.0-sanitize-interp_info.patch
+ "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
+ "${FILESDIR}"/${PN}-4.0.0-xkbcommon.patch
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR LD NM OBJCOPY PKG_CONFIG
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --with-confsuffix=/qemu
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable doc docs)
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ --disable-bluez
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser seccomp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ $(conf_notuser xkb xkbcommon)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ $(usev alsa)
+ $(usev oss)
+ $(usev sdl)
+ $(usex pulseaudio pa "")
+ )
+ conf_opts+=(
+ --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu/qmp.py"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dohtml check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-02-06 15:52 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2020-02-06 15:52 UTC (permalink / raw
To: gentoo-commits
commit: 1cb7f069622fe60699a533f23d755e091038f0f2
Author: Michal Privoznik <mprivozn <AT> redhat <DOT> com>
AuthorDate: Wed Jan 29 13:38:40 2020 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Thu Feb 6 15:45:26 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cb7f069
app-emulation/qemu-9999: Adapt to current master
There are two changes necessary for our live ebuild. The first
one consists of rebasing qemu-2.5.0-cflags.patch because the
configure file it's patching has diverged too much.
The second change removes qemu-2.5.0-sysmacros.patch from the
list of patches for its needlessness.
Signed-off-by: Michal Privoznik <mprivozn <AT> redhat.com>
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
app-emulation/qemu/files/qemu-4.2.0-cflags.patch | 16 ++++++++++++++++
app-emulation/qemu/qemu-9999.ebuild | 3 +--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-4.2.0-cflags.patch b/app-emulation/qemu/files/qemu-4.2.0-cflags.patch
new file mode 100644
index 00000000000..101926589a6
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-4.2.0-cflags.patch
@@ -0,0 +1,16 @@
+diff --git i/configure w/configure
+index a72a5def57..546d757603 100755
+--- i/configure
++++ w/configure
+@@ -6093,10 +6093,6 @@ write_c_skeleton
+ if test "$gcov" = "yes" ; then
+ QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
+ QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
+-elif test "$fortify_source" = "yes" ; then
+- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
+-elif test "$debug" = "no"; then
+- CFLAGS="-O2 $CFLAGS"
+ fi
+
+ if test "$have_asan" = "yes"; then
+
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 0d029214a5d..f872a6e7422 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -212,10 +212,9 @@ RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-qemu )"
PATCHES=(
- "${FILESDIR}"/${PN}-2.5.0-cflags.patch
- "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
+ "${FILESDIR}"/${PN}-4.2.0-cflags.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-04-08 18:51 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2020-04-08 18:51 UTC (permalink / raw
To: gentoo-commits
commit: 5ba2de3e653a5476467ef25d3389118f49d3f9ac
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 8 18:50:34 2020 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Wed Apr 8 18:51:16 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ba2de3e
app-emulation/qemu: fix buffer overflow, CVE-2020-11102
Bug: https://bugs.gentoo.org/716518
Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
.../qemu/files/qemu-4.2.0-CVE-2020-11102.patch | 144 ++++
app-emulation/qemu/qemu-4.2.0-r3.ebuild | 835 +++++++++++++++++++++
2 files changed, 979 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-4.2.0-CVE-2020-11102.patch b/app-emulation/qemu/files/qemu-4.2.0-CVE-2020-11102.patch
new file mode 100644
index 00000000000..118c81971d8
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-4.2.0-CVE-2020-11102.patch
@@ -0,0 +1,144 @@
+From 8ffb7265af64ec81748335ec8f20e7ab542c3850 Mon Sep 17 00:00:00 2001
+From: Prasad J Pandit <pjp@fedoraproject.org>
+Date: Tue, 24 Mar 2020 22:57:22 +0530
+Subject: [PATCH] net: tulip: check frame size and r/w data length
+
+Tulip network driver while copying tx/rx buffers does not check
+frame size against r/w data length. This may lead to OOB buffer
+access. Add check to avoid it.
+
+Limit iterations over descriptors to avoid potential infinite
+loop issue in tulip_xmit_list_update.
+
+Reported-by: Li Qiang <pangpei.lq@antfin.com>
+Reported-by: Ziming Zhang <ezrakiez@gmail.com>
+Reported-by: Jason Wang <jasowang@redhat.com>
+Tested-by: Li Qiang <liq3ea@gmail.com>
+Reviewed-by: Li Qiang <liq3ea@gmail.com>
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+---
+ hw/net/tulip.c | 36 +++++++++++++++++++++++++++---------
+ 1 file changed, 27 insertions(+), 9 deletions(-)
+
+diff --git a/hw/net/tulip.c b/hw/net/tulip.c
+index cfac2719d3..1295f51d07 100644
+--- a/hw/net/tulip.c
++++ b/hw/net/tulip.c
+@@ -170,6 +170,10 @@ static void tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc)
+ } else {
+ len = s->rx_frame_len;
+ }
++
++ if (s->rx_frame_len + len > sizeof(s->rx_frame)) {
++ return;
++ }
+ pci_dma_write(&s->dev, desc->buf_addr1, s->rx_frame +
+ (s->rx_frame_size - s->rx_frame_len), len);
+ s->rx_frame_len -= len;
+@@ -181,6 +185,10 @@ static void tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc)
+ } else {
+ len = s->rx_frame_len;
+ }
++
++ if (s->rx_frame_len + len > sizeof(s->rx_frame)) {
++ return;
++ }
+ pci_dma_write(&s->dev, desc->buf_addr2, s->rx_frame +
+ (s->rx_frame_size - s->rx_frame_len), len);
+ s->rx_frame_len -= len;
+@@ -227,7 +235,8 @@ static ssize_t tulip_receive(TULIPState *s, const uint8_t *buf, size_t size)
+
+ trace_tulip_receive(buf, size);
+
+- if (size < 14 || size > 2048 || s->rx_frame_len || tulip_rx_stopped(s)) {
++ if (size < 14 || size > sizeof(s->rx_frame) - 4
++ || s->rx_frame_len || tulip_rx_stopped(s)) {
+ return 0;
+ }
+
+@@ -275,7 +284,6 @@ static ssize_t tulip_receive_nc(NetClientState *nc,
+ return tulip_receive(qemu_get_nic_opaque(nc), buf, size);
+ }
+
+-
+ static NetClientInfo net_tulip_info = {
+ .type = NET_CLIENT_DRIVER_NIC,
+ .size = sizeof(NICState),
+@@ -558,7 +566,7 @@ static void tulip_tx(TULIPState *s, struct tulip_descriptor *desc)
+ if ((s->csr[6] >> CSR6_OM_SHIFT) & CSR6_OM_MASK) {
+ /* Internal or external Loopback */
+ tulip_receive(s, s->tx_frame, s->tx_frame_len);
+- } else {
++ } else if (s->tx_frame_len <= sizeof(s->tx_frame)) {
+ qemu_send_packet(qemu_get_queue(s->nic),
+ s->tx_frame, s->tx_frame_len);
+ }
+@@ -570,23 +578,31 @@ static void tulip_tx(TULIPState *s, struct tulip_descriptor *desc)
+ }
+ }
+
+-static void tulip_copy_tx_buffers(TULIPState *s, struct tulip_descriptor *desc)
++static int tulip_copy_tx_buffers(TULIPState *s, struct tulip_descriptor *desc)
+ {
+ int len1 = (desc->control >> TDES1_BUF1_SIZE_SHIFT) & TDES1_BUF1_SIZE_MASK;
+ int len2 = (desc->control >> TDES1_BUF2_SIZE_SHIFT) & TDES1_BUF2_SIZE_MASK;
+
++ if (s->tx_frame_len + len1 > sizeof(s->tx_frame)) {
++ return -1;
++ }
+ if (len1) {
+ pci_dma_read(&s->dev, desc->buf_addr1,
+ s->tx_frame + s->tx_frame_len, len1);
+ s->tx_frame_len += len1;
+ }
+
++ if (s->tx_frame_len + len2 > sizeof(s->tx_frame)) {
++ return -1;
++ }
+ if (len2) {
+ pci_dma_read(&s->dev, desc->buf_addr2,
+ s->tx_frame + s->tx_frame_len, len2);
+ s->tx_frame_len += len2;
+ }
+ desc->status = (len1 + len2) ? 0 : 0x7fffffff;
++
++ return 0;
+ }
+
+ static void tulip_setup_filter_addr(TULIPState *s, uint8_t *buf, int n)
+@@ -651,13 +667,15 @@ static uint32_t tulip_ts(TULIPState *s)
+
+ static void tulip_xmit_list_update(TULIPState *s)
+ {
++#define TULIP_DESC_MAX 128
++ uint8_t i = 0;
+ struct tulip_descriptor desc;
+
+ if (tulip_ts(s) != CSR5_TS_SUSPENDED) {
+ return;
+ }
+
+- for (;;) {
++ for (i = 0; i < TULIP_DESC_MAX; i++) {
+ tulip_desc_read(s, s->current_tx_desc, &desc);
+ tulip_dump_tx_descriptor(s, &desc);
+
+@@ -675,10 +693,10 @@ static void tulip_xmit_list_update(TULIPState *s)
+ s->tx_frame_len = 0;
+ }
+
+- tulip_copy_tx_buffers(s, &desc);
+-
+- if (desc.control & TDES1_LS) {
+- tulip_tx(s, &desc);
++ if (!tulip_copy_tx_buffers(s, &desc)) {
++ if (desc.control & TDES1_LS) {
++ tulip_tx(s, &desc);
++ }
+ }
+ }
+ tulip_desc_write(s, s->current_tx_desc, &desc);
+--
+2.24.1
+
diff --git a/app-emulation/qemu/qemu-4.2.0-r3.ebuild b/app-emulation/qemu/qemu-4.2.0-r3.ebuild
new file mode 100644
index 00000000000..288a676b581
--- /dev/null
+++ b/app-emulation/qemu/qemu-4.2.0-r3.ebuild
@@ -0,0 +1,835 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python{3_6,3_7} )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+FIRMWARE_ABI_VERSION="4.0.0-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+ udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
+ EGIT_SUBMODULES=(
+ slirp
+ tests/fp/berkeley-{test,soft}float-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://download.qemu.org/${P}.tar.xz
+ https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r1.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+ +fdt glusterfs gnutls gtk infiniband iscsi jemalloc +jpeg kernel_linux
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+ smartcard snappy spice ssh static static-user systemtap tci test usb
+ usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
+ xfs +xkb"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ lm32 moxie tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ static? ( static-user !alsa !gtk !opengl !pulseaudio !plugins !rbd !snappy )
+ static-user? ( !plugins )
+ virtfs? ( xattr )
+ vte? ( gtk )
+ plugins? ( !static !static-user )
+"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ xkb? ( x11-libs/libxkbcommon[static-libs(+)] )
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[X]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-201905[binary]
+ ~sys-firmware/ipxe-1.0.0_p20190728[binary]
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-4.0.0-sanitize-interp_info.patch
+ "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
+ "${FILESDIR}"/${PN}-4.2.0-CVE-2020-11102.patch #716518
+ "${WORKDIR}"/patches
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR LD NM OBJCOPY PKG_CONFIG
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --with-confsuffix=/qemu
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable doc docs)
+ $(use_enable plugins)
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ --disable-bluez
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser jemalloc jemalloc)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser sdl-image)
+ $(conf_notuser seccomp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser vhost-user-fs)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ $(conf_notuser xkb xkbcommon)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ $(usex pulseaudio pa "")
+ $(usev sdl)
+ $(usev alsa)
+ $(usev oss)
+ )
+ conf_opts+=(
+ --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake -j1 check
+ emake -j1 check-report.html
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dodoc check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-04-18 22:06 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2020-04-18 22:06 UTC (permalink / raw
To: gentoo-commits
commit: b7f1ef0ffc42f249b772cb1466e7f0f51f257f70
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 18 22:00:49 2020 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sat Apr 18 22:05:50 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7f1ef0f
app-emulation/qemu: drop vulnerable; drop patches
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
app-emulation/qemu/Manifest | 1 -
.../qemu/files/qemu-2.5.0-sysmacros.patch | 15 -
.../files/qemu-4.0.0-sanitize-interp_info.patch | 32 -
.../qemu/files/qemu-4.2.0-CVE-2020-11102.patch | 144 ----
.../qemu/files/qemu-4.2.0-epoll_create1.patch | 39 -
app-emulation/qemu/qemu-4.2.0-r2.ebuild | 833 ---------------------
6 files changed, 1064 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index f5407bf9a48..7aa3b70b1a9 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,3 +1,2 @@
-DIST qemu-4.2.0-patches-r1.tar.xz 14552 BLAKE2B e8832ce5b7ccda02dcd63fa60a458322a36ba754c8bc682839de4ee33cf21a83cde434bdc062916d3c83e81026b68ebf2fbe099dc6c54c191875f830d95c63ae SHA512 7495e4c9ca80fd25a1bc8244b384f88f3bc6d7190e2840b1614e3bc6fd51938e42792c6a4dbdb2d400a45532e558814462647f35d5ab21e175bec84868a4161d
DIST qemu-4.2.0-patches-r2.tar.xz 17868 BLAKE2B 3783d0f923ded66cce1195248981c83bbaf8b7ad2a270207e92e60b4d05d4787cd9324649c113a4616c2a9ddcef99841264f19915615b7a0a24dac9febed48ba SHA512 556f1c595a35ee4279b2d0890d90e48cd43d9d641ccca495e2494f62ab48dfc000dbe23718276271ced3d4b7680c814f8f8846195089ff56186f618063a83b48
DIST qemu-4.2.0.tar.xz 62222068 BLAKE2B 27c9fbcd5093af425764674817ab9299224bd03f37b5983786f6f437fff1fab3b7da247c55c4ca8b8c42726b9867005944a2f7f04f2d0d94d753961615f901ef SHA512 2a79973c2b07c53e8c57a808ea8add7b6b2cbca96488ed5d4b669ead8c9318907dec2b6109f180fc8ca8f04c0f73a56e82b3a527b5626b799d7e849f2474ec56
diff --git a/app-emulation/qemu/files/qemu-2.5.0-sysmacros.patch b/app-emulation/qemu/files/qemu-2.5.0-sysmacros.patch
deleted file mode 100644
index f2e766dc1c3..00000000000
--- a/app-emulation/qemu/files/qemu-2.5.0-sysmacros.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Linux C libs are moving away from implicit header pollution with sys/types.h
-
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -78,6 +78,10 @@ extern int daemon(int, int);
- #include <assert.h>
- #include <signal.h>
-
-+#ifdef __linux__
-+#include <sys/sysmacros.h>
-+#endif
-+
- #ifdef __OpenBSD__
- #include <sys/signal.h>
- #endif
diff --git a/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch b/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch
deleted file mode 100644
index 58ff0c78828..00000000000
--- a/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-linux-user: Sanitize interp_info and, for mips
-
-Sanitize interp_info structure in load_elf_binary() and, for mips only,
-init its field fp_abi. This fixes appearances of "Unexpected FPU mode"
-message in some MIPS use cases.
-
-Signed-off-by: Daniel Santos <address@hidden>
-Signed-off-by: Aleksandar Markovic <address@hidden>
----
- linux-user/elfload.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/linux-user/elfload.c b/linux-user/elfload.c
-index c1a2602..7f09d57 100644
---- a/linux-user/elfload.c
-+++ b/linux-user/elfload.c
-@@ -2698,6 +2698,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
- char *elf_interpreter = NULL;
- char *scratch;
-
-+ memset(&interp_info, 0, sizeof(interp_info));
-+#ifdef TARGET_MIPS
-+ interp_info.fp_abi = MIPS_ABI_FP_UNKNOWN;
-+#endif
-+
- info->start_mmap = (abi_ulong)ELF_START_MMAP;
-
- load_elf_image(bprm->filename, bprm->fd, info,
---
-2.7.4
-
-
diff --git a/app-emulation/qemu/files/qemu-4.2.0-CVE-2020-11102.patch b/app-emulation/qemu/files/qemu-4.2.0-CVE-2020-11102.patch
deleted file mode 100644
index 118c81971d8..00000000000
--- a/app-emulation/qemu/files/qemu-4.2.0-CVE-2020-11102.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-From 8ffb7265af64ec81748335ec8f20e7ab542c3850 Mon Sep 17 00:00:00 2001
-From: Prasad J Pandit <pjp@fedoraproject.org>
-Date: Tue, 24 Mar 2020 22:57:22 +0530
-Subject: [PATCH] net: tulip: check frame size and r/w data length
-
-Tulip network driver while copying tx/rx buffers does not check
-frame size against r/w data length. This may lead to OOB buffer
-access. Add check to avoid it.
-
-Limit iterations over descriptors to avoid potential infinite
-loop issue in tulip_xmit_list_update.
-
-Reported-by: Li Qiang <pangpei.lq@antfin.com>
-Reported-by: Ziming Zhang <ezrakiez@gmail.com>
-Reported-by: Jason Wang <jasowang@redhat.com>
-Tested-by: Li Qiang <liq3ea@gmail.com>
-Reviewed-by: Li Qiang <liq3ea@gmail.com>
-Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
----
- hw/net/tulip.c | 36 +++++++++++++++++++++++++++---------
- 1 file changed, 27 insertions(+), 9 deletions(-)
-
-diff --git a/hw/net/tulip.c b/hw/net/tulip.c
-index cfac2719d3..1295f51d07 100644
---- a/hw/net/tulip.c
-+++ b/hw/net/tulip.c
-@@ -170,6 +170,10 @@ static void tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc)
- } else {
- len = s->rx_frame_len;
- }
-+
-+ if (s->rx_frame_len + len > sizeof(s->rx_frame)) {
-+ return;
-+ }
- pci_dma_write(&s->dev, desc->buf_addr1, s->rx_frame +
- (s->rx_frame_size - s->rx_frame_len), len);
- s->rx_frame_len -= len;
-@@ -181,6 +185,10 @@ static void tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc)
- } else {
- len = s->rx_frame_len;
- }
-+
-+ if (s->rx_frame_len + len > sizeof(s->rx_frame)) {
-+ return;
-+ }
- pci_dma_write(&s->dev, desc->buf_addr2, s->rx_frame +
- (s->rx_frame_size - s->rx_frame_len), len);
- s->rx_frame_len -= len;
-@@ -227,7 +235,8 @@ static ssize_t tulip_receive(TULIPState *s, const uint8_t *buf, size_t size)
-
- trace_tulip_receive(buf, size);
-
-- if (size < 14 || size > 2048 || s->rx_frame_len || tulip_rx_stopped(s)) {
-+ if (size < 14 || size > sizeof(s->rx_frame) - 4
-+ || s->rx_frame_len || tulip_rx_stopped(s)) {
- return 0;
- }
-
-@@ -275,7 +284,6 @@ static ssize_t tulip_receive_nc(NetClientState *nc,
- return tulip_receive(qemu_get_nic_opaque(nc), buf, size);
- }
-
--
- static NetClientInfo net_tulip_info = {
- .type = NET_CLIENT_DRIVER_NIC,
- .size = sizeof(NICState),
-@@ -558,7 +566,7 @@ static void tulip_tx(TULIPState *s, struct tulip_descriptor *desc)
- if ((s->csr[6] >> CSR6_OM_SHIFT) & CSR6_OM_MASK) {
- /* Internal or external Loopback */
- tulip_receive(s, s->tx_frame, s->tx_frame_len);
-- } else {
-+ } else if (s->tx_frame_len <= sizeof(s->tx_frame)) {
- qemu_send_packet(qemu_get_queue(s->nic),
- s->tx_frame, s->tx_frame_len);
- }
-@@ -570,23 +578,31 @@ static void tulip_tx(TULIPState *s, struct tulip_descriptor *desc)
- }
- }
-
--static void tulip_copy_tx_buffers(TULIPState *s, struct tulip_descriptor *desc)
-+static int tulip_copy_tx_buffers(TULIPState *s, struct tulip_descriptor *desc)
- {
- int len1 = (desc->control >> TDES1_BUF1_SIZE_SHIFT) & TDES1_BUF1_SIZE_MASK;
- int len2 = (desc->control >> TDES1_BUF2_SIZE_SHIFT) & TDES1_BUF2_SIZE_MASK;
-
-+ if (s->tx_frame_len + len1 > sizeof(s->tx_frame)) {
-+ return -1;
-+ }
- if (len1) {
- pci_dma_read(&s->dev, desc->buf_addr1,
- s->tx_frame + s->tx_frame_len, len1);
- s->tx_frame_len += len1;
- }
-
-+ if (s->tx_frame_len + len2 > sizeof(s->tx_frame)) {
-+ return -1;
-+ }
- if (len2) {
- pci_dma_read(&s->dev, desc->buf_addr2,
- s->tx_frame + s->tx_frame_len, len2);
- s->tx_frame_len += len2;
- }
- desc->status = (len1 + len2) ? 0 : 0x7fffffff;
-+
-+ return 0;
- }
-
- static void tulip_setup_filter_addr(TULIPState *s, uint8_t *buf, int n)
-@@ -651,13 +667,15 @@ static uint32_t tulip_ts(TULIPState *s)
-
- static void tulip_xmit_list_update(TULIPState *s)
- {
-+#define TULIP_DESC_MAX 128
-+ uint8_t i = 0;
- struct tulip_descriptor desc;
-
- if (tulip_ts(s) != CSR5_TS_SUSPENDED) {
- return;
- }
-
-- for (;;) {
-+ for (i = 0; i < TULIP_DESC_MAX; i++) {
- tulip_desc_read(s, s->current_tx_desc, &desc);
- tulip_dump_tx_descriptor(s, &desc);
-
-@@ -675,10 +693,10 @@ static void tulip_xmit_list_update(TULIPState *s)
- s->tx_frame_len = 0;
- }
-
-- tulip_copy_tx_buffers(s, &desc);
--
-- if (desc.control & TDES1_LS) {
-- tulip_tx(s, &desc);
-+ if (!tulip_copy_tx_buffers(s, &desc)) {
-+ if (desc.control & TDES1_LS) {
-+ tulip_tx(s, &desc);
-+ }
- }
- }
- tulip_desc_write(s, s->current_tx_desc, &desc);
---
-2.24.1
-
diff --git a/app-emulation/qemu/files/qemu-4.2.0-epoll_create1.patch b/app-emulation/qemu/files/qemu-4.2.0-epoll_create1.patch
deleted file mode 100644
index bb20dd12087..00000000000
--- a/app-emulation/qemu/files/qemu-4.2.0-epoll_create1.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From ce7ae180620a2fbf66232c3556678fbf4f136a5c Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Wed, 15 Apr 2020 19:28:42 +0100
-Subject: [PATCH] linux-user/syscall.c: add target-to-host mapping for
- epoll_create1()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Noticed by Barnabás Virágh as a python-3.7 failue on qemu-alpha.
-
-The bug shows up on alpha as it's one of the targets where
-EPOLL_CLOEXEC differs from other targets:
- sysdeps/unix/sysv/linux/alpha/bits/epoll.h: EPOLL_CLOEXEC = 01000000
- sysdeps/unix/sysv/linux/bits/epoll.h: EPOLL_CLOEXEC = 02000000
-
-Bug: https://bugs.gentoo.org/717548
-Reported-by: Barnabás Virágh
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
----
- linux-user/syscall.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/linux-user/syscall.c b/linux-user/syscall.c
-index 674f70e70a..05f03919ff 100644
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -12012,7 +12012,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
- #endif
- #if defined(TARGET_NR_epoll_create1) && defined(CONFIG_EPOLL_CREATE1)
- case TARGET_NR_epoll_create1:
-- return get_errno(epoll_create1(arg1));
-+ return get_errno(epoll_create1(target_to_host_bitmask(arg1, fcntl_flags_tbl)));
- #endif
- #if defined(TARGET_NR_epoll_ctl)
- case TARGET_NR_epoll_ctl:
---
-2.26.1
-
diff --git a/app-emulation/qemu/qemu-4.2.0-r2.ebuild b/app-emulation/qemu/qemu-4.2.0-r2.ebuild
deleted file mode 100644
index 9aa5db7a862..00000000000
--- a/app-emulation/qemu/qemu-4.2.0-r2.ebuild
+++ /dev/null
@@ -1,833 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PYTHON_COMPAT=( python{3_6,3_7} )
-PYTHON_REQ_USE="ncurses,readline"
-
-PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
-
-FIRMWARE_ABI_VERSION="4.0.0-r50"
-
-inherit eutils linux-info toolchain-funcs multilib python-r1 \
- udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
- EGIT_SUBMODULES=(
- slirp
- tests/fp/berkeley-{test,soft}float-3
- ui/keycodemapdb
- )
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="https://download.qemu.org/${P}.tar.xz
- https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r1.tar.xz"
- KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-
-IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
- +fdt glusterfs gnutls gtk infiniband iscsi jemalloc +jpeg kernel_linux
- kernel_FreeBSD lzo ncurses nfs nls numa opengl +oss +pin-upstream-blobs
- plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
- smartcard snappy spice ssh static static-user systemtap tci test usb
- usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs +xkb"
-
-COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
- mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
- sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
-IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
- lm32 moxie tricore unicore32"
-IUSE_USER_TARGETS="${COMMON_TARGETS}
- aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
- tilegx"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-RESTRICT="!test? ( test )"
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_riscv32? ( fdt )
- qemu_softmmu_targets_riscv64? ( fdt )
- static? ( static-user !alsa !gtk !opengl !pulseaudio !plugins !rbd !snappy )
- static-user? ( !plugins )
- virtfs? ( xattr )
- vte? ( gtk )
- plugins? ( !static !static-user )
-"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the external library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- dev-libs/libxml2[static-libs(+)]
- xkb? ( x11-libs/libxkbcommon[static-libs(+)] )
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- capstone? ( dev-libs/capstone:= )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- infiniband? (
- sys-fabric/libibumad:=[static-libs(+)]
- sys-fabric/libibverbs:=[static-libs(+)]
- sys-fabric/librdmacm:=[static-libs(+)]
- )
- iscsi? ( net-libs/libiscsi )
- jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- ncurses? (
- sys-libs/ncurses:0=[unicode]
- sys-libs/ncurses:0=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl,gbm]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- media-libs/libsdl2[X]
- media-libs/libsdl2[static-libs(+)]
- )
- sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:= )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-201905[binary]
- ~sys-firmware/ipxe-1.0.0_p20190728[binary]
- ~sys-firmware/seabios-1.12.0[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre8[binary]
- )
- !pin-upstream-blobs? (
- sys-firmware/edk2-ovmf
- sys-firmware/ipxe
- >=sys-firmware/seabios-1.10.2[seavgabios]
- sys-firmware/sgabios
- )"
-PPC64_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-1.12.0[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-1.10.2[seavgabios]
- )
-"
-
-BDEPEND="
- $(python_gen_impl_dep)
- dev-lang/perl
- sys-apps/texinfo
- virtual/pkgconfig
- doc? ( dev-python/sphinx )
- gtk? ( nls? ( sys-devel/gettext ) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )
-"
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )"
-RDEPEND="${CDEPEND}
- acct-group/kvm
- selinux? ( sec-policy/selinux-qemu )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.5.0-cflags.patch
- "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
- "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-4.0.0-sanitize-interp_info.patch
- "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
- "${WORKDIR}"/patches
-)
-
-QA_PREBUILT="
- usr/share/qemu/hppa-firmware.img
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-handle_locales() {
- # Make sure locale list is kept up-to-date.
- local detected sorted
- detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
- sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "PLOCALES: ${sorted}"
- eerror " po/*.po: ${detected}"
- die "sync PLOCALES"
- fi
-
- # Deal with selective install of locales.
- if use nls ; then
- # Delete locales the user does not want. #577814
- rm_loc() { rm po/$1.po || die; }
- l10n_for_each_disabled_locale_do rm_loc
- else
- # Cheap hack to disable gettext .mo generation.
- rm -f po/*.po
- fi
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- default
-
- # Use correct toolchain to fix cross-compiling
- tc-export AR LD NM OBJCOPY PKG_CONFIG
- export WINDRES=${CHOST}-windres
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Run after we've applied all patches.
- handle_locales
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --bindir=/usr/bin
- --libdir=/usr/$(get_libdir)
- --datadir=/usr/share
- --docdir=/usr/share/doc/${PF}/html
- --mandir=/usr/share/man
- --with-confsuffix=/qemu
- --localstatedir=/var
- --disable-bsd-user
- --disable-guest-agent
- --disable-strip
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- $(use_enable doc docs)
- $(use_enable plugins)
- $(use_enable tci tcg-interpreter)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- conf_opts+=(
- --disable-bluez
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_notuser bzip2)
- $(conf_notuser capstone)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_notuser fdt)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser jemalloc jemalloc)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_notuser sdl-image)
- $(conf_notuser seccomp)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser vhost-user-fs)
- $(conf_notuser virgl virglrenderer)
- $(conf_notuser virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- $(conf_notuser xkb xkbcommon)
- )
-
- if [[ ${buildtype} == "user" ]] ; then
- conf_opts+=( --disable-libxml2 )
- else
- conf_opts+=( --enable-libxml2 )
- fi
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts=(
- $(usex pulseaudio pa "")
- $(usev sdl)
- $(usev alsa)
- $(usev oss)
- )
- conf_opts+=(
- --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
- )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake -j1 check
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/python/qemu"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- # we use 'printf' here to be portable across 'sh'
- # implementations: #679168
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dodoc check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- # Disallow stripping of prebuilt firmware files.
- dostrip -x ${QA_PREBUILT}
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- xdg_icon_cache_update
-
- [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
-
-pkg_postrm() {
- xdg_icon_cache_update
-}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-04-30 23:47 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-04-30 23:47 UTC (permalink / raw
To: gentoo-commits
commit: a1cc6f0bdfeb26400cbfac4fb86031c1bab3b6ef
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 30 23:23:54 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Apr 30 23:47:26 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1cc6f0b
app-emulation/qemu: bump up to 5.0.0, bug #720138
Two new USE flags:
- io-uring for fast async io_uring I/O
- zstd for libzstd compression of migration traffic
Reported-by: Thomas Stein
Closes: https://bugs.gentoo.org/720138
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
app-emulation/qemu/Manifest | 1 +
.../qemu/files/qemu-5.0.0-epoll-strace.patch | 50 ++++++++++++++++++++++
app-emulation/qemu/metadata.xml | 1 +
.../qemu/{qemu-9999.ebuild => qemu-5.0.0.ebuild} | 15 +++++--
app-emulation/qemu/qemu-9999.ebuild | 15 +++++--
5 files changed, 74 insertions(+), 8 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 7aa3b70b1a9..333933242cf 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,2 +1,3 @@
DIST qemu-4.2.0-patches-r2.tar.xz 17868 BLAKE2B 3783d0f923ded66cce1195248981c83bbaf8b7ad2a270207e92e60b4d05d4787cd9324649c113a4616c2a9ddcef99841264f19915615b7a0a24dac9febed48ba SHA512 556f1c595a35ee4279b2d0890d90e48cd43d9d641ccca495e2494f62ab48dfc000dbe23718276271ced3d4b7680c814f8f8846195089ff56186f618063a83b48
DIST qemu-4.2.0.tar.xz 62222068 BLAKE2B 27c9fbcd5093af425764674817ab9299224bd03f37b5983786f6f437fff1fab3b7da247c55c4ca8b8c42726b9867005944a2f7f04f2d0d94d753961615f901ef SHA512 2a79973c2b07c53e8c57a808ea8add7b6b2cbca96488ed5d4b669ead8c9318907dec2b6109f180fc8ca8f04c0f73a56e82b3a527b5626b799d7e849f2474ec56
+DIST qemu-5.0.0.tar.xz 62426192 BLAKE2B 785d02ef79c95b5c4f0556186054885f9893d4e8a9f4b4f2d6199a4e1ae9c31d7c79dd900305469217f85d61bbe74134b601d5c6c1b0eee2b74792d010f1fd63 SHA512 21ef0cbe107c468a40f0fa2635db2a40048c8790b629dfffca5cd62bb1b502ea8eb133bfc40df5ecf1489e2bffe87f6829aee041cb8a380ff04a8afa23b39fcf
diff --git a/app-emulation/qemu/files/qemu-5.0.0-epoll-strace.patch b/app-emulation/qemu/files/qemu-5.0.0-epoll-strace.patch
new file mode 100644
index 00000000000..c0f9a2e008d
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.0.0-epoll-strace.patch
@@ -0,0 +1,50 @@
+https://lists.nongnu.org/archive/html/qemu-devel/2020-04/msg02643.html
+
+From 6bce23d8daf96a7faa9288e7414948cda31ddaa2 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Thu, 16 Apr 2020 18:55:49 +0100
+Subject: [PATCH] linux-user/strace.list: fix epoll_create{,1} -strace output
+
+Fix syscall name and parameters priinter.
+
+Before the change:
+
+```
+$ alpha-linux-user/qemu-alpha -strace -L /usr/alpha-unknown-linux-gnu/ /tmp/a
+...
+1274697 %s(%d)(2097152,274903156744,274903156760,274905840712,274877908880,274903235616) = 3
+1274697 exit_group(0)
+```
+
+After the change:
+
+```
+$ alpha-linux-user/qemu-alpha -strace -L /usr/alpha-unknown-linux-gnu/ /tmp/a
+...
+1273719 epoll_create1(2097152) = 3
+1273719 exit_group(0)
+```
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ linux-user/strace.list | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/linux-user/strace.list
++++ b/linux-user/strace.list
+@@ -125,10 +125,10 @@
+ { TARGET_NR_dup3, "dup3" , "%s(%d,%d,%d)", NULL, NULL },
+ #endif
+ #ifdef TARGET_NR_epoll_create
+-{ TARGET_NR_epoll_create, "%s(%d)", NULL, NULL, NULL },
++{ TARGET_NR_epoll_create, "epoll_create", "%s(%d)", NULL, NULL },
+ #endif
+ #ifdef TARGET_NR_epoll_create1
+-{ TARGET_NR_epoll_create1, "%s(%d)", NULL, NULL, NULL },
++{ TARGET_NR_epoll_create1, "epoll_create1", "%s(%d)", NULL, NULL },
+ #endif
+ #ifdef TARGET_NR_epoll_ctl
+ { TARGET_NR_epoll_ctl, "epoll_ctl" , NULL, NULL, NULL },
+--
+2.26.2
+
diff --git a/app-emulation/qemu/metadata.xml b/app-emulation/qemu/metadata.xml
index 07244b5deff..0c30c458264 100644
--- a/app-emulation/qemu/metadata.xml
+++ b/app-emulation/qemu/metadata.xml
@@ -28,6 +28,7 @@
<flag name="iscsi">Enable direct iSCSI support via
<pkg>net-libs/libiscsi</pkg> instead of indirectly via the Linux
block layer that <pkg>sys-block/open-iscsi</pkg> does.</flag>
+ <flag name="io-uring">Enable efficient I/O via <pkg>sys-libs/liburing</pkg>.</flag>
<flag name="ncurses">Enable the ncurses-based console</flag>
<flag name="nfs">Enable NFS support</flag>
<flag name="numa">Enable NUMA support</flag>
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-5.0.0.ebuild
similarity index 98%
copy from app-emulation/qemu/qemu-9999.ebuild
copy to app-emulation/qemu/qemu-5.0.0.ebuild
index b189a315909..ae78e0ad179 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-5.0.0.ebuild
@@ -24,7 +24,7 @@ if [[ ${PV} = *9999* ]]; then
SRC_URI=""
else
SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+ KEYWORDS="~amd64 ~x86"
fi
DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
@@ -34,12 +34,13 @@ LICENSE="GPL-2 LGPL-2 BSD-2"
SLOT="0"
IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
- +fdt glusterfs gnutls gtk infiniband iscsi jemalloc +jpeg kernel_linux
+ +fdt glusterfs gnutls gtk infiniband iscsi io-uring
+ jemalloc +jpeg kernel_linux
kernel_FreeBSD lzo ncurses nfs nls numa opengl +oss +pin-upstream-blobs
plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
smartcard snappy spice ssh static static-user systemtap tci test usb
usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs +xkb"
+ xfs +xkb zstd"
COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
@@ -119,6 +120,7 @@ SOFTMMU_TOOLS_DEPEND="
sys-fabric/librdmacm:=[static-libs(+)]
)
iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing[static-libs(+)] )
jemalloc? ( dev-libs/jemalloc )
jpeg? ( virtual/jpeg:0=[static-libs(+)] )
lzo? ( dev-libs/lzo:2[static-libs(+)] )
@@ -157,7 +159,9 @@ SOFTMMU_TOOLS_DEPEND="
virgl? ( media-libs/virglrenderer[static-libs(+)] )
virtfs? ( sys-libs/libcap )
xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
X86_FIRMWARE_DEPEND="
pin-upstream-blobs? (
@@ -217,6 +221,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
"${FILESDIR}"/${PN}-4.2.0-cflags.patch
+ "${FILESDIR}"/${PN}-5.0.0-epoll-strace.patch
)
QA_PREBUILT="
@@ -449,6 +454,7 @@ qemu_src_configure() {
$(conf_notuser gtk)
$(conf_notuser infiniband rdma)
$(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
$(conf_notuser jemalloc jemalloc)
$(conf_notuser jpeg vnc-jpeg)
$(conf_notuser kernel_linux kvm)
@@ -480,6 +486,7 @@ qemu_src_configure() {
$(conf_notuser xen xen-pci-passthrough)
$(conf_notuser xfs xfsctl)
$(conf_notuser xkb xkbcommon)
+ $(conf_notuser zstd)
)
if [[ ${buildtype} == "user" ]] ; then
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index b189a315909..ae78e0ad179 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -24,7 +24,7 @@ if [[ ${PV} = *9999* ]]; then
SRC_URI=""
else
SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+ KEYWORDS="~amd64 ~x86"
fi
DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
@@ -34,12 +34,13 @@ LICENSE="GPL-2 LGPL-2 BSD-2"
SLOT="0"
IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
- +fdt glusterfs gnutls gtk infiniband iscsi jemalloc +jpeg kernel_linux
+ +fdt glusterfs gnutls gtk infiniband iscsi io-uring
+ jemalloc +jpeg kernel_linux
kernel_FreeBSD lzo ncurses nfs nls numa opengl +oss +pin-upstream-blobs
plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
smartcard snappy spice ssh static static-user systemtap tci test usb
usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs +xkb"
+ xfs +xkb zstd"
COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
@@ -119,6 +120,7 @@ SOFTMMU_TOOLS_DEPEND="
sys-fabric/librdmacm:=[static-libs(+)]
)
iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing[static-libs(+)] )
jemalloc? ( dev-libs/jemalloc )
jpeg? ( virtual/jpeg:0=[static-libs(+)] )
lzo? ( dev-libs/lzo:2[static-libs(+)] )
@@ -157,7 +159,9 @@ SOFTMMU_TOOLS_DEPEND="
virgl? ( media-libs/virglrenderer[static-libs(+)] )
virtfs? ( sys-libs/libcap )
xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
X86_FIRMWARE_DEPEND="
pin-upstream-blobs? (
@@ -217,6 +221,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
"${FILESDIR}"/${PN}-4.2.0-cflags.patch
+ "${FILESDIR}"/${PN}-5.0.0-epoll-strace.patch
)
QA_PREBUILT="
@@ -449,6 +454,7 @@ qemu_src_configure() {
$(conf_notuser gtk)
$(conf_notuser infiniband rdma)
$(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
$(conf_notuser jemalloc jemalloc)
$(conf_notuser jpeg vnc-jpeg)
$(conf_notuser kernel_linux kvm)
@@ -480,6 +486,7 @@ qemu_src_configure() {
$(conf_notuser xen xen-pci-passthrough)
$(conf_notuser xfs xfsctl)
$(conf_notuser xkb xkbcommon)
+ $(conf_notuser zstd)
)
if [[ ${buildtype} == "user" ]] ; then
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-07-09 22:55 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-07-09 22:55 UTC (permalink / raw
To: gentoo-commits
commit: 55bb42729114274069f2c4d46cfbf7317c58c0f9
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 9 22:55:34 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Jul 9 22:55:34 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55bb4272
app-emulation/qemu: backport slirp ipv6 fix: CVE-2020-10756
Reported-by: John Helmert III (ajak)
Bug: https://bugs.gentoo.org/731992
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
.../qemu-5.0.0-ipv6-slirp-CVE-2020-10756.patch | 35 +
app-emulation/qemu/qemu-5.0.0-r1.ebuild | 838 +++++++++++++++++++++
2 files changed, 873 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-5.0.0-ipv6-slirp-CVE-2020-10756.patch b/app-emulation/qemu/files/qemu-5.0.0-ipv6-slirp-CVE-2020-10756.patch
new file mode 100644
index 00000000000..d1d3c49a58f
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.0.0-ipv6-slirp-CVE-2020-10756.patch
@@ -0,0 +1,35 @@
+https://gitlab.freedesktop.org/slirp/libslirp/-/commit/c7ede54cbd2e2b25385325600958ba0124e31cc0
+https://bugzilla.redhat.com/show_bug.cgi?id=1835986
+https://bugs.gentoo.org/731992
+
+From c7ede54cbd2e2b25385325600958ba0124e31cc0 Mon Sep 17 00:00:00 2001
+From: Ralf Haferkamp <rhafer@suse.com>
+Date: Fri, 3 Jul 2020 14:51:16 +0200
+Subject: [PATCH] Drop bogus IPv6 messages
+
+Drop IPv6 message shorter than what's mentioned in the payload
+length header (+ the size of the IPv6 header). They're invalid an could
+lead to data leakage in icmp6_send_echoreply().
+---
+ src/ip6_input.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/slirp/src/ip6_input.c
++++ b/slirp/src/ip6_input.c
+@@ -49,6 +49,13 @@ void ip6_input(struct mbuf *m)
+ goto bad;
+ }
+
++ // Check if the message size is big enough to hold what's
++ // set in the payload length header. If not this is an invalid
++ // packet
++ if (m->m_len < ntohs(ip6->ip_pl) + sizeof(struct ip6)) {
++ goto bad;
++ }
++
+ /* check ip_ttl for a correct ICMP reply */
+ if (ip6->ip_hl == 0) {
+ icmp6_send_error(m, ICMP6_TIMXCEED, ICMP6_TIMXCEED_INTRANS);
+--
+GitLab
+
diff --git a/app-emulation/qemu/qemu-5.0.0-r1.ebuild b/app-emulation/qemu/qemu-5.0.0-r1.ebuild
new file mode 100644
index 00000000000..0cfa9836a83
--- /dev/null
+++ b/app-emulation/qemu/qemu-5.0.0-r1.ebuild
@@ -0,0 +1,838 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python{3_6,3_7,3_8} )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
+
+FIRMWARE_ABI_VERSION="4.0.0-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+ udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
+ EGIT_SUBMODULES=(
+ slirp
+ tests/fp/berkeley-{test,soft}float-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://download.qemu.org/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+ +fdt glusterfs gnutls gtk infiniband iscsi io-uring
+ jemalloc +jpeg kernel_linux
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+ smartcard snappy spice ssh static static-user systemtap tci test usb
+ usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
+ xfs +xkb zstd"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ lm32 moxie rx tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ static? ( static-user !alsa !gtk !opengl !pulseaudio !plugins !rbd !snappy )
+ static-user? ( !plugins )
+ virtfs? ( xattr )
+ vte? ( gtk )
+ plugins? ( !static !static-user )
+"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ xkb? ( x11-libs/libxkbcommon[static-libs(+)] )
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing[static-libs(+)] )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[video]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-201905[binary]
+ ~sys-firmware/ipxe-1.0.0_p20190728[binary]
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
+ "${FILESDIR}"/${PN}-4.2.0-cflags.patch
+ "${FILESDIR}"/${PN}-5.0.0-epoll-strace.patch
+ "${FILESDIR}"/${PN}-5.0.0-ipv6-slirp-CVE-2020-10756.patch #731992
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --with-confsuffix=/qemu
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable doc docs)
+ $(use_enable plugins)
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
+ $(conf_notuser jemalloc jemalloc)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser sdl-image)
+ $(conf_notuser seccomp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser vhost-user-fs)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ $(conf_notuser xkb xkbcommon)
+ $(conf_notuser zstd)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ # Note: backend order matters here: #716202
+ # We iterate from higher-level to lower level.
+ $(usex pulseaudio pa "")
+ $(usev sdl)
+ $(usev alsa)
+ $(usev oss)
+ )
+ conf_opts+=(
+ --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake check
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dodoc check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-08-13 22:36 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-08-13 22:36 UTC (permalink / raw
To: gentoo-commits
commit: 10849338838c4d28272a13e1412a8c2b89e02889
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 13 22:36:43 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Aug 13 22:36:51 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10849338
app-emulation/qemu: fix pixman detection for vhost-user-gnu
Use patch by Rafael Kitover to fix dependency detection.
Fix-by: Rafael Kitover
Closes: https://bugs.gentoo.org/735146
Package-Manager: Portage-3.0.2, Repoman-2.3.23
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
.../qemu-5.1.0-pixman-for-vhost-user-gpu.patch | 62 ++++++++++++++++++++++
app-emulation/qemu/qemu-5.1.0.ebuild | 1 +
app-emulation/qemu/qemu-9999.ebuild | 1 +
3 files changed, 64 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-5.1.0-pixman-for-vhost-user-gpu.patch b/app-emulation/qemu/files/qemu-5.1.0-pixman-for-vhost-user-gpu.patch
new file mode 100644
index 00000000000..4eb644fde54
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.1.0-pixman-for-vhost-user-gpu.patch
@@ -0,0 +1,62 @@
+https://bugs.gentoo.org/735146
+
+From 4fd46e6cdd976f4aecdc3fbbad728e00a7bc4ee0 Mon Sep 17 00:00:00 2001
+From: Rafael Kitover <rkitover@gmail.com>
+Date: Thu, 13 Aug 2020 20:19:24 +0000
+Subject: [PATCH] configure: Require pixman for vhost-user-gpu.
+
+Use the test from Makefile to check if vhost-user-gpu is being built,
+and if so require pixman.
+
+Signed-off-by: Rafael Kitover <rkitover@gmail.com>
+---
+ configure | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+--- a/configure
++++ b/configure
+@@ -4062,20 +4062,6 @@ if test "$modules" = yes; then
+ fi
+ fi
+
+-##########################################
+-# pixman support probe
+-
+-if test "$softmmu" = "no"; then
+- pixman_cflags=
+- pixman_libs=
+-elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
+- pixman_cflags=$($pkg_config --cflags pixman-1)
+- pixman_libs=$($pkg_config --libs pixman-1)
+-else
+- error_exit "pixman >= 0.21.8 not present." \
+- "Please install the pixman devel package."
+-fi
+-
+ ##########################################
+ # libmpathpersist probe
+
+@@ -4491,6 +4477,20 @@ if test "$opengl" = "yes" && test "$have_x11" = "yes"; then
+ done
+ fi
+
++##########################################
++# pixman support probe
++
++if test "$softmmu" = "no" && ! test "${linux} ${virglrenderer} ${gbm} ${want_tools}" = "yes yes yes yes"; then
++ pixman_cflags=
++ pixman_libs=
++elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
++ pixman_cflags=$($pkg_config --cflags pixman-1)
++ pixman_libs=$($pkg_config --libs pixman-1)
++else
++ error_exit "pixman >= 0.21.8 not present." \
++ "Please install the pixman devel package."
++fi
++
+ ##########################################
+ # libxml2 probe
+ if test "$libxml2" != "no" ; then
+--
+2.28.0
+
diff --git a/app-emulation/qemu/qemu-5.1.0.ebuild b/app-emulation/qemu/qemu-5.1.0.ebuild
index 7abd42909d8..dc2c1447afa 100644
--- a/app-emulation/qemu/qemu-5.1.0.ebuild
+++ b/app-emulation/qemu/qemu-5.1.0.ebuild
@@ -224,6 +224,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
"${FILESDIR}"/${PN}-4.2.0-cflags.patch
+ "${FILESDIR}"/${PN}-5.1.0-pixman-for-vhost-user-gpu.patch
)
QA_PREBUILT="
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 7abd42909d8..dc2c1447afa 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -224,6 +224,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
"${FILESDIR}"/${PN}-4.2.0-cflags.patch
+ "${FILESDIR}"/${PN}-5.1.0-pixman-for-vhost-user-gpu.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-09-05 7:08 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-09-05 7:08 UTC (permalink / raw
To: gentoo-commits
commit: db151e97734c6c7519ee5632619cfe288c9a34b0
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 5 06:49:15 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep 5 07:08:15 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db151e97
app-emulation/qemu: refresh cflags.patch patch
Reported-by: Darren Blaber
Bug: https://bugs.gentoo.org/740386
Package-Manager: Portage-3.0.5, Repoman-3.0.1
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
app-emulation/qemu/files/qemu-9999-cflags.patch | 12 ++++++++++++
app-emulation/qemu/qemu-9999.ebuild | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/app-emulation/qemu/files/qemu-9999-cflags.patch b/app-emulation/qemu/files/qemu-9999-cflags.patch
new file mode 100644
index 00000000000..1c732a453a9
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-9999-cflags.patch
@@ -0,0 +1,12 @@
+--- a/configure
++++ b/configure
+@@ -6349,9 +6349,6 @@ if test "$debug_info" = "yes"; then
+ CFLAGS="-g $CFLAGS"
+ LDFLAGS="-g $LDFLAGS"
+ fi
+-if test "$debug" = "no"; then
+- CFLAGS="-O2 $CFLAGS"
+-fi
+
+ case "$ARCH" in
+ alpha)
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 927a6f83b68..bfe6e0f0f9c 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -223,7 +223,7 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-4.2.0-cflags.patch
+ "${FILESDIR}"/${PN}-9999-cflags.patch
"${FILESDIR}"/${PN}-5.1.0-pixman-for-vhost-user-gpu.patch
)
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-09-19 7:33 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-09-19 7:33 UTC (permalink / raw
To: gentoo-commits
commit: b3ce8bbed78b0651008ec4c5e40df1de8e0f5052
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 07:31:53 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 07:33:01 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3ce8bbe
app-emulation/qemu: drop upstreamed patch
This reverts commit 3752d632441c34385ee7296126e3867536cb63e7.
Bug: https://bugs.gentoo.org/740836
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
app-emulation/qemu/files/qemu-9999-format-error.patch | 14 --------------
app-emulation/qemu/qemu-9999.ebuild | 1 -
2 files changed, 15 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-9999-format-error.patch b/app-emulation/qemu/files/qemu-9999-format-error.patch
deleted file mode 100644
index 8bb4d96b77c..00000000000
--- a/app-emulation/qemu/files/qemu-9999-format-error.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-https://bugs.gentoo.org/740836
---- a/meson.build
-+++ b/meson.build
-@@ -255,8 +255,8 @@ if sdl.found()
- method: 'pkg-config', static: enable_static)
- else
- if get_option('sdl_image').enabled()
-- error('sdl-image required, but SDL was @0@',
-- get_option('sdl').disabled() ? 'disabled' : 'not found')
-+ error('sdl-image required, but SDL was @0@'.format(
-+ get_option('sdl').disabled() ? 'disabled' : 'not found'))
- endif
- sdl_image = not_found
- endif
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index df162166cbf..c46858db497 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -226,7 +226,6 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-9999-cflags.patch
- "${FILESDIR}"/${PN}-9999-format-error.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-09-20 8:23 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-09-20 8:23 UTC (permalink / raw
To: gentoo-commits
commit: bf5b7df71d5fa17a248529f6e8180098c1adc667
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 20 08:22:57 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 08:23:26 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf5b7df7
app-emulation/qemu: backport USB oob access (CVE-2020-14364)
Reported-by: John Helmert III (ajak)
Bug: https://bugs.gentoo.org/743649
Package-Manager: Portage-3.0.7, Repoman-3.0.1
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
.../files/qemu-5.1.0-usb-oob-CVE-2020-14364.patch | 90 +++
app-emulation/qemu/qemu-5.1.0-r1.ebuild | 846 +++++++++++++++++++++
2 files changed, 936 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-5.1.0-usb-oob-CVE-2020-14364.patch b/app-emulation/qemu/files/qemu-5.1.0-usb-oob-CVE-2020-14364.patch
new file mode 100644
index 00000000000..d1d23ec6f0e
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.1.0-usb-oob-CVE-2020-14364.patch
@@ -0,0 +1,90 @@
+https://bugs.gentoo.org/743649
+
+From b946434f2659a182afc17e155be6791ebfb302eb Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Tue, 25 Aug 2020 07:36:36 +0200
+Subject: [PATCH] usb: fix setup_len init (CVE-2020-14364)
+
+Store calculated setup_len in a local variable, verify it, and only
+write it to the struct (USBDevice->setup_len) in case it passed the
+sanity checks.
+
+This prevents other code (do_token_{in,out} functions specifically)
+from working with invalid USBDevice->setup_len values and overrunning
+the USBDevice->setup_buf[] buffer.
+
+Fixes: CVE-2020-14364
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Tested-by: Gonglei <arei.gonglei@huawei.com>
+Reviewed-by: Li Qiang <liq3ea@gmail.com>
+Message-id: 20200825053636.29648-1-kraxel@redhat.com
+---
+ hw/usb/core.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/hw/usb/core.c b/hw/usb/core.c
+index 5abd128b6b..5234dcc73f 100644
+--- a/hw/usb/core.c
++++ b/hw/usb/core.c
+@@ -129,6 +129,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
+ static void do_token_setup(USBDevice *s, USBPacket *p)
+ {
+ int request, value, index;
++ unsigned int setup_len;
+
+ if (p->iov.size != 8) {
+ p->status = USB_RET_STALL;
+@@ -138,14 +139,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
+ usb_packet_copy(p, s->setup_buf, p->iov.size);
+ s->setup_index = 0;
+ p->actual_length = 0;
+- s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+- if (s->setup_len > sizeof(s->data_buf)) {
++ setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
++ if (setup_len > sizeof(s->data_buf)) {
+ fprintf(stderr,
+ "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
+- s->setup_len, sizeof(s->data_buf));
++ setup_len, sizeof(s->data_buf));
+ p->status = USB_RET_STALL;
+ return;
+ }
++ s->setup_len = setup_len;
+
+ request = (s->setup_buf[0] << 8) | s->setup_buf[1];
+ value = (s->setup_buf[3] << 8) | s->setup_buf[2];
+@@ -259,26 +261,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
+ static void do_parameter(USBDevice *s, USBPacket *p)
+ {
+ int i, request, value, index;
++ unsigned int setup_len;
+
+ for (i = 0; i < 8; i++) {
+ s->setup_buf[i] = p->parameter >> (i*8);
+ }
+
+ s->setup_state = SETUP_STATE_PARAM;
+- s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+ s->setup_index = 0;
+
+ request = (s->setup_buf[0] << 8) | s->setup_buf[1];
+ value = (s->setup_buf[3] << 8) | s->setup_buf[2];
+ index = (s->setup_buf[5] << 8) | s->setup_buf[4];
+
+- if (s->setup_len > sizeof(s->data_buf)) {
++ setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
++ if (setup_len > sizeof(s->data_buf)) {
+ fprintf(stderr,
+ "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
+- s->setup_len, sizeof(s->data_buf));
++ setup_len, sizeof(s->data_buf));
+ p->status = USB_RET_STALL;
+ return;
+ }
++ s->setup_len = setup_len;
+
+ if (p->pid == USB_TOKEN_OUT) {
+ usb_packet_copy(p, s->data_buf, s->setup_len);
+--
+2.28.0
+
diff --git a/app-emulation/qemu/qemu-5.1.0-r1.ebuild b/app-emulation/qemu/qemu-5.1.0-r1.ebuild
new file mode 100644
index 00000000000..7a7ac8c4847
--- /dev/null
+++ b/app-emulation/qemu/qemu-5.1.0-r1.ebuild
@@ -0,0 +1,846 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python{3_6,3_7,3_8} )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it sv tr zh_CN"
+
+FIRMWARE_ABI_VERSION="4.0.0-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+ udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
+ EGIT_SUBMODULES=(
+ tests/fp/berkeley-{test,soft}float-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://download.qemu.org/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+ +fdt glusterfs gnutls gtk infiniband iscsi io-uring
+ jack jemalloc +jpeg kernel_linux
+ kernel_FreeBSD lzo multipath
+ ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+ +slirp
+ smartcard snappy spice ssh static static-user systemtap tci test usb
+ usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
+ xfs +xkb zstd"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ avr lm32 moxie rx tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy )
+ static-user? ( !plugins )
+ virtfs? ( caps xattr )
+ vte? ( gtk )
+ plugins? ( !static !static-user )
+"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ xkb? ( x11-libs/libxkbcommon[static-libs(+)] )
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing[static-libs(+)] )
+ jack? ( virtual/jack )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ multipath? ( sys-fs/multipath-tools )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[video]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ slirp? ( net-libs/libslirp[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-201905[binary]
+ ~sys-firmware/ipxe-1.0.0_p20190728[binary]
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
+ "${FILESDIR}"/${PN}-4.2.0-cflags.patch
+ "${FILESDIR}"/${PN}-5.1.0-pixman-for-vhost-user-gpu.patch
+ "${FILESDIR}"/${PN}-5.1.0-usb-oob-CVE-2020-14364.patch #743649
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --with-confsuffix=/qemu
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-containers # bug #732972
+ --disable-guest-agent
+ --disable-strip
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable doc docs)
+ $(use_enable plugins)
+ $(use_enable tci tcg-interpreter)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
+ $(conf_notuser jemalloc jemalloc)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser multipath mpath)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser sdl-image)
+ $(conf_notuser seccomp)
+ $(conf_notuser slirp slirp system)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser vhost-user-fs)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ $(conf_notuser xkb xkbcommon)
+ $(conf_notuser zstd)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ # Note: backend order matters here: #716202
+ # We iterate from higher-level to lower level.
+ $(usex pulseaudio pa "")
+ $(usev jack)
+ $(usev sdl)
+ $(usev alsa)
+ $(usev oss)
+ )
+ conf_opts+=(
+ --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake check
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dodoc check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-11-24 8:38 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-11-24 8:38 UTC (permalink / raw
To: gentoo-commits
commit: 94eaac2fffaaf94baceb34dc3b6d24bae62476b0
Author: Michal Privoznik <mprivozn <AT> redhat <DOT> com>
AuthorDate: Tue Nov 24 07:26:19 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Nov 24 08:38:50 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94eaac2f
app-emulation/qemu: Work around libusb bug
In its 6.9.0 relelase Libvirt changed way how USB devices are
specified on QEMU's command line. While previously .hostbus= and
.hostaddr= were used they were not really good fit and often get
in way of another libvirt feature - namespaces (see
v6.9.0-rc1~456 libvirt commit for more info). The new way of
configuring USB devices is .hostdevice=/dev/bus/usb/.../... but
it exposed a bug in libusb which is worked around in qemu (see
v5.1.0-599-g202d69a715 QEMU commit for more info). Backport the
workaround for the time being. It can be dropped when we rebase
to 5.2.0.
Closes: https://bugs.gentoo.org/753305
Signed-off-by: Michal Privoznik <mprivozn <AT> redhat.com>
Closes: https://github.com/gentoo/gentoo/pull/18385
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
...qemu-5.1.0-usb-host-workaround-libusb-bug.patch | 82 ++
app-emulation/qemu/qemu-5.1.0-r3.ebuild | 860 +++++++++++++++++++++
2 files changed, 942 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-5.1.0-usb-host-workaround-libusb-bug.patch b/app-emulation/qemu/files/qemu-5.1.0-usb-host-workaround-libusb-bug.patch
new file mode 100644
index 00000000000..34a50a9bfb5
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.1.0-usb-host-workaround-libusb-bug.patch
@@ -0,0 +1,82 @@
+From 202d69a715a4b1824dcd7ec1683d027ed2bae6d3 Mon Sep 17 00:00:00 2001
+Message-Id: <202d69a715a4b1824dcd7ec1683d027ed2bae6d3.1606202550.git.mprivozn@redhat.com>
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Mon, 24 Aug 2020 13:00:57 +0200
+Subject: [PATCH] usb-host: workaround libusb bug
+
+libusb_get_device_speed() does not work for
+libusb_wrap_sys_device() devices in v1.0.23.
+
+Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1871090
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Message-id: 20200824110057.32089-1-kraxel@redhat.com
+Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
+---
+ hw/usb/host-libusb.c | 37 ++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 36 insertions(+), 1 deletion(-)
+
+diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
+index c474551d84..08604f787f 100644
+--- a/hw/usb/host-libusb.c
++++ b/hw/usb/host-libusb.c
+@@ -39,6 +39,11 @@
+ #endif
+ #include <libusb.h>
+
++#ifdef CONFIG_LINUX
++#include <sys/ioctl.h>
++#include <linux/usbdevice_fs.h>
++#endif
++
+ #include "qapi/error.h"
+ #include "migration/vmstate.h"
+ #include "monitor/monitor.h"
+@@ -885,6 +890,7 @@ static void usb_host_ep_update(USBHostDevice *s)
+ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
+ {
+ USBDevice *udev = USB_DEVICE(s);
++ int libusb_speed;
+ int bus_num = 0;
+ int addr = 0;
+ int rc;
+@@ -935,7 +941,36 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
+ usb_ep_init(udev);
+ usb_host_ep_update(s);
+
+- udev->speed = speed_map[libusb_get_device_speed(dev)];
++ libusb_speed = libusb_get_device_speed(dev);
++#ifdef CONFIG_LINUX
++ if (hostfd && libusb_speed == 0) {
++ /*
++ * Workaround libusb bug: libusb_get_device_speed() does not
++ * work for libusb_wrap_sys_device() devices in v1.0.23.
++ *
++ * Speeds are defined in linux/usb/ch9.h, file not included
++ * due to name conflicts.
++ */
++ int rc = ioctl(hostfd, USBDEVFS_GET_SPEED, NULL);
++ switch (rc) {
++ case 1: /* low */
++ libusb_speed = LIBUSB_SPEED_LOW;
++ break;
++ case 2: /* full */
++ libusb_speed = LIBUSB_SPEED_FULL;
++ break;
++ case 3: /* high */
++ case 4: /* wireless */
++ libusb_speed = LIBUSB_SPEED_HIGH;
++ break;
++ case 5: /* super */
++ case 6: /* super plus */
++ libusb_speed = LIBUSB_SPEED_SUPER;
++ break;
++ }
++ }
++#endif
++ udev->speed = speed_map[libusb_speed];
+ usb_host_speed_compat(s);
+
+ if (s->ddesc.iProduct) {
+--
+2.26.2
+
diff --git a/app-emulation/qemu/qemu-5.1.0-r3.ebuild b/app-emulation/qemu/qemu-5.1.0-r3.ebuild
new file mode 100644
index 00000000000..c273d6d0b85
--- /dev/null
+++ b/app-emulation/qemu/qemu-5.1.0-r3.ebuild
@@ -0,0 +1,860 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+PYTHON_REQ_USE="ncurses,readline"
+
+PLOCALES="bg de_DE fr_FR hu it sv tr zh_CN"
+
+FIRMWARE_ABI_VERSION="4.0.0-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+ udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
+ EGIT_SUBMODULES=(
+ tests/fp/berkeley-{test,soft}float-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://download.qemu.org/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+ +fdt glusterfs gnutls gtk infiniband iscsi io-uring
+ jack jemalloc +jpeg kernel_linux
+ kernel_FreeBSD lzo multipath
+ ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+ +slirp
+ smartcard snappy spice ssh static static-user systemtap test usb
+ usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
+ xfs +xkb zstd"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ avr lm32 moxie rx tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy )
+ static-user? ( !plugins )
+ virtfs? ( caps xattr )
+ vte? ( gtk )
+ plugins? ( !static !static-user )
+"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ xkb? ( x11-libs/libxkbcommon[static-libs(+)] )
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing:=[static-libs(+)] )
+ jack? ( virtual/jack )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ multipath? ( sys-fs/multipath-tools )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[video]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ slirp? ( net-libs/libslirp[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-201905[binary]
+ ~sys-firmware/ipxe-1.0.0_p20190728[binary]
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
+ "${FILESDIR}"/${PN}-4.2.0-cflags.patch
+ "${FILESDIR}"/${PN}-5.1.0-pixman-for-vhost-user-gpu.patch
+ "${FILESDIR}"/${PN}-5.1.0-usb-oob-CVE-2020-14364.patch #743649
+ "${FILESDIR}"/${PN}-5.1.0-usb-host-workaround-libusb-bug.patch #753305
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+handle_locales() {
+ # Make sure locale list is kept up-to-date.
+ local detected sorted
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "PLOCALES: ${sorted}"
+ eerror " po/*.po: ${detected}"
+ die "sync PLOCALES"
+ fi
+
+ # Deal with selective install of locales.
+ if use nls ; then
+ # Delete locales the user does not want. #577814
+ rm_loc() { rm po/$1.po || die; }
+ l10n_for_each_disabled_locale_do rm_loc
+ else
+ # Cheap hack to disable gettext .mo generation.
+ rm -f po/*.po
+ fi
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Run after we've applied all patches.
+ handle_locales
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --with-confsuffix=/qemu
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-containers # bug #732972
+ --disable-guest-agent
+ --disable-strip
+
+ # bug #746752: TCG interpreter has a few limitations:
+ # - it does not support FPU
+ # - it's generally slower on non-self-modifying code
+ # It's advantage is support for host architectures
+ # where native codegeneration is not implemented.
+ # Gentoo has qemu keyworded only on targets with
+ # native code generation available. Avoid the interpreter.
+ --disable-tcg-interpreter
+
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable doc docs)
+ $(use_enable plugins)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
+ $(conf_notuser jemalloc jemalloc)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser multipath mpath)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_notuser sdl-image)
+ $(conf_notuser seccomp)
+ $(conf_notuser slirp slirp system)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser vhost-user-fs)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ $(conf_notuser xkb xkbcommon)
+ $(conf_notuser zstd)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ # Note: backend order matters here: #716202
+ # We iterate from higher-level to lower level.
+ $(usex pulseaudio pa "")
+ $(usev jack)
+ $(usev sdl)
+ $(usev alsa)
+ $(usev oss)
+ )
+ conf_opts+=(
+ --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ # Plumb through equivalent of EXTRA_ECONF to allow experiments
+ # like bug #747928.
+ conf_opts+=( ${EXTRA_CONF_QEMU} )
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake check
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dodoc check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-12-10 9:02 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-12-10 9:02 UTC (permalink / raw
To: gentoo-commits
commit: 541bb02a46aa817953c29c8ffef222bbfb58ebd8
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 07:58:46 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 09:02:33 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=541bb02a
app-emulation/qemu: fix safe-stack feature detection
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
app-emulation/qemu/files/qemu-5.2.0-safe-stack.patch | 12 ++++++++++++
app-emulation/qemu/qemu-5.2.0.ebuild | 1 +
2 files changed, 13 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-5.2.0-safe-stack.patch b/app-emulation/qemu/files/qemu-5.2.0-safe-stack.patch
new file mode 100644
index 00000000000..77ed254ab98
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-safe-stack.patch
@@ -0,0 +1,12 @@
+If SafeStack fails to build it should be disabled, not enabled.
+--- a/configure
++++ b/configure
+@@ -4956,7 +4956,7 @@ if test "$safe_stack" = "no"; then
+ fi
+ else # "$safe_stack" = ""
+ # Set safe_stack to yes or no based on pre-existing flags
+- if compile_prog "-Werror" ""; then
++ if ! compile_prog "-Werror" ""; then
+ safe_stack="no"
+ else
+ safe_stack="yes"
diff --git a/app-emulation/qemu/qemu-5.2.0.ebuild b/app-emulation/qemu/qemu-5.2.0.ebuild
index 3a200179aa2..a0c14681fac 100644
--- a/app-emulation/qemu/qemu-5.2.0.ebuild
+++ b/app-emulation/qemu/qemu-5.2.0.ebuild
@@ -225,6 +225,7 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-5.2.0-safe-stack.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2020-12-14 8:46 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2020-12-14 8:46 UTC (permalink / raw
To: gentoo-commits
commit: a6189bb7d505d5020bc4031568d55835ae99dedf
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 14 08:45:52 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Dec 14 08:46:06 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6189bb7
app-emulation/qemu: use tool-prefixed 'strings'
Reported-by: Agostino Sarubbo
Closes: https://bugs.gentoo.org/759310
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
app-emulation/qemu/files/qemu-5.2.0-strings.patch | 23 +++++++++++++++++++++++
app-emulation/qemu/qemu-5.2.0-r1.ebuild | 3 ++-
app-emulation/qemu/qemu-9999.ebuild | 3 ++-
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-5.2.0-strings.patch b/app-emulation/qemu/files/qemu-5.2.0-strings.patch
new file mode 100644
index 00000000000..0b3dcdce78c
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-strings.patch
@@ -0,0 +1,23 @@
+https://bugs.gentoo.org/759310
+--- a/configure
++++ b/configure
+@@ -521,6 +521,7 @@ ld="${LD-${cross_prefix}ld}"
+ ranlib="${RANLIB-${cross_prefix}ranlib}"
+ nm="${NM-${cross_prefix}nm}"
+ strip="${STRIP-${cross_prefix}strip}"
++strings="${STRINGS-${cross_prefix}strings}"
+ windres="${WINDRES-${cross_prefix}windres}"
+ pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
+ query_pkg_config() {
+@@ -2265,9 +2266,9 @@ int main(int argc, char *argv[]) {
+ EOF
+
+ if compile_object ; then
+- if strings -a $TMPO | grep -q BiGeNdIaN ; then
++ if $strings -a $TMPO | grep -q BiGeNdIaN ; then
+ bigendian="yes"
+- elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
++ elif $strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
+ bigendian="no"
+ else
+ echo big/little test failed
diff --git a/app-emulation/qemu/qemu-5.2.0-r1.ebuild b/app-emulation/qemu/qemu-5.2.0-r1.ebuild
index 7c4861c024b..1e1391ca41b 100644
--- a/app-emulation/qemu/qemu-5.2.0-r1.ebuild
+++ b/app-emulation/qemu/qemu-5.2.0-r1.ebuild
@@ -226,6 +226,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
+ "${FILESDIR}"/${PN}-5.2.0-strings.patch
)
QA_PREBUILT="
@@ -360,7 +361,7 @@ src_prepare() {
default
# Use correct toolchain to fix cross-compiling
- tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
export WINDRES=${CHOST}-windres
# Verbose builds
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index ac31c2cc447..d9b98ce0aa0 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -224,6 +224,7 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-5.2.0-strings.patch
)
QA_PREBUILT="
@@ -358,7 +359,7 @@ src_prepare() {
default
# Use correct toolchain to fix cross-compiling
- tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
export WINDRES=${CHOST}-windres
# Verbose builds
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-01-31 9:38 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2021-01-31 9:38 UTC (permalink / raw
To: gentoo-commits
commit: 365cea28d6623c3d7a12623573147d8998cfb314
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 31 09:37:31 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan 31 09:37:57 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=365cea28
app-emulation/qemu: fix firmware paths in json files
Fixed-by: Jannik Glückert
Closes: https://bugs.gentoo.org/766743
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
.../qemu/files/qemu-5.2.0-fix-firmware-path.patch | 16 +
app-emulation/qemu/qemu-5.2.0-r2.ebuild | 858 +++++++++++++++++++++
2 files changed, 874 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-5.2.0-fix-firmware-path.patch b/app-emulation/qemu/files/qemu-5.2.0-fix-firmware-path.patch
new file mode 100644
index 00000000000..53969833795
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-fix-firmware-path.patch
@@ -0,0 +1,16 @@
+Se absolute filename in files like
+ /usr/share/qemu/firmware/50-edk2-x86_64-secure.json
+
+Bug: https://bugs.gentoo.org/766743
+Patch-by: Jannik Glückert
+--- a/pc-bios/descriptors/meson.build
++++ b/pc-bios/descriptors/meson.build
+@@ -8,7 +8,7 @@ foreach f: [
+ ]
+ configure_file(input: files(f),
+ output: f,
+- configuration: {'DATADIR': qemu_datadir},
++ configuration: {'DATADIR': get_option('prefix') / qemu_datadir},
+ install: get_option('install_blobs'),
+ install_dir: qemu_datadir / 'firmware')
+ endforeach
diff --git a/app-emulation/qemu/qemu-5.2.0-r2.ebuild b/app-emulation/qemu/qemu-5.2.0-r2.ebuild
new file mode 100644
index 00000000000..90d6bcb7da4
--- /dev/null
+++ b/app-emulation/qemu/qemu-5.2.0-r2.ebuild
@@ -0,0 +1,858 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_REQ_USE="ncurses,readline"
+
+FIRMWARE_ABI_VERSION="4.0.0-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+ udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
+ EGIT_SUBMODULES=(
+ meson
+ tests/fp/berkeley-softfloat-3
+ tests/fp/berkeley-testfloat-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://download.qemu.org/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+ +fdt glusterfs gnutls gtk infiniband iscsi io-uring
+ jack jemalloc +jpeg kernel_linux
+ kernel_FreeBSD lzo multipath
+ ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+ +slirp
+ smartcard snappy spice ssh static static-user systemtap test udev usb
+ usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
+ xfs zstd"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+ sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+ avr lm32 moxie rx tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+ aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+ tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy )
+ static-user? ( !plugins )
+ vhost-user-fs? ( caps seccomp )
+ virtfs? ( caps xattr )
+ vte? ( gtk )
+ multipath? ( udev )
+ plugins? ( !static !static-user )
+"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing:=[static-libs(+)] )
+ jack? ( virtual/jack )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ multipath? ( sys-fs/multipath-tools )
+ ncurses? (
+ sys-libs/ncurses:0=[unicode]
+ sys-libs/ncurses:0=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl,gbm]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[video]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ slirp? ( net-libs/libslirp[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ udev? ( virtual/libudev[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-201905[binary]
+ ~sys-firmware/ipxe-1.0.0_p20190728[binary,qemu]
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre8[binary]
+ )
+ !pin-upstream-blobs? (
+ sys-firmware/edk2-ovmf
+ sys-firmware/ipxe[qemu]
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC64_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-1.12.0[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-1.10.2[seavgabios]
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
+ "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
+ "${FILESDIR}"/${PN}-5.2.0-strings.patch
+ "${FILESDIR}"/${PN}-5.2.0-fix-firmware-path.patch
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
+ usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32
+"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/default-configs/targets/ >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-containers # bug #732972
+ --disable-guest-agent
+ --disable-strip
+
+ # bug #746752: TCG interpreter has a few limitations:
+ # - it does not support FPU
+ # - it's generally slower on non-self-modifying code
+ # It's advantage is support for host architectures
+ # where native codegeneration is not implemented.
+ # Gentoo has qemu keyworded only on targets with
+ # native code generation available. Avoid the interpreter.
+ --disable-tcg-interpreter
+
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable doc docs)
+ $(use_enable nls gettext)
+ $(use_enable plugins)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ # Enable option only for softmmu build, but not 'user' or 'tools'
+ conf_softmmu() {
+ if [[ ${buildtype} == "softmmu" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ # Enable option only for tools build, but not 'user' or 'softmmu'
+ conf_tools() {
+ if [[ ${buildtype} == "tools" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
+ $(conf_notuser jemalloc jemalloc)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser multipath mpath)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_softmmu sdl-image)
+ $(conf_notuser seccomp)
+ $(conf_notuser slirp slirp system)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser udev libudev)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser vhost-user-fs)
+ $(conf_tools vhost-user-fs virtiofsd)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_notuser virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ # use prebuilt keymaps, bug #759604
+ --disable-xkbcommon
+ $(conf_notuser zstd)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ # Note: backend order matters here: #716202
+ # We iterate from higher-level to lower level.
+ $(usex pulseaudio pa "")
+ $(usev jack)
+ $(usev sdl)
+ $(usev alsa)
+ $(usev oss)
+ )
+ conf_opts+=(
+ --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ # Plumb through equivalent of EXTRA_ECONF to allow experiments
+ # like bug #747928.
+ conf_opts+=( ${EXTRA_CONF_QEMU} )
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake check
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dodoc check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-01-31 14:29 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2021-01-31 14:29 UTC (permalink / raw
To: gentoo-commits
commit: 5bdcc2f808d183c45bf1ba630bd70637a0546d9f
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 31 14:29:29 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan 31 14:29:29 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5bdcc2f8
app-emulation/qemu: port fimrware path to live ebuild
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
.../qemu/files/qemu-9999-fix-firmware-path.patch | 17 +++++++++++++++++
app-emulation/qemu/qemu-9999.ebuild | 3 +--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch b/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch
new file mode 100644
index 00000000000..ffff31402b6
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch
@@ -0,0 +1,17 @@
+Set absolute filename in files like
+ /usr/share/qemu/firmware/50-edk2-x86_64-secure.json
+
+Bug: https://bugs.gentoo.org/766743
+Bug: https://bugs.launchpad.net/qemu/+bug/1913012
+Patch-by: Jannik Glückert
+--- a/pc-bios/descriptors/meson.build
++++ b/pc-bios/descriptors/meson.build
+@@ -9,7 +9,7 @@ if install_edk2_blobs
+ ]
+ configure_file(input: files(f),
+ output: f,
+- configuration: {'DATADIR': qemu_datadir},
++ configuration: {'DATADIR': get_option('prefix') / qemu_datadir},
+ install: get_option('install_blobs'),
+ install_dir: qemu_datadir / 'firmware')
+ endforeach
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 411002ffdfe..1e9063a884a 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -228,8 +228,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-5.2.0-strings.patch
"${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- #needs a whitespace tweak
- #"${FILESDIR}"/${PN}-5.2.0-fix-firmware-path.patch
+ "${FILESDIR}"/${PN}-9999-fix-firmware-path.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-02-01 18:01 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2021-02-01 18:01 UTC (permalink / raw
To: gentoo-commits
commit: 082523538c69272bd967c8d7f521687886cb97bc
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 1 18:01:27 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Feb 1 18:01:50 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08252353
app-emulation/qemu: backport bios link no-pie fix on binutils-2.36
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
.../qemu/files/qemu-5.2.0-no-pie-ld.patch | 73 ++++++++++++++++++++++
app-emulation/qemu/qemu-5.2.0-r2.ebuild | 1 +
2 files changed, 74 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch b/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch
new file mode 100644
index 00000000000..f47a58790cc
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch
@@ -0,0 +1,73 @@
+From bbd2d5a8120771ec59b86a80a1f51884e0a26e53 Mon Sep 17 00:00:00 2001
+From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Date: Mon, 14 Dec 2020 16:09:38 +0100
+Subject: [PATCH] build: -no-pie is no functional linker flag
+
+Recent binutils changes dropping unsupported options [1] caused a build
+issue in regard to the optionroms.
+
+ ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
+ -s -o multiboot.img multiboot.o
+ ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
+
+This isn't really a regression in ld.bfd, filing the bug upstream
+revealed that this never worked as a ld flag [2] - in fact it seems we
+were by accident setting --nmagic).
+
+Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
+droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
+in .mak, therefore we can also remove it from being added there.
+
+[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
+[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
+
+Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+---
+ configure | 3 ---
+ pc-bios/optionrom/Makefile | 1 -
+ 2 files changed, 4 deletions(-)
+
+--- a/configure
++++ b/configure
+@@ -2137,7 +2137,6 @@ EOF
+ # Check we support --no-pie first; we will need this for building ROMs.
+ if compile_prog "-Werror -fno-pie" "-no-pie"; then
+ CFLAGS_NOPIE="-fno-pie"
+- LDFLAGS_NOPIE="-no-pie"
+ fi
+
+ if test "$static" = "yes"; then
+@@ -2153,7 +2152,6 @@ if test "$static" = "yes"; then
+ fi
+ elif test "$pie" = "no"; then
+ CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
+- CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
+ elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
+ CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
+ CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
+@@ -6714,7 +6712,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
+ echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
+ echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
+ echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
+-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
+ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
+ echo "EXESUF=$EXESUF" >> $config_host_mak
+ echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak
+diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
+index 084fc10f05..30771f8d17 100644
+--- a/pc-bios/optionrom/Makefile
++++ b/pc-bios/optionrom/Makefile
+@@ -41,7 +41,6 @@ override CFLAGS += $(call cc-option, $(Wa)-32)
+
+ LD_I386_EMULATION ?= elf_i386
+ override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
+-override LDFLAGS += $(LDFLAGS_NOPIE)
+
+ all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
+
+--
+2.30.0
+
diff --git a/app-emulation/qemu/qemu-5.2.0-r2.ebuild b/app-emulation/qemu/qemu-5.2.0-r2.ebuild
index 90d6bcb7da4..f412ab52cd5 100644
--- a/app-emulation/qemu/qemu-5.2.0-r2.ebuild
+++ b/app-emulation/qemu/qemu-5.2.0-r2.ebuild
@@ -229,6 +229,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
"${FILESDIR}"/${PN}-5.2.0-strings.patch
"${FILESDIR}"/${PN}-5.2.0-fix-firmware-path.patch
+ "${FILESDIR}"/${PN}-5.2.0-no-pie-ld.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-04-12 19:39 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2021-04-12 19:39 UTC (permalink / raw
To: gentoo-commits
commit: 1f22be3c9c3f7ad07a7e8621713758664bcc3f75
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 12 19:12:31 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Apr 12 19:39:31 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f22be3c
app-emulation/qemu: drop upstreamed firmware path patch
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
.../qemu/files/qemu-9999-fix-firmware-path.patch | 17 -----------------
app-emulation/qemu/qemu-9999.ebuild | 1 -
2 files changed, 18 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch b/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch
deleted file mode 100644
index ffff31402b6..00000000000
--- a/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Set absolute filename in files like
- /usr/share/qemu/firmware/50-edk2-x86_64-secure.json
-
-Bug: https://bugs.gentoo.org/766743
-Bug: https://bugs.launchpad.net/qemu/+bug/1913012
-Patch-by: Jannik Glückert
---- a/pc-bios/descriptors/meson.build
-+++ b/pc-bios/descriptors/meson.build
-@@ -9,7 +9,7 @@ if install_edk2_blobs
- ]
- configure_file(input: files(f),
- output: f,
-- configuration: {'DATADIR': qemu_datadir},
-+ configuration: {'DATADIR': get_option('prefix') / qemu_datadir},
- install: get_option('install_blobs'),
- install_dir: qemu_datadir / 'firmware')
- endforeach
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index a304ad9fa12..9459f887f19 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -272,7 +272,6 @@ PATCHES=(
"${FILESDIR}"/${PN}-5.2.0-strings.patch
"${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-9999-fix-firmware-path.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-05-12 6:55 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2021-05-12 6:55 UTC (permalink / raw
To: gentoo-commits
commit: 65b728346b8f8833906f796f16bafb8361931879
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed May 12 06:54:50 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed May 12 06:55:14 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65b72834
app-emulation/qemu: apply sphinx-4 workaround
Reported-by: Ionen Wolkens
Closes: https://bugs.gentoo.org/789561
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
app-emulation/qemu/files/qemu-6.0.0-sphinx-4.patch | 35 ++++++++++++++++++++++
app-emulation/qemu/qemu-6.0.0.ebuild | 1 +
2 files changed, 36 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-6.0.0-sphinx-4.patch b/app-emulation/qemu/files/qemu-6.0.0-sphinx-4.patch
new file mode 100644
index 00000000000..2a1e6f9f5f4
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-6.0.0-sphinx-4.patch
@@ -0,0 +1,35 @@
+https://patchew.org/QEMU/20210503161422.15028-1-dgouttegattat@incenp.org/
+https://gitlab.com/qemu-project/qemu/-/issues/256
+https://bugs.gentoo.org/789561
+
+From c1155afabf1a3e093049975ba1748cf39734aa52 Mon Sep 17 00:00:00 2001
+From: Damien Goutte-Gattat via <qemu-devel@nongnu.org>
+Date: Mon, 3 May 2021 17:14:22 +0100
+Subject: [PATCH] docs: Fix installation of man pages with Sphinx 4.x
+
+The 4.x branch of Sphinx introduces a breaking change, as generated man
+pages are now written to subdirectories corresponding to the manual
+section they belong to. This results in `make install` erroring out when
+attempting to install the man pages, because they are not where it
+expects to find them.
+
+This patch restores the behavior of Sphinx 3.x regarding man pages.
+
+Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
+---
+ docs/conf.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/docs/conf.py
++++ b/docs/conf.py
+@@ -269,6 +269,7 @@
+ ['Stefan Hajnoczi <stefanha@redhat.com>',
+ 'Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>'], 1),
+ ]
++man_make_section_directory = False
+
+ # -- Options for Texinfo output -------------------------------------------
+
+--
+2.31.1
+
diff --git a/app-emulation/qemu/qemu-6.0.0.ebuild b/app-emulation/qemu/qemu-6.0.0.ebuild
index 591f58deeb8..fe66557d5cf 100644
--- a/app-emulation/qemu/qemu-6.0.0.ebuild
+++ b/app-emulation/qemu/qemu-6.0.0.ebuild
@@ -274,6 +274,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
"${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
+ "${FILESDIR}"/${PN}-6.0.0-sphinx-4.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-05-26 6:54 Sergei Trofimovich
0 siblings, 0 replies; 66+ messages in thread
From: Sergei Trofimovich @ 2021-05-26 6:54 UTC (permalink / raw
To: gentoo-commits
commit: dadb2f72c60034e5c7b339f9ea2e51d9689c6fe4
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed May 26 06:52:40 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed May 26 06:53:57 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dadb2f72
app-emulation/qemu: revert "apply sphinx-4 workaround"
This reverts commit 65b728346b8f8833906f796f16bafb8361931879.
Reported-by: Michael Moon
Bug: https://bugs.gentoo.org/789561
Bug: https://bugs.gentoo.org/791331
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
app-emulation/qemu/files/qemu-6.0.0-sphinx-4.patch | 35 ----------------------
app-emulation/qemu/qemu-6.0.0.ebuild | 1 -
2 files changed, 36 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-6.0.0-sphinx-4.patch b/app-emulation/qemu/files/qemu-6.0.0-sphinx-4.patch
deleted file mode 100644
index 2a1e6f9f5f4..00000000000
--- a/app-emulation/qemu/files/qemu-6.0.0-sphinx-4.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-https://patchew.org/QEMU/20210503161422.15028-1-dgouttegattat@incenp.org/
-https://gitlab.com/qemu-project/qemu/-/issues/256
-https://bugs.gentoo.org/789561
-
-From c1155afabf1a3e093049975ba1748cf39734aa52 Mon Sep 17 00:00:00 2001
-From: Damien Goutte-Gattat via <qemu-devel@nongnu.org>
-Date: Mon, 3 May 2021 17:14:22 +0100
-Subject: [PATCH] docs: Fix installation of man pages with Sphinx 4.x
-
-The 4.x branch of Sphinx introduces a breaking change, as generated man
-pages are now written to subdirectories corresponding to the manual
-section they belong to. This results in `make install` erroring out when
-attempting to install the man pages, because they are not where it
-expects to find them.
-
-This patch restores the behavior of Sphinx 3.x regarding man pages.
-
-Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
----
- docs/conf.py | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/docs/conf.py
-+++ b/docs/conf.py
-@@ -269,6 +269,7 @@
- ['Stefan Hajnoczi <stefanha@redhat.com>',
- 'Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>'], 1),
- ]
-+man_make_section_directory = False
-
- # -- Options for Texinfo output -------------------------------------------
-
---
-2.31.1
-
diff --git a/app-emulation/qemu/qemu-6.0.0.ebuild b/app-emulation/qemu/qemu-6.0.0.ebuild
index ddc49199235..b3bbda4c9b8 100644
--- a/app-emulation/qemu/qemu-6.0.0.ebuild
+++ b/app-emulation/qemu/qemu-6.0.0.ebuild
@@ -274,7 +274,6 @@ PATCHES=(
"${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
"${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
- "${FILESDIR}"/${PN}-6.0.0-sphinx-4.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-09-23 2:08 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2021-09-23 2:08 UTC (permalink / raw
To: gentoo-commits
commit: 197fa637eb382e4abb3b33379d093bea2f33d708
Author: John Helmert III <ajak <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 20 00:49:43 2021 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Thu Sep 23 02:08:22 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=197fa637
app-emulation/qemu: bump to 6.1.0
Closes: https://bugs.gentoo.org/804525
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
app-emulation/qemu/Manifest | 1 +
app-emulation/qemu/files/qemu-6.1.0-strings.patch | 26 ++++++++++++++++++++++
.../qemu/{qemu-9999.ebuild => qemu-6.1.0.ebuild} | 21 +++++++++--------
app-emulation/qemu/qemu-9999.ebuild | 21 +++++++++--------
4 files changed, 47 insertions(+), 22 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 4e6705f4885..6a6dd677a0e 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1 +1,2 @@
DIST qemu-6.0.0.tar.xz 107333232 BLAKE2B 7746329d3e13782b7c346ce4052cc517cfc65cd9b2d514d199e4d5b8570ca79566ec04b0c114db2e97c84e68eb551e0d4cdce1b14b91a88fe08d2a5f682c1418 SHA512 ee3ff00aebec4d8891d2ff6dabe4e667e510b2a4fe3f6190aa34673a91ea32dcd2db2e9bf94c2f1bf05aa79788f17cfbbedc6027c0988ea08a92587b79ee05e4
+DIST qemu-6.1.0.tar.xz 111258808 BLAKE2B 412eecf6d39debd6089b26d3b22e5d25c6c8c30d2eaf31b17c25cc2b3a1b10794a30218dfb151c78801aa295255aa974b297f1fe05b93f14334f203c2af5ccee SHA512 3378ae21c75b77ee6a759827f1fcf7b2a50a0fef07e3b0e89117108022a8d8655fa977e4d65596f4f24f7c735c6594d44b0c6f69732ea4465e88a7406b1d5d3c
diff --git a/app-emulation/qemu/files/qemu-6.1.0-strings.patch b/app-emulation/qemu/files/qemu-6.1.0-strings.patch
new file mode 100644
index 00000000000..2efe7b29330
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-6.1.0-strings.patch
@@ -0,0 +1,26 @@
+Forward-ported from original patch for 5.2.0.
+
+diff --git a/configure b/configure
+index da2501489f..4660ee3ee5 100755
+--- a/configure
++++ b/configure
+@@ -516,6 +516,7 @@ ld="${LD-${cross_prefix}ld}"
+ ranlib="${RANLIB-${cross_prefix}ranlib}"
+ nm="${NM-${cross_prefix}nm}"
+ strip="${STRIP-${cross_prefix}strip}"
++strings="${STRINGS-${cross_prefix}strings}"
+ windres="${WINDRES-${cross_prefix}windres}"
+ pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
+ query_pkg_config() {
+@@ -2380,9 +2381,9 @@ int main(int argc, char *argv[])
+ EOF
+
+ if compile_prog ; then
+- if strings -a $TMPE | grep -q BiGeNdIaN ; then
++ if $strings -a $TMPE | grep -q BiGeNdIaN ; then
+ bigendian="yes"
+- elif strings -a $TMPE | grep -q LiTtLeEnDiAn ; then
++ elif $strings -a $TMPE | grep -q LiTtLeEnDiAn ; then
+ bigendian="no"
+ else
+ echo big/little test failed
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-6.1.0.ebuild
similarity index 98%
copy from app-emulation/qemu/qemu-9999.ebuild
copy to app-emulation/qemu/qemu-6.1.0.ebuild
index 8aa463f41c8..d887f5b1537 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-6.1.0.ebuild
@@ -6,10 +6,10 @@ EAPI="7"
PYTHON_COMPAT=( python3_{7,8,9,10} )
PYTHON_REQ_USE="ncurses,readline"
-FIRMWARE_ABI_VERSION="6.0.0-r50"
+FIRMWARE_ABI_VERSION="6.1.0"
-inherit eutils linux-info toolchain-funcs multilib python-r1
-inherit udev fcaps readme.gentoo-r1 pax-utils xdg-utils
+inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
+ pax-utils xdg-utils
if [[ ${PV} = *9999* ]]; then
EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
@@ -75,11 +75,8 @@ COMMON_TARGETS="
IUSE_SOFTMMU_TARGETS="
${COMMON_TARGETS}
avr
- lm32
- moxie
rx
tricore
- unicore32
"
IUSE_USER_TARGETS="
${COMMON_TARGETS}
@@ -243,7 +240,10 @@ BDEPEND="
dev-lang/perl
sys-apps/texinfo
virtual/pkgconfig
- doc? ( dev-python/sphinx )
+ doc? (
+ dev-python/sphinx
+ dev-python/sphinx_rtd_theme
+ )
gtk? ( nls? ( sys-devel/gettext ) )
test? (
dev-libs/glib[utils]
@@ -273,10 +273,9 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-5.2.0-strings.patch
- "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
+ "${FILESDIR}"/${PN}-6.0.0-make.patch
+ "${FILESDIR}"/${PN}-6.1.0-strings.patch
)
QA_PREBUILT="
@@ -389,7 +388,7 @@ check_targets() {
local var=$1 mak=$2
local detected sorted
- pushd "${S}"/default-configs/targets/ >/dev/null || die
+ pushd "${S}"/configs/targets/ >/dev/null || die
# Force C locale until glibc is updated. #564936
detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 8aa463f41c8..d887f5b1537 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -6,10 +6,10 @@ EAPI="7"
PYTHON_COMPAT=( python3_{7,8,9,10} )
PYTHON_REQ_USE="ncurses,readline"
-FIRMWARE_ABI_VERSION="6.0.0-r50"
+FIRMWARE_ABI_VERSION="6.1.0"
-inherit eutils linux-info toolchain-funcs multilib python-r1
-inherit udev fcaps readme.gentoo-r1 pax-utils xdg-utils
+inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
+ pax-utils xdg-utils
if [[ ${PV} = *9999* ]]; then
EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
@@ -75,11 +75,8 @@ COMMON_TARGETS="
IUSE_SOFTMMU_TARGETS="
${COMMON_TARGETS}
avr
- lm32
- moxie
rx
tricore
- unicore32
"
IUSE_USER_TARGETS="
${COMMON_TARGETS}
@@ -243,7 +240,10 @@ BDEPEND="
dev-lang/perl
sys-apps/texinfo
virtual/pkgconfig
- doc? ( dev-python/sphinx )
+ doc? (
+ dev-python/sphinx
+ dev-python/sphinx_rtd_theme
+ )
gtk? ( nls? ( sys-devel/gettext ) )
test? (
dev-libs/glib[utils]
@@ -273,10 +273,9 @@ RDEPEND="${CDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-5.2.0-strings.patch
- "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
+ "${FILESDIR}"/${PN}-6.0.0-make.patch
+ "${FILESDIR}"/${PN}-6.1.0-strings.patch
)
QA_PREBUILT="
@@ -389,7 +388,7 @@ check_targets() {
local var=$1 mak=$2
local detected sorted
- pushd "${S}"/default-configs/targets/ >/dev/null || die
+ pushd "${S}"/configs/targets/ >/dev/null || die
# Force C locale until glibc is updated. #564936
detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-10-11 3:49 John Helmert III
0 siblings, 0 replies; 66+ messages in thread
From: John Helmert III @ 2021-10-11 3:49 UTC (permalink / raw
To: gentoo-commits
commit: 41a325ea429a98833868c9370f5ee2c7af540477
Author: John Helmert III <ajak <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 11 03:46:10 2021 +0000
Commit: John Helmert III <ajak <AT> gentoo <DOT> org>
CommitDate: Mon Oct 11 03:47:42 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41a325ea
app-emulation/qemu: fix build failure when libbpf is present
Closes: https://bugs.gentoo.org/814458
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
.../qemu/files/qemu-6.1.0-automagic-libbpf.patch | 21 +++++++++++++++++++++
app-emulation/qemu/metadata.xml | 1 +
app-emulation/qemu/qemu-6.1.0.ebuild | 5 ++++-
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/app-emulation/qemu/files/qemu-6.1.0-automagic-libbpf.patch b/app-emulation/qemu/files/qemu-6.1.0-automagic-libbpf.patch
new file mode 100644
index 00000000000..d067650dc8f
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-6.1.0-automagic-libbpf.patch
@@ -0,0 +1,21 @@
+commit 080832e4f4801a28bd1170c49e61f6a0f5f05d03
+Author: Paolo Bonzini <pbonzini@redhat.com>
+Date: Tue Sep 7 12:45:12 2021 +0200
+
+ ebpf: only include in system emulators
+
+ eBPF files are being included in user emulators, which is useless and
+ also breaks compilation because ebpf/trace-events is only processed
+ if a system emulator is included in the build.
+
+ Resolves: https://gitlab.com/qemu-project/qemu/-/issues/566
+ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+ Signed-off-by: Jason Wang <jasowang@redhat.com>
+
+diff --git a/ebpf/meson.build b/ebpf/meson.build
+index 9cd0635370..2dd0fd8948 100644
+--- a/ebpf/meson.build
++++ b/ebpf/meson.build
+@@ -1 +1 @@
+-common_ss.add(when: libbpf, if_true: files('ebpf_rss.c'), if_false: files('ebpf_rss-stub.c'))
++softmmu_ss.add(when: libbpf, if_true: files('ebpf_rss.c'), if_false: files('ebpf_rss-stub.c'))
diff --git a/app-emulation/qemu/metadata.xml b/app-emulation/qemu/metadata.xml
index 6cc5daac8dc..094f223846c 100644
--- a/app-emulation/qemu/metadata.xml
+++ b/app-emulation/qemu/metadata.xml
@@ -17,6 +17,7 @@
<flag name="accessibility">Adds support for braille displays using brltty</flag>
<flag name="aio">Enables support for Linux's Async IO</flag>
<flag name="alsa">Enable alsa output for sound emulation</flag>
+ <flag name="bpf">Enable eBPF support for RSS implementation.</flag>
<flag name="capstone">Enable disassembly support with <pkg>dev-libs/capstone</pkg></flag>
<flag name="curl">Support ISOs / -cdrom directives via HTTP or HTTPS.</flag>
<flag name="fdt">Enables firmware device tree support</flag>
diff --git a/app-emulation/qemu/qemu-6.1.0.ebuild b/app-emulation/qemu/qemu-6.1.0.ebuild
index 8365c047729..15cd2a1d294 100644
--- a/app-emulation/qemu/qemu-6.1.0.ebuild
+++ b/app-emulation/qemu/qemu-6.1.0.ebuild
@@ -32,7 +32,7 @@ HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
LICENSE="GPL-2 LGPL-2 BSD-2"
SLOT="0"
-IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug +doc
+IUSE="accessibility +aio alsa bpf bzip2 capstone +caps +curl debug +doc
+fdt fuse glusterfs gnutls gtk infiniband iscsi io-uring
jack jemalloc +jpeg kernel_linux
kernel_FreeBSD lzo multipath
@@ -142,6 +142,7 @@ SOFTMMU_TOOLS_DEPEND="
)
aio? ( dev-libs/libaio[static-libs(+)] )
alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bpf? ( dev-libs/libbpf:= )
bzip2? ( app-arch/bzip2[static-libs(+)] )
capstone? ( dev-libs/capstone:= )
caps? ( sys-libs/libcap-ng[static-libs(+)] )
@@ -276,6 +277,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
"${FILESDIR}"/${PN}-6.0.0-make.patch
"${FILESDIR}"/${PN}-6.1.0-strings.patch
+ "${FILESDIR}"/${P}-automagic-libbpf.patch
)
QA_PREBUILT="
@@ -501,6 +503,7 @@ qemu_src_configure() {
conf_opts+=(
$(conf_notuser accessibility brlapi)
$(conf_notuser aio linux-aio)
+ $(conf_softmmu bpf)
$(conf_notuser bzip2)
$(conf_notuser capstone)
$(conf_notuser caps cap-ng)
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-12-08 1:23 John Helmert III
0 siblings, 0 replies; 66+ messages in thread
From: John Helmert III @ 2021-12-08 1:23 UTC (permalink / raw
To: gentoo-commits
commit: aa5822554186cff978a26ec01ebe4a0806ad0ed4
Author: John Helmert III <ajak <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 8 01:19:11 2021 +0000
Commit: John Helmert III <ajak <AT> gentoo <DOT> org>
CommitDate: Wed Dec 8 01:21:11 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa582255
app-emulation/qemu: add potential patch for data corruption bug
Bug: https://bugs.gentoo.org/815379
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
.../qemu/files/qemu-6.1.0-data-corruption.patch | 114 +++
app-emulation/qemu/qemu-6.1.0-r2.ebuild | 913 +++++++++++++++++++++
2 files changed, 1027 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-6.1.0-data-corruption.patch b/app-emulation/qemu/files/qemu-6.1.0-data-corruption.patch
new file mode 100644
index 000000000000..25c788426a9c
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-6.1.0-data-corruption.patch
@@ -0,0 +1,114 @@
+commit cc071629539dc1f303175a7e2d4ab854c0a8b20f
+Author: Paolo Bonzini <pbonzini@redhat.com>
+Date: Thu Sep 23 09:04:36 2021 -0400
+
+ block: introduce max_hw_iov for use in scsi-generic
+
+ Linux limits the size of iovecs to 1024 (UIO_MAXIOV in the kernel
+ sources, IOV_MAX in POSIX). Because of this, on some host adapters
+ requests with many iovecs are rejected with -EINVAL by the
+ io_submit() or readv()/writev() system calls.
+
+ In fact, the same limit applies to SG_IO as well. To fix both the
+ EINVAL and the possible performance issues from using fewer iovecs
+ than allowed by Linux (some HBAs have max_segments as low as 128),
+ introduce a separate entry in BlockLimits to hold the max_segments
+ value from sysfs. This new limit is used only for SG_IO and clamped
+ to bs->bl.max_iov anyway, just like max_hw_transfer is clamped to
+ bs->bl.max_transfer.
+
+ Reported-by: Halil Pasic <pasic@linux.ibm.com>
+ Cc: Hanna Reitz <hreitz@redhat.com>
+ Cc: Kevin Wolf <kwolf@redhat.com>
+ Cc: qemu-block@nongnu.org
+ Cc: qemu-stable@nongnu.org
+ Fixes: 18473467d5 ("file-posix: try BLKSECTGET on block devices too, do not round to power of 2", 2021-06-25)
+ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+ Message-Id: <20210923130436.1187591-1-pbonzini@redhat.com>
+ Signed-off-by: Kevin Wolf <kwolf@redhat.com>
+
+diff --git a/block/block-backend.c b/block/block-backend.c
+index 6140d133e2..ba2b5ebb10 100644
+--- a/block/block-backend.c
++++ b/block/block-backend.c
+@@ -1986,6 +1986,12 @@ uint32_t blk_get_max_transfer(BlockBackend *blk)
+ return ROUND_DOWN(max, blk_get_request_alignment(blk));
+ }
+
++int blk_get_max_hw_iov(BlockBackend *blk)
++{
++ return MIN_NON_ZERO(blk->root->bs->bl.max_hw_iov,
++ blk->root->bs->bl.max_iov);
++}
++
+ int blk_get_max_iov(BlockBackend *blk)
+ {
+ return blk->root->bs->bl.max_iov;
+diff --git a/block/file-posix.c b/block/file-posix.c
+index c62e42743d..53be0bdc1b 100644
+--- a/block/file-posix.c
++++ b/block/file-posix.c
+@@ -1273,7 +1273,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
+
+ ret = hdev_get_max_segments(s->fd, &st);
+ if (ret > 0) {
+- bs->bl.max_iov = ret;
++ bs->bl.max_hw_iov = ret;
+ }
+ }
+ }
+diff --git a/block/io.c b/block/io.c
+index 18d345a87a..bb0a254def 100644
+--- a/block/io.c
++++ b/block/io.c
+@@ -136,6 +136,7 @@ static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src)
+ dst->min_mem_alignment = MAX(dst->min_mem_alignment,
+ src->min_mem_alignment);
+ dst->max_iov = MIN_NON_ZERO(dst->max_iov, src->max_iov);
++ dst->max_hw_iov = MIN_NON_ZERO(dst->max_hw_iov, src->max_hw_iov);
+ }
+
+ typedef struct BdrvRefreshLimitsState {
+diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
+index 665baf900e..0306ccc7b1 100644
+--- a/hw/scsi/scsi-generic.c
++++ b/hw/scsi/scsi-generic.c
+@@ -180,7 +180,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
+ page = r->req.cmd.buf[2];
+ if (page == 0xb0) {
+ uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
+- uint32_t max_iov = blk_get_max_iov(s->conf.blk);
++ uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
+
+ assert(max_transfer);
+ max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size)
+diff --git a/include/block/block_int.h b/include/block/block_int.h
+index ffe86068d4..f4c75e8ba9 100644
+--- a/include/block/block_int.h
++++ b/include/block/block_int.h
+@@ -718,6 +718,13 @@ typedef struct BlockLimits {
+ */
+ uint64_t max_hw_transfer;
+
++ /* Maximal number of scatter/gather elements allowed by the hardware.
++ * Applies whenever transfers to the device bypass the kernel I/O
++ * scheduler, for example with SG_IO. If larger than max_iov
++ * or if zero, blk_get_max_hw_iov will fall back to max_iov.
++ */
++ int max_hw_iov;
++
+ /* memory alignment, in bytes so that no bounce buffer is needed */
+ size_t min_mem_alignment;
+
+diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
+index 29d4fdbf63..82bae55161 100644
+--- a/include/sysemu/block-backend.h
++++ b/include/sysemu/block-backend.h
+@@ -211,6 +211,7 @@ uint32_t blk_get_request_alignment(BlockBackend *blk);
+ uint32_t blk_get_max_transfer(BlockBackend *blk);
+ uint64_t blk_get_max_hw_transfer(BlockBackend *blk);
+ int blk_get_max_iov(BlockBackend *blk);
++int blk_get_max_hw_iov(BlockBackend *blk);
+ void blk_set_guest_block_size(BlockBackend *blk, int align);
+ void *blk_try_blockalign(BlockBackend *blk, size_t size);
+ void *blk_blockalign(BlockBackend *blk, size_t size);
diff --git a/app-emulation/qemu/qemu-6.1.0-r2.ebuild b/app-emulation/qemu/qemu-6.1.0-r2.ebuild
new file mode 100644
index 000000000000..3882becdca90
--- /dev/null
+++ b/app-emulation/qemu/qemu-6.1.0-r2.ebuild
@@ -0,0 +1,913 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python3_{7,8,9,10} )
+PYTHON_REQ_USE="ncurses,readline"
+
+FIRMWARE_ABI_VERSION="6.1.0"
+
+inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
+ pax-utils xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+ EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
+ EGIT_SUBMODULES=(
+ meson
+ tests/fp/berkeley-softfloat-3
+ tests/fp/berkeley-testfloat-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://download.qemu.org/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+IUSE="accessibility +aio alsa bpf bzip2 capstone +caps +curl debug +doc
+ +fdt fuse glusterfs gnutls gtk infiniband iscsi io-uring
+ jack jemalloc +jpeg kernel_linux
+ kernel_FreeBSD lzo multipath
+ ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+ +slirp
+ smartcard snappy spice ssh static static-user systemtap test udev usb
+ usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
+ xfs zstd"
+
+COMMON_TARGETS="
+ aarch64
+ alpha
+ arm
+ cris
+ hppa
+ i386
+ m68k
+ microblaze
+ microblazeel
+ mips
+ mips64
+ mips64el
+ mipsel
+ nios2
+ or1k
+ ppc
+ ppc64
+ riscv32
+ riscv64
+ s390x
+ sh4
+ sh4eb
+ sparc
+ sparc64
+ x86_64
+ xtensa
+ xtensaeb
+"
+IUSE_SOFTMMU_TARGETS="
+ ${COMMON_TARGETS}
+ avr
+ rx
+ tricore
+"
+IUSE_USER_TARGETS="
+ ${COMMON_TARGETS}
+ aarch64_be
+ armeb
+ hexagon
+ mipsn32
+ mipsn32el
+ ppc64abi32
+ ppc64le
+ sparc32plus
+"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ sdl-image? ( sdl )
+ static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy !udev )
+ static-user? ( !plugins )
+ vhost-user-fs? ( caps seccomp )
+ virgl? ( opengl )
+ virtfs? ( caps xattr )
+ vte? ( gtk )
+ multipath? ( udev )
+ plugins? ( !static !static-user )
+"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ >=dev-libs/glib-2.0[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ dev-libs/libxml2[static-libs(+)]
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bpf? ( dev-libs/libbpf:= )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:= )
+ caps? ( sys-libs/libcap-ng[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ dev-libs/nettle:=[static-libs(+)]
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/gtk+:3
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? (
+ sys-fabric/libibumad:=[static-libs(+)]
+ sys-fabric/libibverbs:=[static-libs(+)]
+ sys-fabric/librdmacm:=[static-libs(+)]
+ )
+ iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing:=[static-libs(+)] )
+ jack? ( virtual/jack )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ multipath? ( sys-fs/multipath-tools )
+ ncurses? (
+ sys-libs/ncurses:=[unicode(+)]
+ sys-libs/ncurses:=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl(+),gbm(+)]
+ )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-sound/pulseaudio )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[video]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ slirp? ( net-libs/libslirp[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ udev? ( virtual/libudev:= )
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
+
+EDK2_OVMF_VERSION="202105"
+SEABIOS_VERSION="1.14.0"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}[binary]
+ ~sys-firmware/ipxe-1.21.1[binary,qemu]
+ ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
+ ~sys-firmware/sgabios-0.1_pre10[binary]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}
+ sys-firmware/ipxe[qemu]
+ >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
+ sys-firmware/sgabios
+ )"
+PPC_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
+ )
+ !pin-upstream-blobs? (
+ >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? (
+ dev-python/sphinx[${PYTHON_USEDEP}]
+ dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
+ )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+ "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
+ "${FILESDIR}"/${PN}-6.0.0-make.patch
+ "${FILESDIR}"/${PN}-6.1.0-strings.patch
+ "${FILESDIR}"/${P}-automagic-libbpf.patch
+ "${FILESDIR}"/${P}-data-corruption.patch
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
+ usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-ppc64abi32
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32
+"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/configs/targets/ >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # Remove bundled copy of libfdt
+ rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}"
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-containers # bug #732972
+ --disable-guest-agent
+ --disable-strip
+
+ # bug #746752: TCG interpreter has a few limitations:
+ # - it does not support FPU
+ # - it's generally slower on non-self-modifying code
+ # It's advantage is support for host architectures
+ # where native codegeneration is not implemented.
+ # Gentoo has qemu keyworded only on targets with
+ # native code generation available. Avoid the interpreter.
+ --disable-tcg-interpreter
+
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --python="${PYTHON}"
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable doc docs)
+ $(use_enable nls gettext)
+ $(use_enable plugins)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ # Enable option only for softmmu build, but not 'user' or 'tools'
+ conf_softmmu() {
+ if [[ ${buildtype} == "softmmu" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ # Enable option only for tools build, but not 'user' or 'softmmu'
+ conf_tools() {
+ if [[ ${buildtype} == "tools" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_softmmu bpf)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser caps cap-ng)
+ $(conf_notuser curl)
+ $(conf_notuser fdt)
+ $(conf_notuser fuse)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
+ $(conf_notuser jemalloc jemalloc)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser multipath mpath)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser png vnc-png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_softmmu sdl-image)
+ $(conf_notuser seccomp)
+ $(conf_notuser slirp slirp system)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser udev libudev)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser vhost-user-fs)
+ $(conf_tools vhost-user-fs virtiofsd)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ $(conf_notuser xfs xfsctl)
+ # use prebuilt keymaps, bug #759604
+ --disable-xkbcommon
+ $(conf_notuser zstd)
+ )
+
+ if [[ ${buildtype} == "user" ]] ; then
+ conf_opts+=( --disable-libxml2 )
+ else
+ conf_opts+=( --enable-libxml2 )
+ fi
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ # Note: backend order matters here: #716202
+ # We iterate from higher-level to lower level.
+ $(usex pulseaudio pa "")
+ $(usev jack)
+ $(usev sdl)
+ $(usev alsa)
+ $(usev oss)
+ )
+ conf_opts+=(
+ --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ # Meson will not use a cross-file unless cross_prefix is set.
+ tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
+
+ # Plumb through equivalent of EXTRA_ECONF to allow experiments
+ # like bug #747928.
+ conf_opts+=( ${EXTRA_CONF_QEMU} )
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+
+ # FreeBSD's kernel does not support QEMU assigning/grabbing
+ # host USB devices yet
+ use kernel_FreeBSD && \
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ default
+ fi
+
+ cd "${S}/tools-build"
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ pax-mark m */qemu-system-* #515550
+ emake check
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dodoc check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build"
+ emake DESTDIR="${ED}" install
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}"
+ dodoc MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ rm "${ED}/usr/share/qemu/bios.bin"
+ rm "${ED}/usr/share/qemu/bios-256k.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+ # PPC/PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ rm "${ED}/usr/share/qemu/sgabios.bin"
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ rm "${ED}"/usr/share/qemu/pxe-*.rom
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/seabios)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/seabios)"
+ if has_version 'sys-firmware/seabios[binary]'; then
+ echo " USE=binary"
+ else
+ echo " USE=''"
+ fi
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2021-12-20 6:42 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2021-12-20 6:42 UTC (permalink / raw
To: gentoo-commits
commit: d4dbabb19b26f4203d67e25f78772c5bebf650ff
Author: John Helmert III <ajak <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 20 04:31:40 2021 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Mon Dec 20 06:42:24 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4dbabb1
app-emulation/qemu: drop 6.0.0-r4, 6.0.0-r54, 6.0.1-r1
Bug: https://bugs.gentoo.org/807055
Bug: https://bugs.gentoo.org/820743
Closes: https://github.com/gentoo/gentoo/pull/23421
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
app-emulation/qemu/Manifest | 2 -
.../qemu/files/qemu-5.2.0-cleaner-werror.patch | 40 -
.../qemu/files/qemu-5.2.0-dce-locks.patch | 18 -
app-emulation/qemu/files/qemu-5.2.0-strings.patch | 23 -
app-emulation/qemu/qemu-6.0.0-r4.ebuild | 910 --------------------
app-emulation/qemu/qemu-6.0.0-r54.ebuild | 911 ---------------------
app-emulation/qemu/qemu-6.0.1-r1.ebuild | 911 ---------------------
7 files changed, 2815 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 2e25d84139b6..94a4f3c94cb0 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,4 +1,2 @@
-DIST qemu-6.0.0.tar.xz 107333232 BLAKE2B 7746329d3e13782b7c346ce4052cc517cfc65cd9b2d514d199e4d5b8570ca79566ec04b0c114db2e97c84e68eb551e0d4cdce1b14b91a88fe08d2a5f682c1418 SHA512 ee3ff00aebec4d8891d2ff6dabe4e667e510b2a4fe3f6190aa34673a91ea32dcd2db2e9bf94c2f1bf05aa79788f17cfbbedc6027c0988ea08a92587b79ee05e4
-DIST qemu-6.0.1.tar.xz 107084292 BLAKE2B 53f4adc1a4ba99aaf03659db499d557c57d0c2559955980591594bf0ed06aaf485f0192d7f8f68338b97e0d4d0a114e4431bae5e5b3f3fc82aef08616429d8ed SHA512 2e37ae97a56c4de71412ebabe0e0a59908a7ca7d353440e046831319456d4020614f0909af07cb2a8bb23423e84880a89b5aa4e463e95d1ad37a64fbf8021337
DIST qemu-6.1.0.tar.xz 111258808 BLAKE2B 412eecf6d39debd6089b26d3b22e5d25c6c8c30d2eaf31b17c25cc2b3a1b10794a30218dfb151c78801aa295255aa974b297f1fe05b93f14334f203c2af5ccee SHA512 3378ae21c75b77ee6a759827f1fcf7b2a50a0fef07e3b0e89117108022a8d8655fa977e4d65596f4f24f7c735c6594d44b0c6f69732ea4465e88a7406b1d5d3c
DIST qemu-6.2.0.tar.xz 115667324 BLAKE2B 3f2f02e5c36113df6231a9474c6d5db774e541312173813c28f578d669a51f391695d364dc806f5906d9e3c2796bb20b2606fcd46a247eb751ea517de9d7ce15 SHA512 e9f8231c9e1cfcc41cb47f10a55d63f6b8aee307af00cf6acf64acb7aa4f49fa7e9d6330703a2abea15d8b7bbaba7d3cb08c83edd98d82642367b527df730817
diff --git a/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch b/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch
deleted file mode 100644
index 33115f1df480..000000000000
--- a/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch
+++ /dev/null
@@ -1,40 +0,0 @@
--Wall -Wextra compains about unused arguments,
-causes safe-stack to be mis-detected.
---- a/configure
-+++ b/configure
-@@ -2293,7 +2293,7 @@ fi
- cat > $TMPC << EOF
- #include <stdint.h>
- #include <stdio.h>
--int main(int argc, char *argv[]) {
-+int main(void) {
- return printf("%zu", SIZE_MAX);
- }
- EOF
-@@ -4911,7 +4911,7 @@ fi
-
- if test "$safe_stack" = "yes"; then
- cat > $TMPC << EOF
--int main(int argc, char *argv[])
-+int main(void)
- {
- #if ! __has_feature(safe_stack)
- #error SafeStack Disabled
-@@ -4933,7 +4933,7 @@ EOF
- fi
- else
- cat > $TMPC << EOF
--int main(int argc, char *argv[])
-+int main(void)
- {
- #if defined(__has_feature)
- #if __has_feature(safe_stack)
-@@ -5283,7 +5283,7 @@ static const int Z = 1;
- #define TAUT(X) ((X) == Z)
- #define PAREN(X, Y) (X == Y)
- #define ID(X) (X)
--int main(int argc, char *argv[])
-+int main(void)
- {
- int x = 0, y = 0;
- x = ID(x);
diff --git a/app-emulation/qemu/files/qemu-5.2.0-dce-locks.patch b/app-emulation/qemu/files/qemu-5.2.0-dce-locks.patch
deleted file mode 100644
index 679a9f391b0b..000000000000
--- a/app-emulation/qemu/files/qemu-5.2.0-dce-locks.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Fix CFLAGS=-Og build break. -Og fails because gcc does not enable dead
-code elimination (but does set __OPTIMIZE__ define).
-
-The fix avoids DCE reliance downstream entirely.
-
-Reported-by: Luke-Jr
-Bug: https://bugs.gentoo.org/782364
---- a/include/qemu/lockable.h
-+++ b/include/qemu/lockable.h
-@@ -28,7 +28,7 @@ struct QemuLockable {
- * to QEMU_MAKE_LOCKABLE. For optimized builds, we can rely on dead-code elimination
- * from the compiler, and give the errors already at link time.
- */
--#if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__)
-+#if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__) && defined(VALIDATE_LOCKS_VIA_DCE)
- void unknown_lock_type(void *);
- #else
- static inline void unknown_lock_type(void *unused)
diff --git a/app-emulation/qemu/files/qemu-5.2.0-strings.patch b/app-emulation/qemu/files/qemu-5.2.0-strings.patch
deleted file mode 100644
index 0b3dcdce78c9..000000000000
--- a/app-emulation/qemu/files/qemu-5.2.0-strings.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-https://bugs.gentoo.org/759310
---- a/configure
-+++ b/configure
-@@ -521,6 +521,7 @@ ld="${LD-${cross_prefix}ld}"
- ranlib="${RANLIB-${cross_prefix}ranlib}"
- nm="${NM-${cross_prefix}nm}"
- strip="${STRIP-${cross_prefix}strip}"
-+strings="${STRINGS-${cross_prefix}strings}"
- windres="${WINDRES-${cross_prefix}windres}"
- pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
- query_pkg_config() {
-@@ -2265,9 +2266,9 @@ int main(int argc, char *argv[]) {
- EOF
-
- if compile_object ; then
-- if strings -a $TMPO | grep -q BiGeNdIaN ; then
-+ if $strings -a $TMPO | grep -q BiGeNdIaN ; then
- bigendian="yes"
-- elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
-+ elif $strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
- bigendian="no"
- else
- echo big/little test failed
diff --git a/app-emulation/qemu/qemu-6.0.0-r4.ebuild b/app-emulation/qemu/qemu-6.0.0-r4.ebuild
deleted file mode 100644
index a80aca052305..000000000000
--- a/app-emulation/qemu/qemu-6.0.0-r4.ebuild
+++ /dev/null
@@ -1,910 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-PYTHON_REQ_USE="ncurses,readline"
-
-FIRMWARE_ABI_VERSION="5.2.0-r50"
-
-inherit eutils linux-info toolchain-funcs multilib python-r1
-inherit udev fcaps readme.gentoo-r1 pax-utils xdg-utils
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
- EGIT_SUBMODULES=(
- meson
- tests/fp/berkeley-softfloat-3
- tests/fp/berkeley-testfloat-3
- ui/keycodemapdb
- )
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="amd64 arm64 ~ppc ppc64 x86"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-
-IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug +doc
- +fdt fuse glusterfs gnutls gtk infiniband iscsi io-uring
- jack jemalloc +jpeg kernel_linux
- kernel_FreeBSD lzo multipath
- ncurses nfs nls numa opengl +oss +pin-upstream-blobs
- plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
- +slirp
- smartcard snappy spice ssh static static-user systemtap test udev usb
- usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs zstd"
-
-COMMON_TARGETS="
- aarch64
- alpha
- arm
- cris
- hppa
- i386
- m68k
- microblaze
- microblazeel
- mips
- mips64
- mips64el
- mipsel
- nios2
- or1k
- ppc
- ppc64
- riscv32
- riscv64
- s390x
- sh4
- sh4eb
- sparc
- sparc64
- x86_64
- xtensa
- xtensaeb
-"
-IUSE_SOFTMMU_TARGETS="
- ${COMMON_TARGETS}
- avr
- lm32
- moxie
- rx
- tricore
- unicore32
-"
-IUSE_USER_TARGETS="
- ${COMMON_TARGETS}
- aarch64_be
- armeb
- hexagon
- mipsn32
- mipsn32el
- ppc64abi32
- ppc64le
- sparc32plus
-"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-RESTRICT="!test? ( test )"
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_riscv32? ( fdt )
- qemu_softmmu_targets_riscv64? ( fdt )
- sdl-image? ( sdl )
- static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy !udev )
- static-user? ( !plugins )
- vhost-user-fs? ( caps seccomp )
- virgl? ( opengl )
- virtfs? ( caps xattr )
- vte? ( gtk )
- multipath? ( udev )
- plugins? ( !static !static-user )
-"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the external library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- dev-libs/libxml2[static-libs(+)]
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- capstone? ( dev-libs/capstone:= )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
- fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- infiniband? (
- sys-fabric/libibumad:=[static-libs(+)]
- sys-fabric/libibverbs:=[static-libs(+)]
- sys-fabric/librdmacm:=[static-libs(+)]
- )
- iscsi? ( net-libs/libiscsi )
- io-uring? ( sys-libs/liburing:=[static-libs(+)] )
- jack? ( virtual/jack )
- jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- multipath? ( sys-fs/multipath-tools )
- ncurses? (
- sys-libs/ncurses:=[unicode(+)]
- sys-libs/ncurses:=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl(+),gbm(+)]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- media-libs/libsdl2[video]
- media-libs/libsdl2[static-libs(+)]
- )
- sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- slirp? ( net-libs/libslirp[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:= )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
- udev? ( virtual/libudev:= )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )
- zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
-"
-
-SEABIOS_VERSION="1.14.0"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-202008[binary]
- ~sys-firmware/ipxe-1.21.1[binary,qemu]
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre10[binary]
- )
- !pin-upstream-blobs? (
- sys-firmware/edk2-ovmf
- sys-firmware/ipxe[qemu]
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- sys-firmware/sgabios
- )"
-PPC_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- )
-"
-
-BDEPEND="
- $(python_gen_impl_dep)
- dev-lang/perl
- sys-apps/texinfo
- virtual/pkgconfig
- doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
- gtk? ( nls? ( sys-devel/gettext ) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )
-"
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )"
-RDEPEND="${CDEPEND}
- acct-group/kvm
- selinux? ( sec-policy/selinux-qemu )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-5.2.0-strings.patch
- "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
- "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
- "${FILESDIR}"/${PN}-6.0.0-make.patch
-)
-
-QA_PREBUILT="
- usr/share/qemu/hppa-firmware.img
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
- usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32
-"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs/targets/ >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- default
-
- # Use correct toolchain to fix cross-compiling
- tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
- export WINDRES=${CHOST}-windres
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --bindir=/usr/bin
- --libdir=/usr/$(get_libdir)
- --datadir=/usr/share
- --docdir=/usr/share/doc/${PF}/html
- --mandir=/usr/share/man
- --localstatedir=/var
- --disable-bsd-user
- --disable-containers # bug #732972
- --disable-guest-agent
- --disable-strip
-
- # bug #746752: TCG interpreter has a few limitations:
- # - it does not support FPU
- # - it's generally slower on non-self-modifying code
- # It's advantage is support for host architectures
- # where native codegeneration is not implemented.
- # Gentoo has qemu keyworded only on targets with
- # native code generation available. Avoid the interpreter.
- --disable-tcg-interpreter
-
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- $(use_enable doc docs)
- $(use_enable nls gettext)
- $(use_enable plugins)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- # Enable option only for softmmu build, but not 'user' or 'tools'
- conf_softmmu() {
- if [[ ${buildtype} == "softmmu" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Enable option only for tools build, but not 'user' or 'softmmu'
- conf_tools() {
- if [[ ${buildtype} == "tools" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- conf_opts+=(
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_notuser bzip2)
- $(conf_notuser capstone)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_notuser fdt)
- $(conf_notuser fuse)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser io-uring linux-io-uring)
- $(conf_notuser jemalloc jemalloc)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser multipath mpath)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_softmmu sdl-image)
- $(conf_notuser seccomp)
- $(conf_notuser slirp slirp system)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh)
- $(conf_notuser udev libudev)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser vhost-user-fs)
- $(conf_tools vhost-user-fs virtiofsd)
- $(conf_notuser virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- # use prebuilt keymaps, bug #759604
- --disable-xkbcommon
- $(conf_notuser zstd)
- )
-
- if [[ ${buildtype} == "user" ]] ; then
- conf_opts+=( --disable-libxml2 )
- else
- conf_opts+=( --enable-libxml2 )
- fi
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts=(
- # Note: backend order matters here: #716202
- # We iterate from higher-level to lower level.
- $(usex pulseaudio pa "")
- $(usev jack)
- $(usev sdl)
- $(usev alsa)
- $(usev oss)
- )
- conf_opts+=(
- --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
- )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- # Meson will not use a cross-file unless cross_prefix is set.
- tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
-
- # Plumb through equivalent of EXTRA_ECONF to allow experiments
- # like bug #747928.
- conf_opts+=( ${EXTRA_CONF_QEMU} )
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake check
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/python/qemu"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- # we use 'printf' here to be portable across 'sh'
- # implementations: #679168
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dodoc check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- # Disallow stripping of prebuilt firmware files.
- dostrip -x ${QA_PREBUILT}
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC/PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- xdg_icon_cache_update
-
- [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
-
-pkg_postrm() {
- xdg_icon_cache_update
-}
diff --git a/app-emulation/qemu/qemu-6.0.0-r54.ebuild b/app-emulation/qemu/qemu-6.0.0-r54.ebuild
deleted file mode 100644
index 2f54662694fa..000000000000
--- a/app-emulation/qemu/qemu-6.0.0-r54.ebuild
+++ /dev/null
@@ -1,911 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-PYTHON_REQ_USE="ncurses,readline"
-
-FIRMWARE_ABI_VERSION="6.0.0-r50"
-
-inherit eutils linux-info toolchain-funcs multilib python-r1
-inherit udev fcaps readme.gentoo-r1 pax-utils xdg-utils
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
- EGIT_SUBMODULES=(
- meson
- tests/fp/berkeley-softfloat-3
- tests/fp/berkeley-testfloat-3
- ui/keycodemapdb
- )
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="amd64 arm64 ~ppc ppc64 x86"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-
-IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug +doc
- +fdt fuse glusterfs gnutls gtk infiniband iscsi io-uring
- jack jemalloc +jpeg kernel_linux
- kernel_FreeBSD lzo multipath
- ncurses nfs nls numa opengl +oss +pin-upstream-blobs
- plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
- +slirp
- smartcard snappy spice ssh static static-user systemtap test udev usb
- usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs zstd"
-
-COMMON_TARGETS="
- aarch64
- alpha
- arm
- cris
- hppa
- i386
- m68k
- microblaze
- microblazeel
- mips
- mips64
- mips64el
- mipsel
- nios2
- or1k
- ppc
- ppc64
- riscv32
- riscv64
- s390x
- sh4
- sh4eb
- sparc
- sparc64
- x86_64
- xtensa
- xtensaeb
-"
-IUSE_SOFTMMU_TARGETS="
- ${COMMON_TARGETS}
- avr
- lm32
- moxie
- rx
- tricore
- unicore32
-"
-IUSE_USER_TARGETS="
- ${COMMON_TARGETS}
- aarch64_be
- armeb
- hexagon
- mipsn32
- mipsn32el
- ppc64abi32
- ppc64le
- sparc32plus
-"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-RESTRICT="!test? ( test )"
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_riscv32? ( fdt )
- qemu_softmmu_targets_riscv64? ( fdt )
- sdl-image? ( sdl )
- static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy !udev )
- static-user? ( !plugins )
- vhost-user-fs? ( caps seccomp )
- virgl? ( opengl )
- virtfs? ( caps xattr )
- vte? ( gtk )
- multipath? ( udev )
- plugins? ( !static !static-user )
-"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the external library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- dev-libs/libxml2[static-libs(+)]
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- capstone? ( dev-libs/capstone:= )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
- fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- infiniband? (
- sys-fabric/libibumad:=[static-libs(+)]
- sys-fabric/libibverbs:=[static-libs(+)]
- sys-fabric/librdmacm:=[static-libs(+)]
- )
- iscsi? ( net-libs/libiscsi )
- io-uring? ( sys-libs/liburing:=[static-libs(+)] )
- jack? ( virtual/jack )
- jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- multipath? ( sys-fs/multipath-tools )
- ncurses? (
- sys-libs/ncurses:=[unicode(+)]
- sys-libs/ncurses:=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl(+),gbm(+)]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- media-libs/libsdl2[video]
- media-libs/libsdl2[static-libs(+)]
- )
- sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- slirp? ( net-libs/libslirp[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:= )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
- udev? ( virtual/libudev:= )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )
- zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
-"
-
-EDK2_OVMF_VERSION="202105"
-SEABIOS_VERSION="1.14.0"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}[binary]
- ~sys-firmware/ipxe-1.21.1[binary,qemu]
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre10[binary]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}
- sys-firmware/ipxe[qemu]
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- sys-firmware/sgabios
- )"
-PPC_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- )
-"
-
-BDEPEND="
- $(python_gen_impl_dep)
- dev-lang/perl
- sys-apps/texinfo
- virtual/pkgconfig
- doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
- gtk? ( nls? ( sys-devel/gettext ) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )
-"
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )"
-RDEPEND="${CDEPEND}
- acct-group/kvm
- selinux? ( sec-policy/selinux-qemu )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-5.2.0-strings.patch
- "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
- "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
- "${FILESDIR}"/${PN}-6.0.0-make.patch
-)
-
-QA_PREBUILT="
- usr/share/qemu/hppa-firmware.img
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
- usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32
-"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs/targets/ >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- default
-
- # Use correct toolchain to fix cross-compiling
- tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
- export WINDRES=${CHOST}-windres
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --bindir=/usr/bin
- --libdir=/usr/$(get_libdir)
- --datadir=/usr/share
- --docdir=/usr/share/doc/${PF}/html
- --mandir=/usr/share/man
- --localstatedir=/var
- --disable-bsd-user
- --disable-containers # bug #732972
- --disable-guest-agent
- --disable-strip
-
- # bug #746752: TCG interpreter has a few limitations:
- # - it does not support FPU
- # - it's generally slower on non-self-modifying code
- # It's advantage is support for host architectures
- # where native codegeneration is not implemented.
- # Gentoo has qemu keyworded only on targets with
- # native code generation available. Avoid the interpreter.
- --disable-tcg-interpreter
-
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- $(use_enable doc docs)
- $(use_enable nls gettext)
- $(use_enable plugins)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- # Enable option only for softmmu build, but not 'user' or 'tools'
- conf_softmmu() {
- if [[ ${buildtype} == "softmmu" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Enable option only for tools build, but not 'user' or 'softmmu'
- conf_tools() {
- if [[ ${buildtype} == "tools" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- conf_opts+=(
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_notuser bzip2)
- $(conf_notuser capstone)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_notuser fdt)
- $(conf_notuser fuse)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser io-uring linux-io-uring)
- $(conf_notuser jemalloc jemalloc)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser multipath mpath)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_softmmu sdl-image)
- $(conf_notuser seccomp)
- $(conf_notuser slirp slirp system)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh)
- $(conf_notuser udev libudev)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser vhost-user-fs)
- $(conf_tools vhost-user-fs virtiofsd)
- $(conf_notuser virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- # use prebuilt keymaps, bug #759604
- --disable-xkbcommon
- $(conf_notuser zstd)
- )
-
- if [[ ${buildtype} == "user" ]] ; then
- conf_opts+=( --disable-libxml2 )
- else
- conf_opts+=( --enable-libxml2 )
- fi
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts=(
- # Note: backend order matters here: #716202
- # We iterate from higher-level to lower level.
- $(usex pulseaudio pa "")
- $(usev jack)
- $(usev sdl)
- $(usev alsa)
- $(usev oss)
- )
- conf_opts+=(
- --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
- )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- # Meson will not use a cross-file unless cross_prefix is set.
- tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
-
- # Plumb through equivalent of EXTRA_ECONF to allow experiments
- # like bug #747928.
- conf_opts+=( ${EXTRA_CONF_QEMU} )
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake check
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/python/qemu"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- # we use 'printf' here to be portable across 'sh'
- # implementations: #679168
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dodoc check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- # Disallow stripping of prebuilt firmware files.
- dostrip -x ${QA_PREBUILT}
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC/PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- xdg_icon_cache_update
-
- [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
-
-pkg_postrm() {
- xdg_icon_cache_update
-}
diff --git a/app-emulation/qemu/qemu-6.0.1-r1.ebuild b/app-emulation/qemu/qemu-6.0.1-r1.ebuild
deleted file mode 100644
index c52efb258bce..000000000000
--- a/app-emulation/qemu/qemu-6.0.1-r1.ebuild
+++ /dev/null
@@ -1,911 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-PYTHON_REQ_USE="ncurses,readline"
-
-FIRMWARE_ABI_VERSION="6.0.0-r50"
-
-inherit eutils linux-info toolchain-funcs multilib python-r1
-inherit udev fcaps readme.gentoo-r1 pax-utils xdg-utils
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
- EGIT_SUBMODULES=(
- meson
- tests/fp/berkeley-softfloat-3
- tests/fp/berkeley-testfloat-3
- ui/keycodemapdb
- )
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-
-IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug +doc
- +fdt fuse glusterfs gnutls gtk infiniband iscsi io-uring
- jack jemalloc +jpeg kernel_linux
- kernel_FreeBSD lzo multipath
- ncurses nfs nls numa opengl +oss +pin-upstream-blobs
- plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
- +slirp
- smartcard snappy spice ssh static static-user systemtap test udev usb
- usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs zstd"
-
-COMMON_TARGETS="
- aarch64
- alpha
- arm
- cris
- hppa
- i386
- m68k
- microblaze
- microblazeel
- mips
- mips64
- mips64el
- mipsel
- nios2
- or1k
- ppc
- ppc64
- riscv32
- riscv64
- s390x
- sh4
- sh4eb
- sparc
- sparc64
- x86_64
- xtensa
- xtensaeb
-"
-IUSE_SOFTMMU_TARGETS="
- ${COMMON_TARGETS}
- avr
- lm32
- moxie
- rx
- tricore
- unicore32
-"
-IUSE_USER_TARGETS="
- ${COMMON_TARGETS}
- aarch64_be
- armeb
- hexagon
- mipsn32
- mipsn32el
- ppc64abi32
- ppc64le
- sparc32plus
-"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-RESTRICT="!test? ( test )"
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_riscv32? ( fdt )
- qemu_softmmu_targets_riscv64? ( fdt )
- sdl-image? ( sdl )
- static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy !udev )
- static-user? ( !plugins )
- vhost-user-fs? ( caps seccomp )
- virgl? ( opengl )
- virtfs? ( caps xattr )
- vte? ( gtk )
- multipath? ( udev )
- plugins? ( !static !static-user )
-"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the external library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- dev-libs/libxml2[static-libs(+)]
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- capstone? ( dev-libs/capstone:= )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
- fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- infiniband? (
- sys-fabric/libibumad:=[static-libs(+)]
- sys-fabric/libibverbs:=[static-libs(+)]
- sys-fabric/librdmacm:=[static-libs(+)]
- )
- iscsi? ( net-libs/libiscsi )
- io-uring? ( sys-libs/liburing:=[static-libs(+)] )
- jack? ( virtual/jack )
- jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- multipath? ( sys-fs/multipath-tools )
- ncurses? (
- sys-libs/ncurses:=[unicode(+)]
- sys-libs/ncurses:=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl(+),gbm(+)]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- media-libs/libsdl2[video]
- media-libs/libsdl2[static-libs(+)]
- )
- sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- slirp? ( net-libs/libslirp[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:= )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
- udev? ( virtual/libudev:= )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )
- zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
-"
-
-EDK2_OVMF_VERSION="202105"
-SEABIOS_VERSION="1.14.0"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}[binary]
- ~sys-firmware/ipxe-1.21.1[binary,qemu]
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre10[binary]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}
- sys-firmware/ipxe[qemu]
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- sys-firmware/sgabios
- )"
-PPC_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- )
-"
-
-BDEPEND="
- $(python_gen_impl_dep)
- dev-lang/perl
- sys-apps/texinfo
- virtual/pkgconfig
- doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
- gtk? ( nls? ( sys-devel/gettext ) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )
-"
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )"
-RDEPEND="${CDEPEND}
- acct-group/kvm
- selinux? ( sec-policy/selinux-qemu )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-5.2.0-strings.patch
- "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
- "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
- "${FILESDIR}"/${PN}-6.0.0-make.patch
-)
-
-QA_PREBUILT="
- usr/share/qemu/hppa-firmware.img
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
- usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32
-"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/default-configs/targets/ >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- default
-
- # Use correct toolchain to fix cross-compiling
- tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
- export WINDRES=${CHOST}-windres
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --bindir=/usr/bin
- --libdir=/usr/$(get_libdir)
- --datadir=/usr/share
- --docdir=/usr/share/doc/${PF}/html
- --mandir=/usr/share/man
- --localstatedir=/var
- --disable-bsd-user
- --disable-containers # bug #732972
- --disable-guest-agent
- --disable-strip
-
- # bug #746752: TCG interpreter has a few limitations:
- # - it does not support FPU
- # - it's generally slower on non-self-modifying code
- # It's advantage is support for host architectures
- # where native codegeneration is not implemented.
- # Gentoo has qemu keyworded only on targets with
- # native code generation available. Avoid the interpreter.
- --disable-tcg-interpreter
-
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- $(use_enable doc docs)
- $(use_enable nls gettext)
- $(use_enable plugins)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- # Enable option only for softmmu build, but not 'user' or 'tools'
- conf_softmmu() {
- if [[ ${buildtype} == "softmmu" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Enable option only for tools build, but not 'user' or 'softmmu'
- conf_tools() {
- if [[ ${buildtype} == "tools" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- conf_opts+=(
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_notuser bzip2)
- $(conf_notuser capstone)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_notuser fdt)
- $(conf_notuser fuse)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser io-uring linux-io-uring)
- $(conf_notuser jemalloc jemalloc)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser multipath mpath)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_softmmu sdl-image)
- $(conf_notuser seccomp)
- $(conf_notuser slirp slirp system)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh)
- $(conf_notuser udev libudev)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser vhost-user-fs)
- $(conf_tools vhost-user-fs virtiofsd)
- $(conf_notuser virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- # use prebuilt keymaps, bug #759604
- --disable-xkbcommon
- $(conf_notuser zstd)
- )
-
- if [[ ${buildtype} == "user" ]] ; then
- conf_opts+=( --disable-libxml2 )
- else
- conf_opts+=( --enable-libxml2 )
- fi
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts=(
- # Note: backend order matters here: #716202
- # We iterate from higher-level to lower level.
- $(usex pulseaudio pa "")
- $(usev jack)
- $(usev sdl)
- $(usev alsa)
- $(usev oss)
- )
- conf_opts+=(
- --audio-drv-list=$(printf "%s," "${audio_opts[@]}")
- )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- # Meson will not use a cross-file unless cross_prefix is set.
- tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
-
- # Plumb through equivalent of EXTRA_ECONF to allow experiments
- # like bug #747928.
- conf_opts+=( ${EXTRA_CONF_QEMU} )
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-
- # FreeBSD's kernel does not support QEMU assigning/grabbing
- # host USB devices yet
- use kernel_FreeBSD && \
- sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake check
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/python/qemu"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- # we use 'printf' here to be portable across 'sh'
- # implementations: #679168
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dodoc check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- # Disallow stripping of prebuilt firmware files.
- dostrip -x ${QA_PREBUILT}
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC/PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- xdg_icon_cache_update
-
- [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
-
-pkg_postrm() {
- xdg_icon_cache_update
-}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2022-01-11 13:40 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2022-01-11 13:40 UTC (permalink / raw
To: gentoo-commits
commit: 0254a02c985973583c21db71b308d3b6bf93cf2b
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 11 13:32:11 2022 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Tue Jan 11 13:40:41 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0254a02c
app-emulation/qemu: always build virtfs-proxy-helper tool
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
...qemu-6.2.0-also-build-virtfs-proxy-helper.patch | 32 ++++++++++++++++++++++
.../{qemu-6.2.0-r2.ebuild => qemu-6.2.0-r3.ebuild} | 1 +
app-emulation/qemu/qemu-9999.ebuild | 1 +
3 files changed, 34 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-6.2.0-also-build-virtfs-proxy-helper.patch b/app-emulation/qemu/files/qemu-6.2.0-also-build-virtfs-proxy-helper.patch
new file mode 100644
index 000000000000..b6af46552fe5
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-6.2.0-also-build-virtfs-proxy-helper.patch
@@ -0,0 +1,32 @@
+From 42e53a0aadb76dfa7c11cd3b14eb4a41efba9bbe Mon Sep 17 00:00:00 2001
+From: Matthias Maier <tamiko@43-1.org>
+Date: Tue, 11 Jan 2022 07:20:31 -0600
+Subject: [PATCH] also build virtfs-proxy-helper
+
+The Gentoo ebuild splits the qemu build into a softmmu, user and tool
+phase in order to be able to build and link some of the qemu emulators
+statically. This unfortunately has the consequence that we never
+configure with "have_virtfs" and "have_tools" at the same time.
+
+As a workaround, simply build the virtfs userland unconditionally. After
+all, it is a tiny executable
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index fbe856700..d6918b04c 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1390,7 +1390,7 @@ have_virtfs = (targetos == 'linux' and
+ libattr.found() and
+ libcap_ng.found())
+
+-have_virtfs_proxy_helper = have_virtfs and have_tools
++have_virtfs_proxy_helper = have_tools
+
+ if get_option('virtfs').enabled()
+ if not have_virtfs
+--
+2.34.1
+
diff --git a/app-emulation/qemu/qemu-6.2.0-r2.ebuild b/app-emulation/qemu/qemu-6.2.0-r3.ebuild
similarity index 99%
rename from app-emulation/qemu/qemu-6.2.0-r2.ebuild
rename to app-emulation/qemu/qemu-6.2.0-r3.ebuild
index 10b0bf44d7de..6ca062e88457 100644
--- a/app-emulation/qemu/qemu-6.2.0-r2.ebuild
+++ b/app-emulation/qemu/qemu-6.2.0-r3.ebuild
@@ -279,6 +279,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-6.0.0-make.patch
"${FILESDIR}"/${PN}-6.1.0-strings.patch
"${FILESDIR}"/${PN}-6.2.0-user-SLIC-crash.patch
+ "${FILESDIR}"/${PN}-6.2.0-also-build-virtfs-proxy-helper.patch
)
QA_PREBUILT="
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 7f3efa61e35b..d81060ed102b 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -278,6 +278,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
"${FILESDIR}"/${PN}-6.0.0-make.patch
"${FILESDIR}"/${PN}-6.1.0-strings.patch
+ "${FILESDIR}"/${PN}-6.2.0-also-build-virtfs-proxy-helper.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2022-04-04 18:44 John Helmert III
0 siblings, 0 replies; 66+ messages in thread
From: John Helmert III @ 2022-04-04 18:44 UTC (permalink / raw
To: gentoo-commits
commit: 991a095934c0cf12cc9aa4420a67a321b1d4e9a2
Author: Michal Privoznik <mprivozn <AT> redhat <DOT> com>
AuthorDate: Mon Apr 4 11:08:12 2022 +0000
Commit: John Helmert III <ajak <AT> gentoo <DOT> org>
CommitDate: Mon Apr 4 18:44:34 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=991a0959
app-emulation/qemu: Rebase qemu-6.2.0-also-build-virtfs-proxy-helper.patch for live ebuild
Since the upstream moved some stuff in meson.build the original
patch applies no more. Rebase it onto current master.
Signed-off-by: Michal Privoznik <mprivozn <AT> redhat.com>
Closes: https://github.com/gentoo/gentoo/pull/24898
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
...qemu-7.0.0-also-build-virtfs-proxy-helper.patch | 32 ++++++++++++++++++++++
app-emulation/qemu/qemu-9999.ebuild | 2 +-
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/app-emulation/qemu/files/qemu-7.0.0-also-build-virtfs-proxy-helper.patch b/app-emulation/qemu/files/qemu-7.0.0-also-build-virtfs-proxy-helper.patch
new file mode 100644
index 000000000000..ca2e9433792c
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.0.0-also-build-virtfs-proxy-helper.patch
@@ -0,0 +1,32 @@
+From c1093041466772f4b62961bcc5a354801d41355d Mon Sep 17 00:00:00 2001
+From: Matthias Maier <tamiko@43-1.org>
+Date: Mon, 4 Apr 2022 12:56:59 +0200
+Subject: [PATCH] also build virtfs-proxy-helper
+
+The Gentoo ebuild splits the qemu build into a softmmu, user and tool
+phase in order to be able to build and link some of the qemu emulators
+statically. This unfortunately has the consequence that we never
+configure with "have_virtfs" and "have_tools" at the same time.
+
+As a workaround, simply build the virtfs userland unconditionally. After
+all, it is a tiny executable
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 861de93c4f..a8d29be3aa 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1474,7 +1474,7 @@ have_virtfs = get_option('virtfs') \
+ .disable_auto_if(not have_tools and not have_system) \
+ .allowed()
+
+-have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools
++have_virtfs_proxy_helper = have_tools and libattr.found() and libcap_ng.found()
+
+ foreach k : get_option('trace_backends')
+ config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
+--
+2.35.1
+
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 13179f417b18..a8468dde1909 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -276,7 +276,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
"${FILESDIR}"/${PN}-6.0.0-make.patch
"${FILESDIR}"/${PN}-6.1.0-strings.patch
- "${FILESDIR}"/${PN}-6.2.0-also-build-virtfs-proxy-helper.patch
+ "${FILESDIR}"/${PN}-7.0.0-also-build-virtfs-proxy-helper.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2022-07-05 1:05 WANG Xuerui
0 siblings, 0 replies; 66+ messages in thread
From: WANG Xuerui @ 2022-07-05 1:05 UTC (permalink / raw
To: gentoo-commits
commit: 62ef6e8524251a91d96e54f11c87a485b25c5f70
Author: WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 5 00:52:11 2022 +0000
Commit: WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Tue Jul 5 00:53:54 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62ef6e85
app-emulation/qemu: forward 7.0.0-also-build-virtfs-proxy-helper.patch to avoid fuzz
Due to upstream commit https://gitlab.com/qemu-project/qemu/-/commit/622d64fffe4f
("meson, configure: move bdrv whitelists to meson").
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>
...qemu-7.1.0-also-build-virtfs-proxy-helper.patch | 32 ++++++++++++++++++++++
app-emulation/qemu/qemu-9999.ebuild | 2 +-
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/app-emulation/qemu/files/qemu-7.1.0-also-build-virtfs-proxy-helper.patch b/app-emulation/qemu/files/qemu-7.1.0-also-build-virtfs-proxy-helper.patch
new file mode 100644
index 000000000000..b6f3078a6906
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.1.0-also-build-virtfs-proxy-helper.patch
@@ -0,0 +1,32 @@
+From d02ea89239768c93651a161d057f2bf04d56a024 Mon Sep 17 00:00:00 2001
+From: Matthias Maier <tamiko@43-1.org>
+Date: Mon, 4 Apr 2022 12:56:59 +0200
+Subject: [PATCH] also build virtfs-proxy-helper
+
+The Gentoo ebuild splits the qemu build into a softmmu, user and tool
+phase in order to be able to build and link some of the qemu emulators
+statically. This unfortunately has the consequence that we never
+configure with "have_virtfs" and "have_tools" at the same time.
+
+As a workaround, simply build the virtfs userland unconditionally. After
+all, it is a tiny executable
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 65a885ea69..29ce7a5a8e 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1684,7 +1684,7 @@ have_virtfs = get_option('virtfs') \
+ .disable_auto_if(not have_tools and not have_system) \
+ .allowed()
+
+-have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools
++have_virtfs_proxy_helper = have_tools and libattr.found() and libcap_ng.found()
+
+ if get_option('block_drv_ro_whitelist') == ''
+ config_host_data.set('CONFIG_BDRV_RO_WHITELIST', '')
+--
+2.35.1
+
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 8c83655b794e..336c80bd859c 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -278,7 +278,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
"${FILESDIR}"/${PN}-6.0.0-make.patch
- "${FILESDIR}"/${PN}-7.0.0-also-build-virtfs-proxy-helper.patch
+ "${FILESDIR}"/${PN}-7.1.0-also-build-virtfs-proxy-helper.patch
"${FILESDIR}"/${PN}-7.1.0-strings.patch
)
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2022-09-16 19:41 Georgy Yakovlev
0 siblings, 0 replies; 66+ messages in thread
From: Georgy Yakovlev @ 2022-09-16 19:41 UTC (permalink / raw
To: gentoo-commits
commit: 8c0117c390c33c98bcad3f7edeadf717ece1b0f9
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 16 19:38:20 2022 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Fri Sep 16 19:41:30 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c0117c3
app-emulation/qemu: fix build on ppc (or any softmmu-only arch)
Acked-by: John Helmert III <ajak <AT> gentoo.org>
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
.../qemu/files/qemu-7.0.0-have-user-meson.patch | 36 ++++++++++++++++++++++
app-emulation/qemu/qemu-7.0.0-r1.ebuild | 1 +
app-emulation/qemu/qemu-7.0.0-r2.ebuild | 1 +
app-emulation/qemu/qemu-7.0.0-r3.ebuild | 1 +
4 files changed, 39 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-7.0.0-have-user-meson.patch b/app-emulation/qemu/files/qemu-7.0.0-have-user-meson.patch
new file mode 100644
index 000000000000..2acf73cff86e
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.0.0-have-user-meson.patch
@@ -0,0 +1,36 @@
+From 2296b4655694744f7c8dcdc9440c21d86e19968e Mon Sep 17 00:00:00 2001
+From: Thomas Huth <thuth@redhat.com>
+Date: Wed, 22 Jun 2022 16:03:28 +0200
+Subject: [PATCH] common-user: Only compile the common user code if have_user
+ is set
+
+There is no need to waste cycles here if we only compile the system
+binaries or tools. Additionally, this change is even a hard requirement
+for building the tools on systems that do not have an entry in the
+common-user/host/ folder (since common-user/meson.build is trying
+to add such a path via the include_directories() command).
+
+Reported-by: Michael Tokarev <mjt@tls.msk.ru>
+Signed-off-by: Thomas Huth <thuth@redhat.com>
+Reviewed-by: Zhang Chen <chen.zhang@intel.com>
+Message-Id: <20220622140328.383961-1-thuth@redhat.com>
+Signed-off-by: Laurent Vivier <laurent@vivier.eu>
+---
+ common-user/meson.build | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/common-user/meson.build b/common-user/meson.build
+index 26212dda5c..ac9de5b9e3 100644
+--- a/common-user/meson.build
++++ b/common-user/meson.build
+@@ -1,3 +1,7 @@
++if not have_user
++ subdir_done()
++endif
++
+ common_user_inc += include_directories('host/' / host_arch)
+
+ user_ss.add(files(
+--
+GitLab
+
diff --git a/app-emulation/qemu/qemu-7.0.0-r1.ebuild b/app-emulation/qemu/qemu-7.0.0-r1.ebuild
index 10bff2d0b799..36a66123268a 100644
--- a/app-emulation/qemu/qemu-7.0.0-r1.ebuild
+++ b/app-emulation/qemu/qemu-7.0.0-r1.ebuild
@@ -279,6 +279,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-6.0.0-make.patch
"${FILESDIR}"/${PN}-6.1.0-strings.patch
"${FILESDIR}"/${PN}-7.0.0-also-build-virtfs-proxy-helper.patch
+ "${FILESDIR}"/${PN}-7.0.0-have-user-meson.patch
)
QA_PREBUILT="
diff --git a/app-emulation/qemu/qemu-7.0.0-r2.ebuild b/app-emulation/qemu/qemu-7.0.0-r2.ebuild
index f048b6385812..32f9865afe5c 100644
--- a/app-emulation/qemu/qemu-7.0.0-r2.ebuild
+++ b/app-emulation/qemu/qemu-7.0.0-r2.ebuild
@@ -281,6 +281,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-7.0.0-also-build-virtfs-proxy-helper.patch
"${FILESDIR}"/${P}-virtio-scsi-fixes.patch
"${FILESDIR}"/${P}-pci-overflow-fortify-source-3.patch
+ "${FILESDIR}"/${PN}-7.0.0-have-user-meson.patch
)
QA_PREBUILT="
diff --git a/app-emulation/qemu/qemu-7.0.0-r3.ebuild b/app-emulation/qemu/qemu-7.0.0-r3.ebuild
index a44b77c855f1..d484cdf35ab1 100644
--- a/app-emulation/qemu/qemu-7.0.0-r3.ebuild
+++ b/app-emulation/qemu/qemu-7.0.0-r3.ebuild
@@ -302,6 +302,7 @@ PATCHES=(
"${FILESDIR}"/${P}-virtio-scsi-fixes.patch
"${FILESDIR}"/${P}-pci-overflow-fortify-source-3.patch
"${FILESDIR}"/${P}-glibc-2.36.patch
+ "${FILESDIR}"/${PN}-7.0.0-have-user-meson.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2023-01-18 18:59 John Helmert III
0 siblings, 0 replies; 66+ messages in thread
From: John Helmert III @ 2023-01-18 18:59 UTC (permalink / raw
To: gentoo-commits
commit: 559459da353a00d80820425ad5afcea0b129aa8c
Author: John Helmert III <ajak <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 4 18:59:43 2023 +0000
Commit: John Helmert III <ajak <AT> gentoo <DOT> org>
CommitDate: Wed Jan 18 18:58:48 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=559459da
app-emulation/qemu: dependency/automagic linkage fixups
Closes: https://bugs.gentoo.org/886207
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
.../qemu/files/qemu-7.2.0-disable-gmp.patch | 45 ++++++++++++++++++++++
app-emulation/qemu/qemu-7.2.0-r1.ebuild | 12 ++++--
2 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-7.2.0-disable-gmp.patch b/app-emulation/qemu/files/qemu-7.2.0-disable-gmp.patch
new file mode 100644
index 000000000000..3050228b4e0c
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.2.0-disable-gmp.patch
@@ -0,0 +1,45 @@
+commit 433c2acd1b9c3f7f5903273e85fed9a7f9157b23
+Author: John Helmert III <ajak@gentoo.org>
+Date: Wed Jan 4 12:25:08 2023 -0600
+
+ meson.build: disable gmp
+
+ gmp isn't required, and we want to avoid linking to it automatigcally
+ in Gentoo.
+
+ Bug: https://bugs.gentoo.org/886207
+ Signed-off-by: John Helmert III <ajak@gentoo.org>
+
+diff --git a/meson.build b/meson.build
+index 5c6b5a1c75..2f9550362d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1234,15 +1234,6 @@ if not gnutls_crypto.found()
+ endif
+ endif
+
+-gmp = dependency('gmp', required: false, method: 'pkg-config', kwargs: static_kwargs)
+-if nettle.found() and gmp.found()
+- hogweed = dependency('hogweed', version: '>=3.4',
+- method: 'pkg-config',
+- required: get_option('nettle'),
+- kwargs: static_kwargs)
+-endif
+-
+-
+ gtk = not_found
+ gtkx11 = not_found
+ vte = not_found
+diff --git a/meson_options.txt b/meson_options.txt
+index 4b749ca549..e06b274960 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -277,6 +277,8 @@ option('vduse_blk_export', type: 'feature', value: 'auto',
+
+ option('capstone', type: 'feature', value: 'auto',
+ description: 'Whether and how to find the capstone library')
++option('gmp', type: 'feature', value: 'auto',
++ description: 'Whether or not to find the gmp library')
+ option('fdt', type: 'combo', value: 'auto',
+ choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
+ description: 'Whether and how to find the libfdt library')
diff --git a/app-emulation/qemu/qemu-7.2.0-r1.ebuild b/app-emulation/qemu/qemu-7.2.0-r1.ebuild
index 7d6949eb5d3a..44a3ff5b6fcf 100644
--- a/app-emulation/qemu/qemu-7.2.0-r1.ebuild
+++ b/app-emulation/qemu/qemu-7.2.0-r1.ebuild
@@ -151,7 +151,7 @@ done
# respected). This is because qemu supports using the C library's API
# when available rather than always using the external library.
ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
+ dev-libs/glib:2[static-libs(+)]
sys-libs/zlib[static-libs(+)]
python? ( ${PYTHON_DEPS} )
systemtap? ( dev-util/systemtap )
@@ -176,11 +176,14 @@ SOFTMMU_TOOLS_DEPEND="
fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
gnutls? (
- dev-libs/nettle:=[static-libs(+)]
>=net-libs/gnutls-3.0:=[static-libs(+)]
+ dev-libs/nettle:=[static-libs(+)]
)
gtk? (
+ x11-libs/cairo
+ x11-libs/gdk-pixbuf:2
x11-libs/gtk+:3
+ x11-libs/libX11
vte? ( x11-libs/vte:2.91 )
)
infiniband? ( sys-cluster/rdma-core[static-libs(+)] )
@@ -205,7 +208,7 @@ SOFTMMU_TOOLS_DEPEND="
)
pam? ( sys-libs/pam )
png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
+ pulseaudio? ( media-libs/libpulse )
rbd? ( sys-cluster/ceph )
sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
sdl? (
@@ -223,7 +226,7 @@ SOFTMMU_TOOLS_DEPEND="
)
ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
udev? ( virtual/libudev:= )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+ usb? ( >=virtual/libusb-1-r2:1[static-libs(+)] )
usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
vde? ( net-misc/vde[static-libs(+)] )
virgl? ( media-libs/virglrenderer[static-libs(+)] )
@@ -311,6 +314,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-6.0.0-make.patch
"${FILESDIR}"/${PN}-7.1.0-also-build-virtfs-proxy-helper.patch
"${FILESDIR}"/${PN}-7.1.0-capstone-include-path.patch
+ "${FILESDIR}"/${PN}-7.2.0-disable-gmp.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2023-02-22 11:32 Sam James
0 siblings, 0 replies; 66+ messages in thread
From: Sam James @ 2023-02-22 11:32 UTC (permalink / raw
To: gentoo-commits
commit: 7e648ec4592e45730aefc986e949b73aefffdf8d
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 22 11:32:11 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 22 11:32:28 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e648ec4
app-emulation/qemu: backport fix for TCG for x86
Bug: https://bugs.gentoo.org/895746
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../qemu/files/qemu-7.2.0-tcg-curl-ssl.patch | 182 ++++
app-emulation/qemu/qemu-7.2.0-r3.ebuild | 973 +++++++++++++++++++++
2 files changed, 1155 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-7.2.0-tcg-curl-ssl.patch b/app-emulation/qemu/files/qemu-7.2.0-tcg-curl-ssl.patch
new file mode 100644
index 000000000000..2b0a9f630371
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.2.0-tcg-curl-ssl.patch
@@ -0,0 +1,182 @@
+https://bugs.gentoo.org/895746#c3
+https://gitlab.com/qemu-project/qemu/-/issues/1471
+https://gitlab.com/qemu-project/qemu/-/commit/60c7dd22e1383754d5f150bc9f7c2785c662a7b6
+
+From 60c7dd22e1383754d5f150bc9f7c2785c662a7b6 Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Tue, 31 Jan 2023 09:48:03 +0100
+Subject: [PATCH] target/i386: fix ADOX followed by ADCX
+
+When ADCX is followed by ADOX or vice versa, the second instruction's
+carry comes from EFLAGS and the condition codes use the CC_OP_ADCOX
+operation. Retrieving the carry from EFLAGS is handled by this bit
+of gen_ADCOX:
+
+ tcg_gen_extract_tl(carry_in, cpu_cc_src,
+ ctz32(cc_op == CC_OP_ADCX ? CC_C : CC_O), 1);
+
+Unfortunately, in this case cc_op has been overwritten by the previous
+"if" statement to CC_OP_ADCOX. This works by chance when the first
+instruction is ADCX; however, if the first instruction is ADOX,
+ADCX will incorrectly take its carry from OF instead of CF.
+
+Fix by moving the computation of the new cc_op at the end of the function.
+The included exhaustive test case fails without this patch and passes
+afterwards.
+
+Because ADCX/ADOX need not be invoked through the VEX prefix, this
+regression bisects to commit 16fc5726a6e2 ("target/i386: reimplement
+0x0f 0x38, add AVX", 2022-10-18). However, the mistake happened a
+little earlier, when BMI instructions were rewritten using the new
+decoder framework.
+
+Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1471
+Reported-by: Paul Jolly <https://gitlab.com/myitcv>
+Fixes: 1d0b926150e5 ("target/i386: move scalar 0F 38 and 0F 3A instruction to new decoder", 2022-10-18)
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+--- a/target/i386/tcg/emit.c.inc
++++ b/target/i386/tcg/emit.c.inc
+@@ -1015,6 +1015,7 @@ VSIB_AVX(VPGATHERQ, vpgatherq)
+
+ static void gen_ADCOX(DisasContext *s, CPUX86State *env, MemOp ot, int cc_op)
+ {
++ int opposite_cc_op;
+ TCGv carry_in = NULL;
+ TCGv carry_out = (cc_op == CC_OP_ADCX ? cpu_cc_dst : cpu_cc_src2);
+ TCGv zero;
+@@ -1022,14 +1023,8 @@ static void gen_ADCOX(DisasContext *s, CPUX86State *env, MemOp ot, int cc_op)
+ if (cc_op == s->cc_op || s->cc_op == CC_OP_ADCOX) {
+ /* Re-use the carry-out from a previous round. */
+ carry_in = carry_out;
+- cc_op = s->cc_op;
+- } else if (s->cc_op == CC_OP_ADCX || s->cc_op == CC_OP_ADOX) {
+- /* Merge with the carry-out from the opposite instruction. */
+- cc_op = CC_OP_ADCOX;
+- }
+-
+- /* If we don't have a carry-in, get it out of EFLAGS. */
+- if (!carry_in) {
++ } else {
++ /* We don't have a carry-in, get it out of EFLAGS. */
+ if (s->cc_op != CC_OP_ADCX && s->cc_op != CC_OP_ADOX) {
+ gen_compute_eflags(s);
+ }
+@@ -1053,7 +1048,14 @@ static void gen_ADCOX(DisasContext *s, CPUX86State *env, MemOp ot, int cc_op)
+ tcg_gen_add2_tl(s->T0, carry_out, s->T0, carry_out, s->T1, zero);
+ break;
+ }
+- set_cc_op(s, cc_op);
++
++ opposite_cc_op = cc_op == CC_OP_ADCX ? CC_OP_ADOX : CC_OP_ADCX;
++ if (s->cc_op == CC_OP_ADCOX || s->cc_op == opposite_cc_op) {
++ /* Merge with the carry-out from the opposite instruction. */
++ set_cc_op(s, CC_OP_ADCOX);
++ } else {
++ set_cc_op(s, cc_op);
++ }
+ }
+
+ static void gen_ADCX(DisasContext *s, CPUX86State *env, X86DecodedInsn *decode)
+--- a/tests/tcg/i386/Makefile.target
++++ b/tests/tcg/i386/Makefile.target
+@@ -14,7 +14,7 @@ config-cc.mak: Makefile
+ I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c))
+ ALL_X86_TESTS=$(I386_SRCS:.c=)
+ SKIP_I386_TESTS=test-i386-ssse3 test-avx test-3dnow test-mmx
+-X86_64_TESTS:=$(filter test-i386-bmi2 $(SKIP_I386_TESTS), $(ALL_X86_TESTS))
++X86_64_TESTS:=$(filter test-i386-adcox test-i386-bmi2 $(SKIP_I386_TESTS), $(ALL_X86_TESTS))
+
+ test-i386-sse-exceptions: CFLAGS += -msse4.1 -mfpmath=sse
+ run-test-i386-sse-exceptions: QEMU_OPTS += -cpu max
+@@ -28,6 +28,10 @@ test-i386-bmi2: CFLAGS=-O2
+ run-test-i386-bmi2: QEMU_OPTS += -cpu max
+ run-plugin-test-i386-bmi2-%: QEMU_OPTS += -cpu max
+
++test-i386-adcox: CFLAGS=-O2
++run-test-i386-adcox: QEMU_OPTS += -cpu max
++run-plugin-test-i386-adcox-%: QEMU_OPTS += -cpu max
++
+ #
+ # hello-i386 is a barebones app
+ #
+--- /dev/null
++++ b/tests/tcg/i386/test-i386-adcox.c
+@@ -0,0 +1,75 @@
++/* See if various BMI2 instructions give expected results */
++#include <assert.h>
++#include <stdint.h>
++#include <stdio.h>
++
++#define CC_C 1
++#define CC_O (1 << 11)
++
++#ifdef __x86_64__
++#define REG uint64_t
++#else
++#define REG uint32_t
++#endif
++
++void test_adox_adcx(uint32_t in_c, uint32_t in_o, REG adcx_operand, REG adox_operand)
++{
++ REG flags;
++ REG out_adcx, out_adox;
++
++ asm("pushf; pop %0" : "=r"(flags));
++ flags &= ~(CC_C | CC_O);
++ flags |= (in_c ? CC_C : 0);
++ flags |= (in_o ? CC_O : 0);
++
++ out_adcx = adcx_operand;
++ out_adox = adox_operand;
++ asm("push %0; popf;"
++ "adox %3, %2;"
++ "adcx %3, %1;"
++ "pushf; pop %0"
++ : "+r" (flags), "+r" (out_adcx), "+r" (out_adox)
++ : "r" ((REG)-1), "0" (flags), "1" (out_adcx), "2" (out_adox));
++
++ assert(out_adcx == in_c + adcx_operand - 1);
++ assert(out_adox == in_o + adox_operand - 1);
++ assert(!!(flags & CC_C) == (in_c || adcx_operand));
++ assert(!!(flags & CC_O) == (in_o || adox_operand));
++}
++
++void test_adcx_adox(uint32_t in_c, uint32_t in_o, REG adcx_operand, REG adox_operand)
++{
++ REG flags;
++ REG out_adcx, out_adox;
++
++ asm("pushf; pop %0" : "=r"(flags));
++ flags &= ~(CC_C | CC_O);
++ flags |= (in_c ? CC_C : 0);
++ flags |= (in_o ? CC_O : 0);
++
++ out_adcx = adcx_operand;
++ out_adox = adox_operand;
++ asm("push %0; popf;"
++ "adcx %3, %1;"
++ "adox %3, %2;"
++ "pushf; pop %0"
++ : "+r" (flags), "+r" (out_adcx), "+r" (out_adox)
++ : "r" ((REG)-1), "0" (flags), "1" (out_adcx), "2" (out_adox));
++
++ assert(out_adcx == in_c + adcx_operand - 1);
++ assert(out_adox == in_o + adox_operand - 1);
++ assert(!!(flags & CC_C) == (in_c || adcx_operand));
++ assert(!!(flags & CC_O) == (in_o || adox_operand));
++}
++
++int main(int argc, char *argv[]) {
++ /* try all combinations of input CF, input OF, CF from op1+op2, OF from op2+op1 */
++ int i;
++ for (i = 0; i <= 15; i++) {
++ printf("%d\n", i);
++ test_adcx_adox(!!(i & 1), !!(i & 2), !!(i & 4), !!(i & 8));
++ test_adox_adcx(!!(i & 1), !!(i & 2), !!(i & 4), !!(i & 8));
++ }
++ return 0;
++}
++
+--
+GitLab
diff --git a/app-emulation/qemu/qemu-7.2.0-r3.ebuild b/app-emulation/qemu/qemu-7.2.0-r3.ebuild
new file mode 100644
index 000000000000..39afad4b1b90
--- /dev/null
+++ b/app-emulation/qemu/qemu-7.2.0-r3.ebuild
@@ -0,0 +1,973 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Generate using https://github.com/thesamesam/sam-gentoo-scripts/blob/main/niche/generate-qemu-docs
+# Set to 1 if prebuilt, 0 if not
+# (the construct below is to allow overriding from env for script)
+QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-1}
+QEMU_DOCS_PREBUILT_DEV=ajak
+QEMU_DOCS_VERSION="${PV}"
+# Default to generating docs (inc. man pages) if no prebuilt; overridden later
+# bug #830088
+QEMU_DOC_USEFLAG="+doc"
+
+PYTHON_COMPAT=( python3_{9,10,11} )
+PYTHON_REQ_USE="ncurses,readline"
+
+FIRMWARE_ABI_VERSION="7.2.0"
+
+inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
+ pax-utils xdg-utils
+
+if [[ ${PV} == *9999* ]]; then
+ QEMU_DOCS_PREBUILT=0
+
+ EGIT_REPO_URI="https://gitlab.com/qemu-project/qemu.git/"
+ EGIT_SUBMODULES=(
+ tests/fp/berkeley-softfloat-3
+ tests/fp/berkeley-testfloat-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ MY_P="${PN}-${PV/_rc/-rc}"
+ SRC_URI="https://download.qemu.org/${MY_P}.tar.xz"
+
+ if [[ ${QEMU_DOCS_PREBUILT} == 1 ]] ; then
+ SRC_URI+=" !doc? ( https://dev.gentoo.org/~${QEMU_DOCS_PREBUILT_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${QEMU_DOCS_VERSION}-docs.tar.xz )"
+ fi
+
+ S="${WORKDIR}/${MY_P}"
+ [[ "${PV}" != *_rc* ]] && KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+[[ ${QEMU_DOCS_PREBUILT} == 1 ]] && QEMU_DOC_USEFLAG="doc"
+
+IUSE="accessibility +aio alsa bpf bzip2 capstone +curl debug ${QEMU_DOC_USEFLAG}
+ +fdt fuse glusterfs +gnutls gtk infiniband iscsi io-uring
+ jack jemalloc +jpeg
+ lzo multipath
+ ncurses nfs nls numa opengl +oss pam +pin-upstream-blobs
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+ +slirp
+ smartcard snappy spice ssh static static-user systemtap test udev usb
+ usbredir vde +vhost-net virgl virtfs +vnc vte xattr xen
+ zstd"
+
+COMMON_TARGETS="
+ aarch64
+ alpha
+ arm
+ cris
+ hppa
+ i386
+ loongarch64
+ m68k
+ microblaze
+ microblazeel
+ mips
+ mips64
+ mips64el
+ mipsel
+ nios2
+ or1k
+ ppc
+ ppc64
+ riscv32
+ riscv64
+ s390x
+ sh4
+ sh4eb
+ sparc
+ sparc64
+ x86_64
+ xtensa
+ xtensaeb
+"
+IUSE_SOFTMMU_TARGETS="
+ ${COMMON_TARGETS}
+ avr
+ rx
+ tricore
+"
+IUSE_USER_TARGETS="
+ ${COMMON_TARGETS}
+ aarch64_be
+ armeb
+ hexagon
+ mipsn32
+ mipsn32el
+ ppc64le
+ sparc32plus
+"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="
+ ${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ qemu_softmmu_targets_x86_64? ( fdt )
+ sdl-image? ( sdl )
+ static? ( static-user !alsa !gtk !jack !opengl !pam !pulseaudio !plugins !rbd !snappy !udev )
+ static-user? ( !plugins )
+ virgl? ( opengl )
+ virtfs? ( xattr )
+ vnc? ( gnutls )
+ vte? ( gtk )
+ multipath? ( udev )
+ plugins? ( !static !static-user )
+"
+for smname in ${IUSE_SOFTMMU_TARGETS} ; do
+ REQUIRED_USE+=" qemu_softmmu_targets_${smname}? ( seccomp ) "
+done
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ dev-libs/glib:2[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ sys-libs/libcap-ng[static-libs(+)]
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bpf? ( dev-libs/libbpf:= )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:=[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.1[static-libs(+)] )
+ fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ dev-libs/nettle:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/cairo
+ x11-libs/gdk-pixbuf:2
+ x11-libs/gtk+:3
+ x11-libs/libX11
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? ( sys-cluster/rdma-core[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing:=[static-libs(+)] )
+ jack? ( virtual/jack )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( media-libs/libjpeg-turbo:=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ multipath? ( sys-fs/multipath-tools )
+ ncurses? (
+ sys-libs/ncurses:=[unicode(+)]
+ sys-libs/ncurses:=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl(+),gbm(+)]
+ )
+ pam? ( sys-libs/pam )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-libs/libpulse )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[video]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ slirp? ( net-libs/libslirp[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ udev? ( virtual/libudev:= )
+ usb? ( >=virtual/libusb-1-r2:1[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
+
+EDK2_OVMF_VERSION="202202"
+SEABIOS_VERSION="1.16.0"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-bin-${EDK2_OVMF_VERSION}
+ ~sys-firmware/ipxe-1.21.1[binary,qemu]
+ ~sys-firmware/seabios-bin-${SEABIOS_VERSION}
+ ~sys-firmware/sgabios-0.1_pre10[binary]
+ )
+ !pin-upstream-blobs? (
+ || (
+ >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}
+ >=sys-firmware/edk2-ovmf-bin-${EDK2_OVMF_VERSION}
+ )
+ sys-firmware/ipxe[qemu]
+ || (
+ >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
+ >=sys-firmware/seabios-bin-${SEABIOS_VERSION}
+ )
+ sys-firmware/sgabios
+ )"
+PPC_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-bin-${SEABIOS_VERSION}
+ )
+ !pin-upstream-blobs? (
+ || (
+ >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
+ >=sys-firmware/seabios-bin-${SEABIOS_VERSION}
+ )
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ dev-util/meson
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? (
+ dev-python/sphinx[${PYTHON_USEDEP}]
+ dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]
+ )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? (
+ sec-policy/selinux-qemu
+ sys-libs/libselinux
+ )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
+ "${FILESDIR}"/${PN}-6.0.0-make.patch
+ "${FILESDIR}"/${PN}-7.1.0-also-build-virtfs-proxy-helper.patch
+ "${FILESDIR}"/${PN}-7.1.0-capstone-include-path.patch
+ "${FILESDIR}"/${PN}-7.2.0-disable-gmp.patch
+ "${FILESDIR}"/${PN}-7.2.0-linux-headers-6.2-glibc-2.36.patch
+ "${FILESDIR}"/${PN}-7.2.0-tcg-curl-ssl.patch
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
+ usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32
+"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/configs/targets/ >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # We already force -D_FORTIFY_SOURCE=2 (or 3) in our toolchain, but
+ # this setting (-U then -D..=2) will prevent us from trying out 3, so
+ # drop it. No change to level of protection b/c we patch our toolchain.
+ sed -i -e 's/-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2//' configure || die
+
+ # Remove bundled modules
+ rm -r dtc meson roms/*/ || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}" || die
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-containers # bug #732972
+ --disable-guest-agent
+ --disable-strip
+ --with-git-submodules=ignore
+
+ # bug #746752: TCG interpreter has a few limitations:
+ # - it does not support FPU
+ # - it's generally slower on non-self-modifying code
+ # It's advantage is support for host architectures
+ # where native codegeneration is not implemented.
+ # Gentoo has qemu keyworded only on targets with
+ # native code generation available. Avoid the interpreter.
+ --disable-tcg-interpreter
+
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+
+ $(use_enable alsa)
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable jack)
+ $(use_enable nls gettext)
+ $(use_enable oss)
+ $(use_enable plugins)
+ $(use_enable pulseaudio pa)
+ $(use_enable selinux)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ # Enable option only for softmmu build, but not 'user' or 'tools'
+ conf_softmmu() {
+ if [[ ${buildtype} == "softmmu" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ # Enable option only for tools build, but not 'user' or 'softmmu'
+ conf_tools() {
+ if [[ ${buildtype} == "tools" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ # Special case for the malloc flag, because the --disable flag does
+ # not exist and trying like above will break configuring.
+ conf_malloc() {
+ if [[ ! ${buildtype} == "user" ]] ; then
+ usex "${1}" "--enable-malloc=${1}" ""
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_softmmu bpf)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser curl)
+ $(conf_tools doc docs)
+ $(conf_notuser fdt)
+ $(conf_notuser fuse)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
+ $(conf_malloc jemalloc)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser multipath mpath)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser pam auth-pam)
+ $(conf_notuser png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_softmmu sdl-image)
+ $(conf_notuser seccomp)
+ $(conf_notuser slirp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser udev libudev)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ # use prebuilt keymaps, bug #759604
+ --disable-xkbcommon
+ $(conf_notuser zstd)
+ )
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ # Note: backend order matters here: #716202
+ # We iterate from higher-level to lower level.
+ $(usex pulseaudio pa "")
+ $(usev jack)
+ $(usev sdl)
+ $(usev alsa)
+ $(usev oss)
+ )
+ conf_opts+=(
+ --audio-drv-list=$(IFS=,; echo "${audio_opts[*]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ --disable-cap-ng
+ --disable-seccomp
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ --enable-cap-ng
+ --enable-seccomp
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ --enable-cap-ng
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ # Meson will not use a cross-file unless cross_prefix is set.
+ tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
+
+ # Plumb through equivalent of EXTRA_ECONF to allow experiments
+ # like bug #747928.
+ conf_opts+=( ${EXTRA_CONF_QEMU} )
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build" || die
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build" || die
+ default
+ fi
+
+ cd "${S}/tools-build" || die
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build" || die
+ pax-mark m */qemu-system-* #515550
+ emake check
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dodoc check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build" || die
+ emake DESTDIR="${ED}" install
+
+ # If USE=doc, there'll be newly generated docs which we install instead.
+ if ! use doc && [[ ${QEMU_DOCS_PREBUILT} == 1 ]] ; then
+ doman "${WORKDIR}"/${PN}-${QEMU_DOCS_VERSION}-docs/docs/*.[0-8]
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null || die
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null || die
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}" || die
+ dodoc MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+
+ # PPC/PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin "${EROOT}"/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+
+ if has_version 'sys-firmware/edk2-ovmf-bin'; then
+ ewarn " $(best_version sys-firmware/edk2-ovmf-bin)"
+ else
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ fi
+
+ if has_version 'sys-firmware/seabios-bin'; then
+ ewarn " $(best_version sys-firmware/seabios-bin)"
+ else
+ ewarn " $(best_version sys-firmware/seabios)"
+ fi
+
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+
+ if has_version 'sys-firmware/edk2-ovmf-bin'; then
+ echo " $(best_version sys-firmware/edk2-ovmf-bin)"
+ else
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ fi
+
+ if has_version 'sys-firmware/seabios-bin'; then
+ echo " $(best_version sys-firmware/seabios-bin)"
+ else
+ echo " $(best_version sys-firmware/seabios)"
+ fi
+
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+ udev_reload
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2023-03-12 0:38 Andreas K. Hüttel
0 siblings, 0 replies; 66+ messages in thread
From: Andreas K. Hüttel @ 2023-03-12 0:38 UTC (permalink / raw
To: gentoo-commits
commit: 25016a2d27ade1c95fac6018c6fbe33ca5909347
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 12 00:37:47 2023 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 12 00:38:16 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25016a2d
app-emulation/qemu: rebase 2 patches for git master
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
.../qemu/files/qemu-8.0.0-disable-keymap.patch | 27 ++++++++++++++++++++++
app-emulation/qemu/files/qemu-8.0.0-make.patch | 12 ++++++++++
app-emulation/qemu/qemu-9999.ebuild | 4 ++--
3 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/app-emulation/qemu/files/qemu-8.0.0-disable-keymap.patch b/app-emulation/qemu/files/qemu-8.0.0-disable-keymap.patch
new file mode 100644
index 000000000000..aab5dde5fbd9
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.0.0-disable-keymap.patch
@@ -0,0 +1,27 @@
+diff -ruN qemu-9999.orig/meson.build qemu-9999/meson.build
+--- qemu-9999.orig/meson.build 2023-03-12 01:17:38.273756012 +0100
++++ qemu-9999/meson.build 2023-03-12 01:18:44.854716789 +0100
+@@ -667,6 +667,8 @@
+
+ if get_option('xkbcommon').auto() and not have_system and not have_tools
+ xkbcommon = not_found
++elif get_option('xkbcommon').disabled()
++ xkbcommon = not_found
+ else
+ xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
+ method: 'pkg-config', kwargs: static_kwargs)
+diff -ruN qemu-9999.orig/pc-bios/keymaps/meson.build qemu-9999/pc-bios/keymaps/meson.build
+--- qemu-9999.orig/pc-bios/keymaps/meson.build 2023-03-12 01:17:38.321756706 +0100
++++ qemu-9999/pc-bios/keymaps/meson.build 2023-03-12 01:20:22.015111600 +0100
+@@ -33,8 +33,10 @@
+ 'tr': '-l tr',
+ }
+
+-if meson.is_cross_build() or not xkbcommon.found()
++if meson.is_cross_build()
+ native_qemu_keymap = find_program('qemu-keymap', required: false, disabler: true)
++elif get_option('xkbcommon').disabled()
++ native_qemu_keymap = not_found
+ else
+ native_qemu_keymap = qemu_keymap
+ endif
diff --git a/app-emulation/qemu/files/qemu-8.0.0-make.patch b/app-emulation/qemu/files/qemu-8.0.0-make.patch
new file mode 100644
index 000000000000..4bf3f7157713
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.0.0-make.patch
@@ -0,0 +1,12 @@
+diff -ruN qemu-9999.orig/configure qemu-9999/configure
+--- qemu-9999.orig/configure 2023-03-12 01:26:15.488133462 +0100
++++ qemu-9999/configure 2023-03-12 01:29:19.355724020 +0100
+@@ -1068,7 +1068,7 @@
+ fi
+ fi
+
+-if ! has "$make"
++if ! has $make
+ then
+ error_exit "GNU make ($make) not found"
+ fi
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 61f5fdffb2eb..874bcfff7852 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -308,8 +308,8 @@ RDEPEND="${CDEPEND}
)"
PATCHES=(
- "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-6.0.0-make.patch
+ "${FILESDIR}"/${PN}-8.0.0-disable-keymap.patch
+ "${FILESDIR}"/${PN}-8.0.0-make.patch
"${FILESDIR}"/${PN}-7.1.0-also-build-virtfs-proxy-helper.patch
"${FILESDIR}"/${PN}-7.1.0-capstone-include-path.patch
)
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2023-05-05 18:11 Matthias Maier
0 siblings, 0 replies; 66+ messages in thread
From: Matthias Maier @ 2023-05-05 18:11 UTC (permalink / raw
To: gentoo-commits
commit: 4d673acc71014d69e776c5e1e737bd2d1eb8d055
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Fri May 5 17:38:34 2023 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Fri May 5 18:11:18 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d673acc
app-emulation/qemu: fix configure
Version 8.0.0 complains about not using internal meson when conifguring.
For the time being, simply disable the check. We should fix this
properly, though.
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
.../qemu-8.0.0-remove-python-meson-check.patch | 40 ++++++++++++++++++++++
app-emulation/qemu/qemu-8.0.0.ebuild | 1 +
2 files changed, 41 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-8.0.0-remove-python-meson-check.patch b/app-emulation/qemu/files/qemu-8.0.0-remove-python-meson-check.patch
new file mode 100644
index 000000000000..07d3836c57e4
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.0.0-remove-python-meson-check.patch
@@ -0,0 +1,40 @@
+diff --git a/configure b/configure
+index 4369fa5..7807ad5 100755
+--- a/configure
++++ b/configure
+@@ -1095,34 +1095,7 @@ has_meson() {
+ fi
+ }
+
+-if test -z "$meson"; then
+- if test "$explicit_python" = no && has_meson && version_ge "$(meson --version)" 0.61.5; then
+- meson=meson
+- elif test "$git_submodules_action" != 'ignore' ; then
+- meson=git
+- elif test -e "${source_path}/meson/meson.py" ; then
+- meson=internal
+- else
+- if test "$explicit_python" = yes; then
+- error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found."
+- else
+- error_exit "Meson not found. Use --meson=/path/to/meson"
+- fi
+- fi
+-else
+- # Meson uses its own Python interpreter to invoke other Python scripts,
+- # but the user wants to use the one they specified with --python.
+- #
+- # We do not want to override the distro Python interpreter (and sometimes
+- # cannot: for example in Homebrew /usr/bin/meson is a bash script), so
+- # just require --meson=git|internal together with --python.
+- if test "$explicit_python" = yes; then
+- case "$meson" in
+- git | internal) ;;
+- *) error_exit "--python requires using QEMU's embedded Meson distribution." ;;
+- esac
+- fi
+-fi
++meson=meson
+
+ if test "$meson" = git; then
+ git_submodules="${git_submodules} meson"
diff --git a/app-emulation/qemu/qemu-8.0.0.ebuild b/app-emulation/qemu/qemu-8.0.0.ebuild
index 76c3d4ecfbfc..3048bf51382f 100644
--- a/app-emulation/qemu/qemu-8.0.0.ebuild
+++ b/app-emulation/qemu/qemu-8.0.0.ebuild
@@ -308,6 +308,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-7.1.0-also-build-virtfs-proxy-helper.patch
"${FILESDIR}"/${PN}-7.1.0-capstone-include-path.patch
"${FILESDIR}"/${PN}-7.2.0-disable-gmp.patch
+ "${FILESDIR}"/${PN}-8.0.0-remove-python-meson-check.patch
)
QA_PREBUILT="
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2023-07-02 23:01 Sam James
0 siblings, 0 replies; 66+ messages in thread
From: Sam James @ 2023-07-02 23:01 UTC (permalink / raw
To: gentoo-commits
commit: dde094e8f986b73ffdcb3f71226aac92e415408a
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 2 22:58:04 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul 2 22:58:04 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dde094e8
app-emulation/qemu: fix CVE-2023-2861 for 7.2.3
Bug: https://bugs.gentoo.org/909542
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../qemu/files/qemu-7.2.3-CVE-2023-2861.patch | 162 ++++
app-emulation/qemu/qemu-7.2.3-r1.ebuild | 973 +++++++++++++++++++++
2 files changed, 1135 insertions(+)
diff --git a/app-emulation/qemu/files/qemu-7.2.3-CVE-2023-2861.patch b/app-emulation/qemu/files/qemu-7.2.3-CVE-2023-2861.patch
new file mode 100644
index 000000000000..9a9c11a41d66
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.2.3-CVE-2023-2861.patch
@@ -0,0 +1,162 @@
+https://bugs.gentoo.org/909542
+https://gitlab.com/qemu-project/qemu/-/commit/10fad73a2bf1c76c8aa9d6322755e5f877d83ce5
+
+From 10fad73a2bf1c76c8aa9d6322755e5f877d83ce5 Mon Sep 17 00:00:00 2001
+From: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Date: Wed, 7 Jun 2023 18:29:33 +0200
+Subject: [PATCH] 9pfs: prevent opening special files (CVE-2023-2861)
+
+The 9p protocol does not specifically define how server shall behave when
+client tries to open a special file, however from security POV it does
+make sense for 9p server to prohibit opening any special file on host side
+in general. A sane Linux 9p client for instance would never attempt to
+open a special file on host side, it would always handle those exclusively
+on its guest side. A malicious client however could potentially escape
+from the exported 9p tree by creating and opening a device file on host
+side.
+
+With QEMU this could only be exploited in the following unsafe setups:
+
+ - Running QEMU binary as root AND 9p 'local' fs driver AND 'passthrough'
+ security model.
+
+or
+
+ - Using 9p 'proxy' fs driver (which is running its helper daemon as
+ root).
+
+These setups were already discouraged for safety reasons before,
+however for obvious reasons we are now tightening behaviour on this.
+
+Fixes: CVE-2023-2861
+Reported-by: Yanwu Shen <ywsPlz@gmail.com>
+Reported-by: Jietao Xiao <shawtao1125@gmail.com>
+Reported-by: Jinku Li <jkli@xidian.edu.cn>
+Reported-by: Wenbo Shen <shenwenbo@zju.edu.cn>
+Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Reviewed-by: Greg Kurz <groug@kaod.org>
+Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
+Message-Id: <E1q6w7r-0000Q0-NM@lizzy.crudebyte.com>
+(cherry picked from commit f6b0de53fb87ddefed348a39284c8e2f28dc4eda)
+Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
+(Mjt: drop adding qemu_fstat wrapper for 7.2 where wrappers aren't used)
+--- a/fsdev/virtfs-proxy-helper.c
++++ b/fsdev/virtfs-proxy-helper.c
+@@ -26,6 +26,7 @@
+ #include "qemu/xattr.h"
+ #include "9p-iov-marshal.h"
+ #include "hw/9pfs/9p-proxy.h"
++#include "hw/9pfs/9p-util.h"
+ #include "fsdev/9p-iov-marshal.h"
+
+ #define PROGNAME "virtfs-proxy-helper"
+@@ -338,6 +339,28 @@ static void resetugid(int suid, int sgid)
+ }
+ }
+
++/*
++ * Open regular file or directory. Attempts to open any special file are
++ * rejected.
++ *
++ * returns file descriptor or -1 on error
++ */
++static int open_regular(const char *pathname, int flags, mode_t mode)
++{
++ int fd;
++
++ fd = open(pathname, flags, mode);
++ if (fd < 0) {
++ return fd;
++ }
++
++ if (close_if_special_file(fd) < 0) {
++ return -1;
++ }
++
++ return fd;
++}
++
+ /*
+ * send response in two parts
+ * 1) ProxyHeader
+@@ -682,7 +705,7 @@ static int do_create(struct iovec *iovec)
+ if (ret < 0) {
+ goto unmarshal_err_out;
+ }
+- ret = open(path.data, flags, mode);
++ ret = open_regular(path.data, flags, mode);
+ if (ret < 0) {
+ ret = -errno;
+ }
+@@ -707,7 +730,7 @@ static int do_open(struct iovec *iovec)
+ if (ret < 0) {
+ goto err_out;
+ }
+- ret = open(path.data, flags);
++ ret = open_regular(path.data, flags, 0);
+ if (ret < 0) {
+ ret = -errno;
+ }
+--- a/hw/9pfs/9p-util.h
++++ b/hw/9pfs/9p-util.h
+@@ -13,6 +13,8 @@
+ #ifndef QEMU_9P_UTIL_H
+ #define QEMU_9P_UTIL_H
+
++#include "qemu/error-report.h"
++
+ #ifdef O_PATH
+ #define O_PATH_9P_UTIL O_PATH
+ #else
+@@ -112,6 +114,38 @@ static inline void close_preserve_errno(int fd)
+ errno = serrno;
+ }
+
++/**
++ * close_if_special_file() - Close @fd if neither regular file nor directory.
++ *
++ * @fd: file descriptor of open file
++ * Return: 0 on regular file or directory, -1 otherwise
++ *
++ * CVE-2023-2861: Prohibit opening any special file directly on host
++ * (especially device files), as a compromised client could potentially gain
++ * access outside exported tree under certain, unsafe setups. We expect
++ * client to handle I/O on special files exclusively on guest side.
++ */
++static inline int close_if_special_file(int fd)
++{
++ struct stat stbuf;
++
++ if (fstat(fd, &stbuf) < 0) {
++ close_preserve_errno(fd);
++ return -1;
++ }
++ if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)) {
++ error_report_once(
++ "9p: broken or compromised client detected; attempt to open "
++ "special file (i.e. neither regular file, nor directory)"
++ );
++ close(fd);
++ errno = ENXIO;
++ return -1;
++ }
++
++ return 0;
++}
++
+ static inline int openat_dir(int dirfd, const char *name)
+ {
+ return openat(dirfd, name,
+@@ -146,6 +180,10 @@ again:
+ return -1;
+ }
+
++ if (close_if_special_file(fd) < 0) {
++ return -1;
++ }
++
+ serrno = errno;
+ /* O_NONBLOCK was only needed to open the file. Let's drop it. We don't
+ * do that with O_PATH since fcntl(F_SETFL) isn't supported, and openat()
+--
+GitLab
diff --git a/app-emulation/qemu/qemu-7.2.3-r1.ebuild b/app-emulation/qemu/qemu-7.2.3-r1.ebuild
new file mode 100644
index 000000000000..0d3fe65bb11f
--- /dev/null
+++ b/app-emulation/qemu/qemu-7.2.3-r1.ebuild
@@ -0,0 +1,973 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Generate using https://github.com/thesamesam/sam-gentoo-scripts/blob/main/niche/generate-qemu-docs
+# Set to 1 if prebuilt, 0 if not
+# (the construct below is to allow overriding from env for script)
+QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-1}
+QEMU_DOCS_PREBUILT_DEV=ajak
+QEMU_DOCS_VERSION="7.2.0"
+# Default to generating docs (inc. man pages) if no prebuilt; overridden later
+# bug #830088
+QEMU_DOC_USEFLAG="+doc"
+
+PYTHON_COMPAT=( python3_{9,10,11} )
+PYTHON_REQ_USE="ncurses,readline"
+
+FIRMWARE_ABI_VERSION="7.2.0"
+
+inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
+ pax-utils xdg-utils
+
+if [[ ${PV} == *9999* ]]; then
+ QEMU_DOCS_PREBUILT=0
+
+ EGIT_REPO_URI="https://gitlab.com/qemu-project/qemu.git/"
+ EGIT_SUBMODULES=(
+ tests/fp/berkeley-softfloat-3
+ tests/fp/berkeley-testfloat-3
+ ui/keycodemapdb
+ )
+ inherit git-r3
+ SRC_URI=""
+else
+ MY_P="${PN}-${PV/_rc/-rc}"
+ SRC_URI="https://download.qemu.org/${MY_P}.tar.xz"
+
+ if [[ ${QEMU_DOCS_PREBUILT} == 1 ]] ; then
+ SRC_URI+=" !doc? ( https://dev.gentoo.org/~${QEMU_DOCS_PREBUILT_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${QEMU_DOCS_VERSION}-docs.tar.xz )"
+ fi
+
+ S="${WORKDIR}/${MY_P}"
+ [[ "${PV}" != *_rc* ]] && KEYWORDS="amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+[[ ${QEMU_DOCS_PREBUILT} == 1 ]] && QEMU_DOC_USEFLAG="doc"
+
+IUSE="accessibility +aio alsa bpf bzip2 capstone +curl debug ${QEMU_DOC_USEFLAG}
+ +fdt fuse glusterfs +gnutls gtk infiniband iscsi io-uring
+ jack jemalloc +jpeg
+ lzo multipath
+ ncurses nfs nls numa opengl +oss pam +pin-upstream-blobs
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+ +slirp
+ smartcard snappy spice ssh static static-user systemtap test udev usb
+ usbredir vde +vhost-net virgl virtfs +vnc vte xattr xen
+ zstd"
+
+COMMON_TARGETS="
+ aarch64
+ alpha
+ arm
+ cris
+ hppa
+ i386
+ loongarch64
+ m68k
+ microblaze
+ microblazeel
+ mips
+ mips64
+ mips64el
+ mipsel
+ nios2
+ or1k
+ ppc
+ ppc64
+ riscv32
+ riscv64
+ s390x
+ sh4
+ sh4eb
+ sparc
+ sparc64
+ x86_64
+ xtensa
+ xtensaeb
+"
+IUSE_SOFTMMU_TARGETS="
+ ${COMMON_TARGETS}
+ avr
+ rx
+ tricore
+"
+IUSE_USER_TARGETS="
+ ${COMMON_TARGETS}
+ aarch64_be
+ armeb
+ hexagon
+ mipsn32
+ mipsn32el
+ ppc64le
+ sparc32plus
+"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="
+ ${PYTHON_REQUIRED_USE}
+ qemu_softmmu_targets_arm? ( fdt )
+ qemu_softmmu_targets_microblaze? ( fdt )
+ qemu_softmmu_targets_mips64el? ( fdt )
+ qemu_softmmu_targets_ppc64? ( fdt )
+ qemu_softmmu_targets_ppc? ( fdt )
+ qemu_softmmu_targets_riscv32? ( fdt )
+ qemu_softmmu_targets_riscv64? ( fdt )
+ qemu_softmmu_targets_x86_64? ( fdt )
+ sdl-image? ( sdl )
+ static? ( static-user !alsa !gtk !jack !opengl !pam !pulseaudio !plugins !rbd !snappy !udev )
+ static-user? ( !plugins )
+ virgl? ( opengl )
+ virtfs? ( xattr )
+ vnc? ( gnutls )
+ vte? ( gtk )
+ multipath? ( udev )
+ plugins? ( !static !static-user )
+"
+for smname in ${IUSE_SOFTMMU_TARGETS} ; do
+ REQUIRED_USE+=" qemu_softmmu_targets_${smname}? ( seccomp ) "
+done
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected). This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+ dev-libs/glib:2[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ python? ( ${PYTHON_DEPS} )
+ systemtap? ( dev-util/systemtap )
+ xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+ sys-libs/libcap-ng[static-libs(+)]
+ >=x11-libs/pixman-0.28.0[static-libs(+)]
+ accessibility? (
+ app-accessibility/brltty[api]
+ app-accessibility/brltty[static-libs(+)]
+ )
+ aio? ( dev-libs/libaio[static-libs(+)] )
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ bpf? ( dev-libs/libbpf:= )
+ bzip2? ( app-arch/bzip2[static-libs(+)] )
+ capstone? ( dev-libs/capstone:=[static-libs(+)] )
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.1[static-libs(+)] )
+ fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+ gnutls? (
+ >=net-libs/gnutls-3.0:=[static-libs(+)]
+ dev-libs/nettle:=[static-libs(+)]
+ )
+ gtk? (
+ x11-libs/cairo
+ x11-libs/gdk-pixbuf:2
+ x11-libs/gtk+:3
+ x11-libs/libX11
+ vte? ( x11-libs/vte:2.91 )
+ )
+ infiniband? ( sys-cluster/rdma-core[static-libs(+)] )
+ iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing:=[static-libs(+)] )
+ jack? ( virtual/jack )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( media-libs/libjpeg-turbo:=[static-libs(+)] )
+ lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ multipath? ( sys-fs/multipath-tools )
+ ncurses? (
+ sys-libs/ncurses:=[unicode(+)]
+ sys-libs/ncurses:=[static-libs(+)]
+ )
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+ numa? ( sys-process/numactl[static-libs(+)] )
+ opengl? (
+ virtual/opengl
+ media-libs/libepoxy[static-libs(+)]
+ media-libs/mesa[static-libs(+)]
+ media-libs/mesa[egl(+),gbm(+)]
+ )
+ pam? ( sys-libs/pam )
+ png? ( media-libs/libpng:0=[static-libs(+)] )
+ pulseaudio? ( media-libs/libpulse )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+ sdl? (
+ media-libs/libsdl2[video]
+ media-libs/libsdl2[static-libs(+)]
+ )
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ slirp? ( net-libs/libslirp[static-libs(+)] )
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+ snappy? ( app-arch/snappy:= )
+ spice? (
+ >=app-emulation/spice-protocol-0.12.3
+ >=app-emulation/spice-0.12.0[static-libs(+)]
+ )
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ udev? ( virtual/libudev:= )
+ usb? ( >=virtual/libusb-1-r2:1[static-libs(+)] )
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+ vde? ( net-misc/vde[static-libs(+)] )
+ virgl? ( media-libs/virglrenderer[static-libs(+)] )
+ virtfs? ( sys-libs/libcap )
+ xen? ( app-emulation/xen-tools:= )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
+
+EDK2_OVMF_VERSION="202202"
+SEABIOS_VERSION="1.16.0"
+
+X86_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/edk2-ovmf-bin-${EDK2_OVMF_VERSION}
+ ~sys-firmware/ipxe-1.21.1[binary,qemu]
+ ~sys-firmware/seabios-bin-${SEABIOS_VERSION}
+ ~sys-firmware/sgabios-0.1_pre10[binary]
+ )
+ !pin-upstream-blobs? (
+ || (
+ >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}
+ >=sys-firmware/edk2-ovmf-bin-${EDK2_OVMF_VERSION}
+ )
+ sys-firmware/ipxe[qemu]
+ || (
+ >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
+ >=sys-firmware/seabios-bin-${SEABIOS_VERSION}
+ )
+ sys-firmware/sgabios
+ )"
+PPC_FIRMWARE_DEPEND="
+ pin-upstream-blobs? (
+ ~sys-firmware/seabios-bin-${SEABIOS_VERSION}
+ )
+ !pin-upstream-blobs? (
+ || (
+ >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
+ >=sys-firmware/seabios-bin-${SEABIOS_VERSION}
+ )
+ )
+"
+
+BDEPEND="
+ $(python_gen_impl_dep)
+ dev-lang/perl
+ dev-util/meson
+ sys-apps/texinfo
+ virtual/pkgconfig
+ doc? (
+ dev-python/sphinx[${PYTHON_USEDEP}]
+ dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]
+ )
+ gtk? ( nls? ( sys-devel/gettext ) )
+ test? (
+ dev-libs/glib[utils]
+ sys-devel/bc
+ )
+"
+CDEPEND="
+ !static? (
+ ${ALL_DEPEND//\[static-libs(+)]}
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+ )
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+ static? (
+ ${ALL_DEPEND}
+ ${SOFTMMU_TOOLS_DEPEND}
+ )
+ static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+ acct-group/kvm
+ selinux? (
+ sec-policy/selinux-qemu
+ sys-libs/libselinux
+ )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
+ "${FILESDIR}"/${PN}-6.0.0-make.patch
+ "${FILESDIR}"/${PN}-7.1.0-also-build-virtfs-proxy-helper.patch
+ "${FILESDIR}"/${PN}-7.1.0-capstone-include-path.patch
+ "${FILESDIR}"/${PN}-7.2.0-disable-gmp.patch
+ "${FILESDIR}"/${PN}-7.2.0-linux-headers-6.2-glibc-2.36.patch
+ "${FILESDIR}"/${P}-CVE-2023-2861.patch
+)
+
+QA_PREBUILT="
+ usr/share/qemu/hppa-firmware.img
+ usr/share/qemu/openbios-ppc
+ usr/share/qemu/openbios-sparc64
+ usr/share/qemu/openbios-sparc32
+ usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
+ usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
+ usr/share/qemu/palcode-clipper
+ usr/share/qemu/s390-ccw.img
+ usr/share/qemu/s390-netboot.img
+ usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+ usr/bin/qemu-x86_64
+ usr/bin/qemu-alpha
+ usr/bin/qemu-arm
+ usr/bin/qemu-cris
+ usr/bin/qemu-m68k
+ usr/bin/qemu-microblaze
+ usr/bin/qemu-microblazeel
+ usr/bin/qemu-mips
+ usr/bin/qemu-mipsel
+ usr/bin/qemu-or1k
+ usr/bin/qemu-ppc
+ usr/bin/qemu-ppc64
+ usr/bin/qemu-sh4
+ usr/bin/qemu-sh4eb
+ usr/bin/qemu-sparc
+ usr/bin/qemu-sparc64
+ usr/bin/qemu-armeb
+ usr/bin/qemu-sparc32plus
+ usr/bin/qemu-s390x
+ usr/bin/qemu-unicore32
+"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+ For AMD CPUs the module is called 'kvm-amd'.
+ For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+ $ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it. You can tell udev to reset ownership/perms:
+ $ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+ # rc-update add qemu-binfmt
+For systemd:
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+ if use kernel_linux && kernel_is lt 2 6 25; then
+ eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
+ elif use kernel_linux; then
+ if ! linux_config_exists; then
+ eerror "Unable to check your kernel for KVM support"
+ else
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+ ERROR_KVM="You must enable KVM in your kernel to continue"
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+ ERROR_KVM_AMD+=" your kernel configuration."
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+ ERROR_TUN+=" into your kernel or loaded as a module to use the"
+ ERROR_TUN+=" virtual network device if using -net tap."
+ ERROR_BRIDGE="You will also need support for 802.1d"
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+ ERROR_VHOST_NET+=" support"
+
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+ if grep -q AuthenticAMD /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_AMD"
+ elif grep -q GenuineIntel /proc/cpuinfo; then
+ CONFIG_CHECK+=" ~KVM_INTEL"
+ fi
+ fi
+
+ use python && CONFIG_CHECK+=" ~DEBUG_FS"
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+ # Now do the actual checks setup above
+ check_extra_config
+ fi
+ fi
+
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+ eerror "instances are still pointing to it. Please update your"
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+ eerror "and the right system binary (e.g. qemu-system-x86_64)."
+ die "update your virt configs to not use qemu-kvm"
+ fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+ local var=$1 mak=$2
+ local detected sorted
+
+ pushd "${S}"/configs/targets/ >/dev/null || die
+
+ # Force C locale until glibc is updated. #564936
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+ if [[ ${sorted} != "${detected}" ]] ; then
+ eerror "The ebuild needs to be kept in sync."
+ eerror "${var}: ${sorted}"
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+ die "sync ${var} to the list of targets"
+ fi
+
+ popd >/dev/null
+}
+
+src_prepare() {
+ check_targets IUSE_SOFTMMU_TARGETS softmmu
+ check_targets IUSE_USER_TARGETS linux-user
+
+ default
+
+ # Use correct toolchain to fix cross-compiling
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
+ export WINDRES=${CHOST}-windres
+
+ # Verbose builds
+ MAKEOPTS+=" V=1"
+
+ # We already force -D_FORTIFY_SOURCE=2 (or 3) in our toolchain, but
+ # this setting (-U then -D..=2) will prevent us from trying out 3, so
+ # drop it. No change to level of protection b/c we patch our toolchain.
+ sed -i -e 's/-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2//' configure || die
+
+ # Remove bundled modules
+ rm -r dtc meson roms/*/ || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local buildtype=$1
+ local builddir="${S}/${buildtype}-build"
+
+ mkdir "${builddir}" || die
+
+ local conf_opts=(
+ --prefix=/usr
+ --sysconfdir=/etc
+ --bindir=/usr/bin
+ --libdir=/usr/$(get_libdir)
+ --datadir=/usr/share
+ --docdir=/usr/share/doc/${PF}/html
+ --mandir=/usr/share/man
+ --localstatedir=/var
+ --disable-bsd-user
+ --disable-containers # bug #732972
+ --disable-guest-agent
+ --disable-strip
+ --with-git-submodules=ignore
+
+ # bug #746752: TCG interpreter has a few limitations:
+ # - it does not support FPU
+ # - it's generally slower on non-self-modifying code
+ # It's advantage is support for host architectures
+ # where native codegeneration is not implemented.
+ # Gentoo has qemu keyworded only on targets with
+ # native code generation available. Avoid the interpreter.
+ --disable-tcg-interpreter
+
+ --disable-werror
+ # We support gnutls/nettle for crypto operations. It is possible
+ # to use gcrypt when gnutls/nettle are disabled (but not when they
+ # are enabled), but it's not really worth the hassle. Disable it
+ # all the time to avoid automatically detecting it. #568856
+ --disable-gcrypt
+ --cc="$(tc-getCC)"
+ --cxx="$(tc-getCXX)"
+ --host-cc="$(tc-getBUILD_CC)"
+
+ $(use_enable alsa)
+ $(use_enable debug debug-info)
+ $(use_enable debug debug-tcg)
+ $(use_enable jack)
+ $(use_enable nls gettext)
+ $(use_enable oss)
+ $(use_enable plugins)
+ $(use_enable pulseaudio pa)
+ $(use_enable selinux)
+ $(use_enable xattr attr)
+ )
+
+ # Disable options not used by user targets. This simplifies building
+ # static user targets (USE=static-user) considerably.
+ conf_notuser() {
+ if [[ ${buildtype} == "user" ]] ; then
+ echo "--disable-${2:-$1}"
+ else
+ use_enable "$@"
+ fi
+ }
+ # Enable option only for softmmu build, but not 'user' or 'tools'
+ conf_softmmu() {
+ if [[ ${buildtype} == "softmmu" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ # Enable option only for tools build, but not 'user' or 'softmmu'
+ conf_tools() {
+ if [[ ${buildtype} == "tools" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ # Special case for the malloc flag, because the --disable flag does
+ # not exist and trying like above will break configuring.
+ conf_malloc() {
+ if [[ ! ${buildtype} == "user" ]] ; then
+ usex "${1}" "--enable-malloc=${1}" ""
+ fi
+ }
+ conf_opts+=(
+ $(conf_notuser accessibility brlapi)
+ $(conf_notuser aio linux-aio)
+ $(conf_softmmu bpf)
+ $(conf_notuser bzip2)
+ $(conf_notuser capstone)
+ $(conf_notuser curl)
+ $(conf_tools doc docs)
+ $(conf_notuser fdt)
+ $(conf_notuser fuse)
+ $(conf_notuser glusterfs)
+ $(conf_notuser gnutls)
+ $(conf_notuser gnutls nettle)
+ $(conf_notuser gtk)
+ $(conf_notuser infiniband rdma)
+ $(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
+ $(conf_malloc jemalloc)
+ $(conf_notuser jpeg vnc-jpeg)
+ $(conf_notuser kernel_linux kvm)
+ $(conf_notuser lzo)
+ $(conf_notuser multipath mpath)
+ $(conf_notuser ncurses curses)
+ $(conf_notuser nfs libnfs)
+ $(conf_notuser numa)
+ $(conf_notuser opengl)
+ $(conf_notuser pam auth-pam)
+ $(conf_notuser png)
+ $(conf_notuser rbd)
+ $(conf_notuser sasl vnc-sasl)
+ $(conf_notuser sdl)
+ $(conf_softmmu sdl-image)
+ $(conf_notuser seccomp)
+ $(conf_notuser slirp)
+ $(conf_notuser smartcard)
+ $(conf_notuser snappy)
+ $(conf_notuser spice)
+ $(conf_notuser ssh libssh)
+ $(conf_notuser udev libudev)
+ $(conf_notuser usb libusb)
+ $(conf_notuser usbredir usb-redir)
+ $(conf_notuser vde)
+ $(conf_notuser vhost-net)
+ $(conf_notuser virgl virglrenderer)
+ $(conf_softmmu virtfs)
+ $(conf_notuser vnc)
+ $(conf_notuser vte)
+ $(conf_notuser xen)
+ $(conf_notuser xen xen-pci-passthrough)
+ # use prebuilt keymaps, bug #759604
+ --disable-xkbcommon
+ $(conf_notuser zstd)
+ )
+
+ if [[ ! ${buildtype} == "user" ]] ; then
+ # audio options
+ local audio_opts=(
+ # Note: backend order matters here: #716202
+ # We iterate from higher-level to lower level.
+ $(usex pulseaudio pa "")
+ $(usev jack)
+ $(usev sdl)
+ $(usev alsa)
+ $(usev oss)
+ )
+ conf_opts+=(
+ --audio-drv-list=$(IFS=,; echo "${audio_opts[*]}")
+ )
+ fi
+
+ case ${buildtype} in
+ user)
+ conf_opts+=(
+ --enable-linux-user
+ --disable-system
+ --disable-blobs
+ --disable-tools
+ --disable-cap-ng
+ --disable-seccomp
+ )
+ local static_flag="static-user"
+ ;;
+ softmmu)
+ conf_opts+=(
+ --disable-linux-user
+ --enable-system
+ --disable-tools
+ --enable-cap-ng
+ --enable-seccomp
+ )
+ local static_flag="static"
+ ;;
+ tools)
+ conf_opts+=(
+ --disable-linux-user
+ --disable-system
+ --disable-blobs
+ --enable-tools
+ --enable-cap-ng
+ )
+ local static_flag="static"
+ ;;
+ esac
+
+ local targets="${buildtype}_targets"
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+ # Add support for SystemTAP
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+ # We always want to attempt to build with PIE support as it results
+ # in a more secure binary. But it doesn't work with static or if
+ # the current GCC doesn't have PIE support.
+ if use ${static_flag}; then
+ conf_opts+=( --static --disable-pie )
+ else
+ tc-enables-pie && conf_opts+=( --enable-pie )
+ fi
+
+ # Meson will not use a cross-file unless cross_prefix is set.
+ tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
+
+ # Plumb through equivalent of EXTRA_ECONF to allow experiments
+ # like bug #747928.
+ conf_opts+=( ${EXTRA_CONF_QEMU} )
+
+ echo "../configure ${conf_opts[*]}"
+ cd "${builddir}"
+ ../configure "${conf_opts[@]}" || die "configure failed"
+}
+
+src_configure() {
+ local target
+
+ python_setup
+
+ softmmu_targets= softmmu_bins=()
+ user_targets= user_bins=()
+
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do
+ if use "qemu_softmmu_targets_${target}"; then
+ softmmu_targets+=",${target}-softmmu"
+ softmmu_bins+=( "qemu-system-${target}" )
+ fi
+ done
+
+ for target in ${IUSE_USER_TARGETS} ; do
+ if use "qemu_user_targets_${target}"; then
+ user_targets+=",${target}-linux-user"
+ user_bins+=( "qemu-${target}" )
+ fi
+ done
+
+ softmmu_targets=${softmmu_targets#,}
+ user_targets=${user_targets#,}
+
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+ [[ -n ${user_targets} ]] && qemu_src_configure "user"
+ qemu_src_configure "tools"
+}
+
+src_compile() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build" || die
+ default
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build" || die
+ default
+ fi
+
+ cd "${S}/tools-build" || die
+ default
+}
+
+src_test() {
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build" || die
+ pax-mark m */qemu-system-* #515550
+ emake check
+ fi
+}
+
+qemu_python_install() {
+ python_domodule "${S}/python/qemu"
+
+ python_doscript "${S}/scripts/kvm/vmxcap"
+ python_doscript "${S}/scripts/qmp/qmp-shell"
+ python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+ local out="${T}/qemu-binfmt"
+ local out_systemd="${T}/qemu.conf"
+ local d="${T}/binfmt.d"
+
+ einfo "Generating qemu binfmt scripts and configuration files"
+
+ # Generate the debian fragments first.
+ mkdir -p "${d}"
+ "${S}"/scripts/qemu-binfmt-conf.sh \
+ --debian \
+ --exportdir "${d}" \
+ --qemu-path "${EPREFIX}/usr/bin" \
+ || die
+ # Then turn the fragments into a shell script we can source.
+ sed -E -i \
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \
+ "${d}"/* || die
+
+ # Generate the init.d script by assembling the fragments from above.
+ local f qcpu package interpreter magic mask
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+ for f in "${d}"/qemu-* ; do
+ source "${f}"
+
+ # Normalize the cpu logic like we do in the init.d for the native cpu.
+ qcpu=${package#qemu-}
+ case ${qcpu} in
+ arm*) qcpu="arm";;
+ mips*) qcpu="mips";;
+ ppc*) qcpu="ppc";;
+ s390*) qcpu="s390";;
+ sh*) qcpu="sh";;
+ sparc*) qcpu="sparc";;
+ esac
+
+ # we use 'printf' here to be portable across 'sh'
+ # implementations: #679168
+ cat <<EOF >>"${out}"
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+ fi
+EOF
+
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+ done
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+ if [[ -n ${user_targets} ]]; then
+ cd "${S}/user-build"
+ emake DESTDIR="${ED}" install
+
+ # Install binfmt handler init script for user targets.
+ generate_initd
+ doinitd "${T}/qemu-binfmt"
+
+ # Install binfmt/qemu.conf.
+ insinto "/usr/share/qemu/binfmt.d"
+ doins "${T}/qemu.conf"
+ fi
+
+ if [[ -n ${softmmu_targets} ]]; then
+ cd "${S}/softmmu-build"
+ emake DESTDIR="${ED}" install
+
+ # This might not exist if the test failed. #512010
+ [[ -e check-report.html ]] && dodoc check-report.html
+
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
+ fi
+
+ if use python; then
+ python_foreach_impl qemu_python_install
+ fi
+ fi
+
+ cd "${S}/tools-build" || die
+ emake DESTDIR="${ED}" install
+
+ # If USE=doc, there'll be newly generated docs which we install instead.
+ if ! use doc && [[ ${QEMU_DOCS_PREBUILT} == 1 ]] ; then
+ doman "${WORKDIR}"/${PN}-${QEMU_DOCS_VERSION}-docs/docs/*.[0-8]
+ fi
+
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+ pushd "${ED}"/usr/bin >/dev/null || die
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+ popd >/dev/null || die
+
+ # Install config file example for qemu-bridge-helper
+ insinto "/etc/qemu"
+ doins "${FILESDIR}/bridge.conf"
+
+ cd "${S}" || die
+ dodoc MAINTAINERS docs/specs/pci-ids.txt
+ newdoc pc-bios/README README.pc-bios
+
+ # Disallow stripping of prebuilt firmware files.
+ dostrip -x ${QA_PREBUILT}
+
+ if [[ -n ${softmmu_targets} ]]; then
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+ fi
+
+ # Remove vgabios since we're using the seavgabios packaged one
+ rm "${ED}/usr/share/qemu/vgabios.bin"
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+
+ # PPC/PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+ fi
+
+ # Remove sgabios since we're using the sgabios packaged one
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+ fi
+
+ # Remove iPXE since we're using the iPXE packaged one
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+ fi
+ fi
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+pkg_postinst() {
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+ udev_reload
+ fi
+
+ xdg_icon_cache_update
+
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+ fcaps cap_net_admin "${EROOT}"/usr/libexec/qemu-bridge-helper
+
+ DISABLE_AUTOFORMATTING=true
+ readme.gentoo_print_elog
+
+ if use pin-upstream-blobs && firmware_abi_change; then
+ ewarn "This version of qemu pins new versions of firmware blobs:"
+
+ if has_version 'sys-firmware/edk2-ovmf-bin'; then
+ ewarn " $(best_version sys-firmware/edk2-ovmf-bin)"
+ else
+ ewarn " $(best_version sys-firmware/edk2-ovmf)"
+ fi
+
+ if has_version 'sys-firmware/seabios-bin'; then
+ ewarn " $(best_version sys-firmware/seabios-bin)"
+ else
+ ewarn " $(best_version sys-firmware/seabios)"
+ fi
+
+ ewarn " $(best_version sys-firmware/ipxe)"
+ ewarn " $(best_version sys-firmware/sgabios)"
+ ewarn "This might break resume of hibernated guests (started with a different"
+ ewarn "firmware version) and live migration to/from qemu versions with different"
+ ewarn "firmware. Please (cold) restart all running guests. For functional"
+ ewarn "guest migration ensure that all"
+ ewarn "hosts run at least"
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+ fi
+}
+
+pkg_info() {
+ echo "Using:"
+ echo " $(best_version app-emulation/spice-protocol)"
+
+ if has_version 'sys-firmware/edk2-ovmf-bin'; then
+ echo " $(best_version sys-firmware/edk2-ovmf-bin)"
+ else
+ echo " $(best_version sys-firmware/edk2-ovmf)"
+ fi
+
+ if has_version 'sys-firmware/seabios-bin'; then
+ echo " $(best_version sys-firmware/seabios-bin)"
+ else
+ echo " $(best_version sys-firmware/seabios)"
+ fi
+
+ echo " $(best_version sys-firmware/ipxe)"
+ echo " $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+ udev_reload
+}
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2023-08-26 3:51 Sam James
0 siblings, 0 replies; 66+ messages in thread
From: Sam James @ 2023-08-26 3:51 UTC (permalink / raw
To: gentoo-commits
commit: ce974471d1bc7a9b33fa138f54f35f0e9bc7a77b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 26 03:49:00 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 26 03:49:00 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce974471
app-emulation/qemu: add 8.1.0
Fix some test failures too (skip a test which fails for me, probably kernel
config or network-sandbox related + crank up timeouts).
Closes: https://bugs.gentoo.org/865647
Closes: https://bugs.gentoo.org/867766
Signed-off-by: Sam James <sam <AT> gentoo.org>
app-emulation/qemu/Manifest | 2 +
.../qemu/files/qemu-8.1.0-find-sphinx.patch | 10 ++++
.../qemu/files/qemu-8.1.0-skip-tests.patch | 64 ++++++++++++++++++++++
.../qemu/{qemu-9999.ebuild => qemu-8.1.0.ebuild} | 21 +++----
app-emulation/qemu/qemu-9999.ebuild | 19 +++----
5 files changed, 93 insertions(+), 23 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index e871a96f3f50..76f90e7c8da0 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -8,3 +8,5 @@ DIST qemu-8.0.0.tar.xz 127835148 BLAKE2B 9b54aae10fe09691a26e68374723ded5fdda640
DIST qemu-8.0.2.tar.xz 126707132 BLAKE2B f2b1a63e10c42aabfe39722c7732d0f04818ad367b769b3deb29c5bf9adcabc3aca1706f3c40fafeeb57ac1f7a61ded5066de32134c483e2fd27bc65b4b7d30a SHA512 4e915d33a662bf55b09247fb85150be376c92270d3764e3d6470c452cb70cc558f54e84de5610dd60a9eb3ea02d5d4277b1ec75c9804967d278fa8361c7f9b9a
DIST qemu-8.0.3.tar.xz 126710536 BLAKE2B 071cc1a35209a02e8c5dd4f43cb112f110b4655adb0f870a04fdf9a6e2c761699574e8c9426f70f60787a99acf252d7a64d94a8e837cdfeda93d89428d7866f3 SHA512 18b2ccb65f7ec2ae92f0e04406539620c881e2b75f63816588c86043a07464bb99d16a83e792ed9508de393f4b694c46d52f4d07edf52741e85224c8b8d5d5c3
DIST qemu-8.0.4.tar.xz 126179324 BLAKE2B dfb98964c629b251f0004b4630ae4500a52465579417d6f5c7dbbb1f672e10d8d7ffb98a4b00e26fb98b3c867208146dbdca026e4d30cbf1752ac733c4d9b915 SHA512 bd5ed682d51f974abd4be93f949701f9b5bfb87fd9929e31df130534da2f2c03b99adc9f924b3efd47d3b254e0e3c0046f4e69fbe9f6d0c4ac1f6babecb29449
+DIST qemu-8.1.0-docs.tar.xz 2129912 BLAKE2B 8aaf7b748538afdb5bcb6da15dbd96572d086824377c4b0e93f1ddc695f9a4775471e360a9616d2d481dbf8113e91d2601c69d92cef565fb90b65ffacfdb304e SHA512 905515742bb56a439fc8117ec48ea668e7b2bf0244587673e4352d9e8e49911eb84ff093596ff566e44787197cf9789ec8950e3d75fb7a670c5546394a322ac9
+DIST qemu-8.1.0.tar.xz 123550284 BLAKE2B b0fd87a19b13d4bbc6526caa46533073cb4dee6004df5d4fbbef204ee3bc8c2f10ec1eaff554adbb25c9f3143dd68abd09d4a0519c4766299a3ff261d03c73f2 SHA512 c5f5e7ce2d8e3c93a02012b136c866e8577df07da4705a0045916c71caeaa21fa1b2d59a4b22a660789a4159b192e12a443e7cbb0724ee85fea258251731724c
diff --git a/app-emulation/qemu/files/qemu-8.1.0-find-sphinx.patch b/app-emulation/qemu/files/qemu-8.1.0-find-sphinx.patch
new file mode 100644
index 000000000000..b6ef6214af55
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.1.0-find-sphinx.patch
@@ -0,0 +1,10 @@
+This gets confused by python-any-r1 and tries to find sphinx-build in ${T}.
+--- a/docs/meson.build
++++ b/docs/meson.build
+@@ -1,5 +1,4 @@
+-sphinx_build = find_program(fs.parent(python.full_path()) / 'sphinx-build',
+- required: get_option('docs'))
++sphinx_build = find_program('sphinx-build', required: get_option('docs'))
+
+ # Check if tools are available to build documentation.
+ build_docs = false
diff --git a/app-emulation/qemu/files/qemu-8.1.0-skip-tests.patch b/app-emulation/qemu/files/qemu-8.1.0-skip-tests.patch
new file mode 100644
index 000000000000..f668584e8d4b
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-8.1.0-skip-tests.patch
@@ -0,0 +1,64 @@
+* netdev-socket.c
+qtest-i386/netdev-socket fails with:
+```
+stderr:
+qemu-system-i386: -netdev dgram,id=st0,remote.type=inet,remote.host=230.0.0.1,remote.port=1234: can't add socket to multicast group 230.0.0.1: No such device
+Broken pipe
+../tests/qtest/libqtest.c:191: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0)
+```
+
+* vhost-user-test.c
+qtest-x86_64/qos-test fails with a timeout:
+```
+qemu-system-x86_64: Failed to set msg fds.
+qemu-system-x86_64: vhost VQ 0 ring restore failed: -22: Invalid argument (22)
+qemu-system-x86_64: Failed to set msg fds.
+qemu-system-x86_64: vhost VQ 1 ring restore failed: -22: Invalid argument (22)
+**
+ERROR:../tests/qtest/vhost-user-test.c:892:wait_for_rings_started: assertion failed (ctpop64(s->rings) == count): (1 == 2)
+**
+ERROR:../tests/qtest/qos-test.c:191:subprocess_run_one_test: child process (/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-net-pci/virtio-net/virtio-net-tests/vhost-user/reconnect/subprocess [6082]) failed unexpectedl
+```
+
+--- a/tests/qtest/netdev-socket.c
++++ b/tests/qtest/netdev-socket.c
+@@ -498,6 +498,10 @@ int main(int argc, char **argv)
+ socket_init();
+ g_test_init(&argc, &argv, NULL);
+
++ /* XXX: Skip test for now on Gentoo, fails with "No such device" */
++ g_test_skip("Skipping test known to fail on Gentoo");
++ return 0;
++
+ if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) {
+ g_error("socket_check_protocol_support() failed\n");
+ }
+--- a/tests/qtest/vhost-user-test.c
++++ b/tests/qtest/vhost-user-test.c
+@@ -243,7 +243,7 @@ static bool wait_for_fds(TestServer *s)
+
+ g_mutex_lock(&s->data_mutex);
+
+- end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
++ end_time = g_get_monotonic_time() + 30 * G_TIME_SPAN_SECOND;
+ while (!s->fds_num) {
+ if (!g_cond_wait_until(&s->data_cond, &s->data_mutex, end_time)) {
+ /* timeout has passed */
+@@ -672,7 +672,7 @@ static void wait_for_log_fd(TestServer *s)
+ gint64 end_time;
+
+ g_mutex_lock(&s->data_mutex);
+- end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
++ end_time = g_get_monotonic_time() + 30 * G_TIME_SPAN_SECOND;
+ while (s->log_fd == -1) {
+ if (!g_cond_wait_until(&s->data_cond, &s->data_mutex, end_time)) {
+ /* timeout has passed */
+@@ -885,7 +885,7 @@ static void wait_for_rings_started(TestServer *s, size_t count)
+ gint64 end_time;
+
+ g_mutex_lock(&s->data_mutex);
+- end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
++ end_time = g_get_monotonic_time() + 30 * G_TIME_SPAN_SECOND;
+ while (ctpop64(s->rings) != count) {
+ if (!g_cond_wait_until(&s->data_cond, &s->data_mutex, end_time)) {
+ /* timeout has passed */
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-8.1.0.ebuild
similarity index 98%
copy from app-emulation/qemu/qemu-9999.ebuild
copy to app-emulation/qemu/qemu-8.1.0.ebuild
index 2fccbf5de576..9fb08f07e76f 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-8.1.0.ebuild
@@ -6,14 +6,14 @@ EAPI=8
# Generate using https://github.com/thesamesam/sam-gentoo-scripts/blob/main/niche/generate-qemu-docs
# Set to 1 if prebuilt, 0 if not
# (the construct below is to allow overriding from env for script)
-QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-0}
+QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-1}
QEMU_DOCS_PREBUILT_DEV=sam
QEMU_DOCS_VERSION=$(ver_cut 1-3)
# Default to generating docs (inc. man pages) if no prebuilt; overridden later
# bug #830088
QEMU_DOC_USEFLAG="+doc"
-PYTHON_COMPAT=( python3_{9,10,11,12} )
+PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="ncurses,readline"
FIRMWARE_ABI_VERSION="7.2.0"
@@ -204,7 +204,7 @@ SOFTMMU_TOOLS_DEPEND="
media-libs/mesa[egl(+),gbm(+)]
)
pam? ( sys-libs/pam )
- pipewire? ( media-video/pipewire )
+ pipewire? ( >=media-video/pipewire-0.3.60 )
png? ( >=media-libs/libpng-1.6.34:=[static-libs(+)] )
pulseaudio? ( media-libs/libpulse )
rbd? ( sys-cluster/ceph )
@@ -271,11 +271,10 @@ PPC_FIRMWARE_DEPEND="
BDEPEND="
$(python_gen_impl_dep)
dev-lang/perl
- dev-util/meson
- sys-apps/texinfo
+ >=dev-util/meson-0.63.0
virtual/pkgconfig
doc? (
- dev-python/sphinx[${PYTHON_USEDEP}]
+ >=dev-python/sphinx-1.6.0[${PYTHON_USEDEP}]
dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]
)
gtk? ( nls? ( sys-devel/gettext ) )
@@ -310,6 +309,8 @@ PATCHES=(
"${FILESDIR}"/${PN}-8.0.0-disable-keymap.patch
"${FILESDIR}"/${PN}-7.1.0-capstone-include-path.patch
"${FILESDIR}"/${PN}-8.1.0-also-build-virtfs-proxy-helper.patch
+ "${FILESDIR}"/${PN}-8.1.0-skip-tests.patch
+ "${FILESDIR}"/${PN}-8.1.0-find-sphinx.patch
)
QA_PREBUILT="
@@ -450,11 +451,6 @@ src_prepare() {
# Verbose builds
MAKEOPTS+=" V=1"
- # We already force -D_FORTIFY_SOURCE=2 (or 3) in our toolchain, but
- # this setting (-U then -D..=2) will prevent us from trying out 3, so
- # drop it. No change to level of protection b/c we patch our toolchain.
- sed -i -e 's/-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2//' configure || die
-
# Remove bundled modules
rm -r subprojects/dtc roms/*/ || die
}
@@ -484,7 +480,7 @@ qemu_src_configure() {
--disable-containers # bug #732972
--disable-guest-agent
--disable-strip
- --with-git-submodules=ignore
+ --disable-download
# bug #746752: TCG interpreter has a few limitations:
# - it does not support FPU
@@ -503,6 +499,7 @@ qemu_src_configure() {
--disable-gcrypt
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
+ --objcc="$(tc-getCC)"
--host-cc="$(tc-getBUILD_CC)"
$(use_enable alsa)
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index 2fccbf5de576..e9ea36363d60 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -13,7 +13,7 @@ QEMU_DOCS_VERSION=$(ver_cut 1-3)
# bug #830088
QEMU_DOC_USEFLAG="+doc"
-PYTHON_COMPAT=( python3_{9,10,11,12} )
+PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="ncurses,readline"
FIRMWARE_ABI_VERSION="7.2.0"
@@ -204,7 +204,7 @@ SOFTMMU_TOOLS_DEPEND="
media-libs/mesa[egl(+),gbm(+)]
)
pam? ( sys-libs/pam )
- pipewire? ( media-video/pipewire )
+ pipewire? ( >=media-video/pipewire-0.3.60 )
png? ( >=media-libs/libpng-1.6.34:=[static-libs(+)] )
pulseaudio? ( media-libs/libpulse )
rbd? ( sys-cluster/ceph )
@@ -271,11 +271,10 @@ PPC_FIRMWARE_DEPEND="
BDEPEND="
$(python_gen_impl_dep)
dev-lang/perl
- dev-util/meson
- sys-apps/texinfo
+ >=dev-util/meson-0.63.0
virtual/pkgconfig
doc? (
- dev-python/sphinx[${PYTHON_USEDEP}]
+ >=dev-python/sphinx-1.6.0[${PYTHON_USEDEP}]
dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]
)
gtk? ( nls? ( sys-devel/gettext ) )
@@ -310,6 +309,8 @@ PATCHES=(
"${FILESDIR}"/${PN}-8.0.0-disable-keymap.patch
"${FILESDIR}"/${PN}-7.1.0-capstone-include-path.patch
"${FILESDIR}"/${PN}-8.1.0-also-build-virtfs-proxy-helper.patch
+ "${FILESDIR}"/${PN}-8.1.0-skip-tests.patch
+ "${FILESDIR}"/${PN}-8.1.0-find-sphinx.patch
)
QA_PREBUILT="
@@ -450,11 +451,6 @@ src_prepare() {
# Verbose builds
MAKEOPTS+=" V=1"
- # We already force -D_FORTIFY_SOURCE=2 (or 3) in our toolchain, but
- # this setting (-U then -D..=2) will prevent us from trying out 3, so
- # drop it. No change to level of protection b/c we patch our toolchain.
- sed -i -e 's/-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2//' configure || die
-
# Remove bundled modules
rm -r subprojects/dtc roms/*/ || die
}
@@ -484,7 +480,7 @@ qemu_src_configure() {
--disable-containers # bug #732972
--disable-guest-agent
--disable-strip
- --with-git-submodules=ignore
+ --disable-download
# bug #746752: TCG interpreter has a few limitations:
# - it does not support FPU
@@ -503,6 +499,7 @@ qemu_src_configure() {
--disable-gcrypt
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
+ --objcc="$(tc-getCC)"
--host-cc="$(tc-getBUILD_CC)"
$(use_enable alsa)
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
@ 2024-10-06 9:37 Sam James
0 siblings, 0 replies; 66+ messages in thread
From: Sam James @ 2024-10-06 9:37 UTC (permalink / raw
To: gentoo-commits
commit: ae494864d28b0d027b67b39d665dfb51c60f3df5
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 6 09:36:36 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 6 09:37:26 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae494864
app-emulation/qemu: add 9.1.0
Signed-off-by: Sam James <sam <AT> gentoo.org>
app-emulation/qemu/Manifest | 2 ++
.../files/qemu-9.1.0-capstone-include-path.patch | 33 ++++++++++++++++++++++
.../qemu/{qemu-9999.ebuild => qemu-9.1.0.ebuild} | 4 +--
app-emulation/qemu/qemu-9999.ebuild | 4 +--
4 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 062718123b31..9f7bf8f38f65 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -19,3 +19,5 @@ DIST qemu-9.0.0-docs.tar.xz 2290196 BLAKE2B 82d22637ff2629bee372550e86651f12051e
DIST qemu-9.0.1.tar.xz 132368412 BLAKE2B e96ae5cc3ee935dd31232d38d46bbdc74fd3a2a0dd8517c0e035757f3ded92712dfa68d0068cd8c37f314a92d237e2b4a725b509ba402b7a1ce92df63207a08d SHA512 6c120aaf52f15e79c32d883cc83df8fc83222d538ea6be9c19aaddfba0aef91479b5826bbc03e58688fba639cb24bc6f54e525ccc2404ed5d820766d11735210
DIST qemu-9.0.2.tar.xz 132387528 BLAKE2B 6b5301f985919ae53e056410be7486b8150a65016127568bd4d58f596e94960d08eb3fc57cff7ff6a3435d71274adee516f57375d856d61b4fc7a3f24cbf75c4 SHA512 58ed84f6fe6263d279356bc9193f96edf62cf3663fb151daa3f047d52329fe49cb91c2d45e09697e0469f4f5409be96403aec9572d4871ffa40848a786c21599
DIST qemu-9.0.3.tar.xz 132420136 BLAKE2B af44ee6d3e59c28bb84cbf78a4793fa120a7cb811ab0fb0aba7b61d0b2eeb0e47dd094a4a0af9570e26d584f7ae867d46b6f61903610e155deb6479d8ea60fa4 SHA512 fcd72896ae9f9f654628540e09472c8388d980f8081990ee541f3540f92c5fd0d9332fa343dc9eaa6d7fe3dc2a5668d7d5c3784ba9d49bd7df9d37a4f9df7572
+DIST qemu-9.1.0-docs.tar.xz 2376072 BLAKE2B 31d13133b3a2e21a7d9b5af028407610ae8f2fa61dd296fc35e57fc12eb66cfd1a39ec5e3b5a3852095d10a388f424f8a38417b3ab58ca30d0817ece779328cf SHA512 5b705b577daad6aa010d5c713db9dc314114334b89901840ebcecc9032595a969f5ad9054e42b36b2be5ef9f5d6dc1159841ff46dbb08314b5c48491aa631040
+DIST qemu-9.1.0.tar.xz 132478356 BLAKE2B 77bdaf00e6111e6ac94462a6023aac0d3df9d2829a961fd89a5bdafc4aee7f95c2695d9319715e630960e64512a41b3ff987c9096692ff304cfd49357b46ef62 SHA512 bf61d65e37945fa8ee8640712c719ace05164d86e6df700b98bdc5f79e0a8d5e8f85bd48e726edb62b2419db20673f63ec8b63a60393a914b09cb365621b35e2
diff --git a/app-emulation/qemu/files/qemu-9.1.0-capstone-include-path.patch b/app-emulation/qemu/files/qemu-9.1.0-capstone-include-path.patch
new file mode 100644
index 000000000000..7bb6a004d866
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-9.1.0-capstone-include-path.patch
@@ -0,0 +1,33 @@
+From: Sam James <sam@gentoo.org>
+Date: Sun, 6 Oct 2024 09:47:03 +0100
+Subject: [PATCH] Forward ported from qemu-7.1.0-capstone-include-path.patch.
+
+Bug: https://bugs.gentoo.org/873157
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ include/disas/capstone.h | 2 +-
+ meson.build | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/include/disas/capstone.h
++++ b/include/disas/capstone.h
+@@ -4,7 +4,7 @@
+ #ifdef CONFIG_CAPSTONE
+
+ #define CAPSTONE_AARCH64_COMPAT_HEADER
+-#include <capstone.h>
++#include <capstone/capstone.h>
+
+ #else
+
+--- a/meson.build
++++ b/meson.build
+@@ -1769,7 +1769,7 @@ if not get_option('capstone').auto() or have_system or have_user
+ # that reports a wrong -I path, causing the #include to
+ # fail later. If the system has such a broken version
+ # do not use it.
+- if capstone.found() and not cc.compiles('#include <capstone.h>',
++ if capstone.found() and not cc.compiles('#include <capstone/capstone.h>',
+ dependencies: [capstone])
+ capstone = not_found
+ if get_option('capstone').enabled()
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9.1.0.ebuild
similarity index 99%
copy from app-emulation/qemu/qemu-9999.ebuild
copy to app-emulation/qemu/qemu-9.1.0.ebuild
index c959ff18faaf..549817d8345e 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9.1.0.ebuild
@@ -6,7 +6,7 @@ EAPI=8
# Generate using https://github.com/thesamesam/sam-gentoo-scripts/blob/main/niche/generate-qemu-docs
# Set to 1 if prebuilt, 0 if not
# (the construct below is to allow overriding from env for script)
-QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-0}
+QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-1}
QEMU_DOCS_PREBUILT_DEV=sam
QEMU_DOCS_VERSION=$(ver_cut 1-3)
# Default to generating docs (inc. man pages) if no prebuilt; overridden later
@@ -318,7 +318,7 @@ RDEPEND="
PATCHES=(
"${FILESDIR}"/${PN}-9.0.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-9.0.0-capstone-include-path.patch
+ "${FILESDIR}"/${PN}-9.1.0-capstone-include-path.patch
"${FILESDIR}"/${PN}-9.0.0-also-build-virtfs-proxy-helper.patch
"${FILESDIR}"/${PN}-8.1.0-skip-tests.patch
"${FILESDIR}"/${PN}-8.1.0-find-sphinx.patch
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index c959ff18faaf..549817d8345e 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -6,7 +6,7 @@ EAPI=8
# Generate using https://github.com/thesamesam/sam-gentoo-scripts/blob/main/niche/generate-qemu-docs
# Set to 1 if prebuilt, 0 if not
# (the construct below is to allow overriding from env for script)
-QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-0}
+QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-1}
QEMU_DOCS_PREBUILT_DEV=sam
QEMU_DOCS_VERSION=$(ver_cut 1-3)
# Default to generating docs (inc. man pages) if no prebuilt; overridden later
@@ -318,7 +318,7 @@ RDEPEND="
PATCHES=(
"${FILESDIR}"/${PN}-9.0.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-9.0.0-capstone-include-path.patch
+ "${FILESDIR}"/${PN}-9.1.0-capstone-include-path.patch
"${FILESDIR}"/${PN}-9.0.0-also-build-virtfs-proxy-helper.patch
"${FILESDIR}"/${PN}-8.1.0-skip-tests.patch
"${FILESDIR}"/${PN}-8.1.0-find-sphinx.patch
^ permalink raw reply related [flat|nested] 66+ messages in thread
end of thread, other threads:[~2024-10-06 9:37 UTC | newest]
Thread overview: 66+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-10 2:23 [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/ Matthias Maier
-- strict thread matches above, loose matches on Subject: below --
2024-10-06 9:37 Sam James
2023-08-26 3:51 Sam James
2023-07-02 23:01 Sam James
2023-05-05 18:11 Matthias Maier
2023-03-12 0:38 Andreas K. Hüttel
2023-02-22 11:32 Sam James
2023-01-18 18:59 John Helmert III
2022-09-16 19:41 Georgy Yakovlev
2022-07-05 1:05 WANG Xuerui
2022-04-04 18:44 John Helmert III
2022-01-11 13:40 Matthias Maier
2021-12-20 6:42 Matthias Maier
2021-12-08 1:23 John Helmert III
2021-10-11 3:49 John Helmert III
2021-09-23 2:08 Matthias Maier
2021-05-26 6:54 Sergei Trofimovich
2021-05-12 6:55 Sergei Trofimovich
2021-04-12 19:39 Sergei Trofimovich
2021-02-01 18:01 Sergei Trofimovich
2021-01-31 14:29 Sergei Trofimovich
2021-01-31 9:38 Sergei Trofimovich
2020-12-14 8:46 Sergei Trofimovich
2020-12-10 9:02 Sergei Trofimovich
2020-11-24 8:38 Sergei Trofimovich
2020-09-20 8:23 Sergei Trofimovich
2020-09-19 7:33 Sergei Trofimovich
2020-09-05 7:08 Sergei Trofimovich
2020-08-13 22:36 Sergei Trofimovich
2020-07-09 22:55 Sergei Trofimovich
2020-04-30 23:47 Sergei Trofimovich
2020-04-18 22:06 Matthias Maier
2020-04-08 18:51 Matthias Maier
2020-02-06 15:52 Matthias Maier
2019-09-22 2:12 Matthias Maier
2019-07-28 18:21 Matthias Maier
2019-05-19 23:42 Matthias Maier
2019-04-29 6:48 Matthias Maier
2018-12-19 21:47 Matthias Maier
2018-08-19 17:49 Matthias Maier
2018-07-23 15:06 Jason Donenfeld
2018-06-15 17:47 Matthias Maier
2018-03-27 16:18 Matthias Maier
2018-02-12 22:48 Matthias Maier
2018-02-11 20:27 Matthias Maier
2017-09-01 1:32 Matthias Maier
2017-07-26 19:37 Matthias Maier
2017-07-26 18:57 Matthias Maier
2017-05-18 4:20 Matthias Maier
2017-04-29 21:32 Matthias Maier
2017-04-12 5:03 Matthias Maier
2017-02-21 12:03 Matthias Maier
2017-02-13 6:40 Matthias Maier
2017-02-13 4:58 Matthias Maier
2017-01-20 19:28 Mike Frysinger
2016-12-29 20:09 Mike Frysinger
2016-10-26 21:48 Matthias Maier
2016-09-18 4:33 Matthias Maier
2016-03-28 22:03 Mike Frysinger
2016-02-15 15:27 Doug Goldstein
2016-01-18 4:59 Mike Frysinger
2015-12-17 15:12 Mike Frysinger
2015-10-15 20:24 Markos Chandras
2015-10-10 0:59 Mike Frysinger
2015-09-07 5:50 Mike Frysinger
2015-08-10 11:05 Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox