diff options
Diffstat (limited to 'user')
22 files changed, 1003 insertions, 0 deletions
diff --git a/user/qemu/0001-elfload-load-PIE-executables-to-right-address.patch b/user/qemu/0001-elfload-load-PIE-executables-to-right-address.patch new file mode 100644 index 000000000..1cf0c2bd1 --- /dev/null +++ b/user/qemu/0001-elfload-load-PIE-executables-to-right-address.patch @@ -0,0 +1,89 @@ +From 6818f32f74981d9bccec8afbab37c42b50ab58be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> +Date: Thu, 4 Jul 2013 15:50:36 +0300 +Subject: [RFC PATCH] elfload: load PIE executables to right address +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +PIE images are ET_DYN images. Check first for pinterp_name to make +sure the main executable always is loaded to correct place. + +See below for current behaviour of PIE executables: + +Reserved 0x7f000000 bytes of guest address space +host mmap_min_addr=0x1000 +guest_base 0x7f7cb41d5000 +start end size prot +0037f400-003fe400 0007f000 r-x +003fe400-003ff400 00001000 --- +003ff400-003fe400 fffff000 rw- +003fe400-003ff400 00001000 --- +003ff400-003ffc00 00000800 rw- +003ffc00-003fec00 fffff000 r-x +003fec00-003ffc00 00001000 --- +003ffc00-0007f000 ffc7f400 rw- +start_brk 0x00000000 +end_code 0x7eff7ac0 +start_code 0x7eff7000 +start_data 0x7efffac0 +end_data 0x7efffc18 +start_stack 0x7eff6dc8 +brk 0x7efffc34 +entry 0x7e799b30 +00000000-00005000 ---p 00000000 00:00 0 +00005000-00015000 rw-p 00000000 00:00 0 +00015000-7e77d000 ---p 00000000 00:00 0 +7e77d000-7e7ec000 r-xp 00000000 68:03 14326298 /lib/libc.so +7e7ec000-7e7f3000 ---p 00000000 00:00 0 +7e7f3000-7e7f4000 rw-p 0006e000 68:03 14326298 /lib/libc.so +7e7f4000-7e7f6000 rw-p 00000000 00:00 0 +7e7f6000-7e7f7000 ---p 00000000 00:00 0 +7e7f7000-7eff7000 rw-p 00000000 00:00 0 +7eff7000-7eff8000 r-xp 00000000 68:03 9731305 /usr/bin/brk +7eff8000-7efff000 ---p 00000000 00:00 0 +7e7f7000-7eff7000 rw-p 00000000 00:00 0 [stack] + +Showing how the main binary got loaded to wrong place. + +Signed-off-by: Timo Teräs <timo.teras@iki.fi> +--- +I assume pinterp_name is only ever set for the main executable. +Quick grep would indicate that this is indeed the case. + + linux-user/elfload.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/linux-user/elfload.c b/linux-user/elfload.c +index ddef23e..d6e00cd 100644 +--- a/linux-user/elfload.c ++++ b/linux-user/elfload.c +@@ -1660,7 +1660,12 @@ static void load_elf_image(const char *image_name, int image_fd, + } + + load_addr = loaddr; +- if (ehdr->e_type == ET_DYN) { ++ if (pinterp_name != NULL) { ++ /* This is the main executable. Make sure that the low ++ address does not conflict with MMAP_MIN_ADDR or the ++ QEMU application itself. */ ++ probe_guest_base(image_name, loaddr, hiaddr); ++ } else if (ehdr->e_type == ET_DYN) { + /* The image indicates that it can be loaded anywhere. Find a + location that can hold the memory space required. If the + image is pre-linked, LOADDR will be non-zero. Since we do +@@ -1672,11 +1677,6 @@ static void load_elf_image(const char *image_name, int image_fd, + if (load_addr == -1) { + goto exit_perror; + } +- } else if (pinterp_name != NULL) { +- /* This is the main executable. Make sure that the low +- address does not conflict with MMAP_MIN_ADDR or the +- QEMU application itself. */ +- probe_guest_base(image_name, loaddr, hiaddr); + } + load_bias = load_addr - loaddr; + +-- +1.8.3.2 + diff --git a/user/qemu/0001-linux-user-fix-build-with-musl-on-aarch64.patch b/user/qemu/0001-linux-user-fix-build-with-musl-on-aarch64.patch new file mode 100644 index 000000000..1bbae7dea --- /dev/null +++ b/user/qemu/0001-linux-user-fix-build-with-musl-on-aarch64.patch @@ -0,0 +1,31 @@ +From 806cb2ed28a16cf2894fabef034347f426f1d04e Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Thu, 15 Dec 2016 11:53:07 +0100 +Subject: [PATCH] linux-user: fix build with musl on aarch64 + +Use the standard uint64_t instead of internal __u64. + +This fixes compiler error with musl libc on aarch64: +.../qemu-2.7.0/linux-user/host/aarch64/hostdep.h:28:5: +error: unknown type name '__u64' + __u64 *pcreg = &uc->uc_mcontext.pc; + ^~~~~ + +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> +--- + linux-user/host/aarch64/hostdep.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h +index 64f75cef49..6fd6e36b2a 100644 +--- a/linux-user/host/aarch64/hostdep.h ++++ b/linux-user/host/aarch64/hostdep.h +@@ -25,7 +25,7 @@ extern char safe_syscall_end[]; + static inline void rewind_if_in_safe_syscall(void *puc) + { + ucontext_t *uc = puc; +- __u64 *pcreg = &uc->uc_mcontext.pc; ++ uint64_t *pcreg = &uc->uc_mcontext.pc; + + if (*pcreg > (uintptr_t)safe_syscall_start + && *pcreg < (uintptr_t)safe_syscall_end) { diff --git a/user/qemu/0001-linux-user-fix-build-with-musl-on-ppc64le.patch b/user/qemu/0001-linux-user-fix-build-with-musl-on-ppc64le.patch new file mode 100644 index 000000000..c3a918775 --- /dev/null +++ b/user/qemu/0001-linux-user-fix-build-with-musl-on-ppc64le.patch @@ -0,0 +1,67 @@ +--- a/linux-user/host/ppc64/hostdep.h ++++ b/linux-user/host/ppc64/hostdep.h +@@ -25,7 +25,11 @@ + static inline void rewind_if_in_safe_syscall(void *puc) + { + ucontext_t *uc = puc; ++#if defined(__GLIBC__) || defined(__UCLIBC__) + unsigned long *pcreg = &uc->uc_mcontext.gp_regs[PT_NIP]; ++#else // Musl ++ unsigned long *pcreg = &uc->uc_mcontext.gp_regs[32]; ++#endif + + if (*pcreg > (uintptr_t)safe_syscall_start + && *pcreg < (uintptr_t)safe_syscall_end) { +--- a/accel/tcg/user-exec.c ++++ a/accel/tcg/user-exec.c +@@ -228,6 +228,7 @@ + */ + #ifdef linux + /* All Registers access - only for local access */ ++#if defined(__GLIBC__) || defined(__UCLIBC__) + #define REG_sig(reg_name, context) \ + ((context)->uc_mcontext.regs->reg_name) + /* Gpr Registers access */ +@@ -245,15 +246,42 @@ + /* Condition register */ + #define CR_sig(context) REG_sig(ccr, context) + ++#else // Musl ++#define REG_sig(reg_num, context) \ ++ ((context)->uc_mcontext.gp_regs[reg_num]) ++/* Gpr Registers access */ ++#define GPR_sig(reg_num, context) REG_sig(gpr[reg_num], context) ++/* Program counter */ ++#define IAR_sig(context) REG_sig(32, context) ++/* Machine State Register (Supervisor) */ ++#define MSR_sig(context) REG_sig(33, context) ++/* Count register */ ++#define CTR_sig(context) REG_sig(35, context) ++/* User's integer exception register */ ++#define XER_sig(context) REG_sig(37, context) ++/* Link register */ ++#define LR_sig(context) REG_sig(36, context) ++/* Condition register */ ++#define CR_sig(context) REG_sig(38, context) ++#endif ++ ++ + /* Float Registers access */ + #define FLOAT_sig(reg_num, context) \ + (((double *)((char *)((context)->uc_mcontext.regs + 48 * 4)))[reg_num]) + #define FPSCR_sig(context) \ + (*(int *)((char *)((context)->uc_mcontext.regs + (48 + 32 * 2) * 4))) + /* Exception Registers access */ ++#if defined(__GLIBC__) || defined(__UCLIBC__) + #define DAR_sig(context) REG_sig(dar, context) + #define DSISR_sig(context) REG_sig(dsisr, context) + #define TRAP_sig(context) REG_sig(trap, context) ++#else // Musl ++#define DAR_sig(context) REG_sig(41, context) ++#define DSISR_sig(context) REG_sig(42, context) ++#define TRAP_sig(context) REG_sig(40, context) ++#endif ++ + #endif /* linux */ + + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) diff --git a/user/qemu/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch b/user/qemu/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch new file mode 100644 index 000000000..7ea1dba6d --- /dev/null +++ b/user/qemu/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch @@ -0,0 +1,37 @@ +From 3e231fa7a2dc66e2ef06ac44f4f719b08fc0c67e Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Tue, 29 Apr 2014 15:51:31 +0200 +Subject: [PATCH 6/6] linux-user/signal.c: define __SIGRTMIN/MAX for non-GNU + platforms + +The __SIGRTMIN and __SIGRTMAX are glibc internals and are not available +on all platforms, so we define those if they are missing. + +This is needed for musl libc. + +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> +--- + linux-user/signal.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/linux-user/signal.c b/linux-user/signal.c +index 7d6246f..6019dbb 100644 +--- a/linux-user/signal.c ++++ b/linux-user/signal.c +@@ -32,6 +32,13 @@ + + //#define DEBUG_SIGNAL + ++#ifndef __SIGRTMIN ++#define __SIGRTMIN 32 ++#endif ++#ifndef __SIGRTMAX ++#define __SIGRTMAX (NSIG-1) ++#endif ++ + static struct target_sigaltstack target_sigaltstack_used = { + .ss_sp = 0, + .ss_size = 0, +-- +1.9.2 + diff --git a/user/qemu/12-12-Fix-configure-for-s390-qemu-on-alpine.patch b/user/qemu/12-12-Fix-configure-for-s390-qemu-on-alpine.patch new file mode 100644 index 000000000..38b32da2a --- /dev/null +++ b/user/qemu/12-12-Fix-configure-for-s390-qemu-on-alpine.patch @@ -0,0 +1,56 @@ +From patchwork Fri Jan 19 16:42:59 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [12/12] Fix configure for s390 qemu on alpine +X-Patchwork-Submitter: Christian Borntraeger <borntraeger@de.ibm.com> +X-Patchwork-Id: 863654 +Message-Id: <1516380179-12737-1-git-send-email-borntraeger@de.ibm.com> +To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, + Peter Maydell <peter.maydell@linaro.org>, + Paolo Bonzini <pbonzini@redhat.com> +Cc: Christian Borntraeger <borntraeger@de.ibm.com>, + Alice Frosi <alice@linux.vnet.ibm.com>, + Alice Frosi <alice@linux.vnet.ibm.comx> +Date: Fri, 19 Jan 2018 17:42:59 +0100 +From: Christian Borntraeger <borntraeger@de.ibm.com> +List-Id: <qemu-devel.nongnu.org> + +From: Alice Frosi <alice@linux.vnet.ibm.comx> + +In alpine docker image the qemu-system-s390x build is broken and +it throws this error: +qemu-system-s390x: Initialization of device s390-ipl failed: could not +load bootloader 's390-ccw.img' + +The grep command of busybox uses regex. This fails on binary data +(e.g. stops on every \0), so it does not identify the string +BiGeNdIaN in the test case big/little. Therefore, it assumes +that the architecture is little endian. + +This fix solves the grep problem by printing the content of +TMPO with strings + +Signed-off-by: Alice Frosi <alice@linux.vnet.ibm.com> +Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> +[some changes to patch description, add -a option to strings] +--- + configure | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 6d8c996..383b14e 100755 +--- a/configure ++++ b/configure +@@ -1906,9 +1906,9 @@ int main(int argc, char *argv[]) { + EOF + + if compile_object ; then +- if grep -q BiGeNdIaN $TMPO ; then ++ if strings -a $TMPO | grep -q BiGeNdIaN ; then + bigendian="yes" +- elif grep -q LiTtLeEnDiAn $TMPO ; then ++ elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then + bigendian="no" + else + echo big/little test failed diff --git a/user/qemu/80-kvm.rules b/user/qemu/80-kvm.rules new file mode 100644 index 000000000..e61b48ff3 --- /dev/null +++ b/user/qemu/80-kvm.rules @@ -0,0 +1 @@ +KERNEL=="kvm", GROUP="kvm", MODE="0666" diff --git a/user/qemu/APKBUILD b/user/qemu/APKBUILD new file mode 100644 index 000000000..da6bd1ecf --- /dev/null +++ b/user/qemu/APKBUILD @@ -0,0 +1,397 @@ +# Contributor: Sergei Lukin <sergej.lukin@gmail.com> +# Contributor: Valery Kartel <valery.kartel@gmail.com> +# Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Contributor: Natanael Copa <ncopa@alpinelinux.org> +# Maintainer: A. Wilcox <awilfox@adelielinux.org> +pkgname=qemu +pkgver=2.12.0 +pkgrel=0 +pkgdesc="QEMU is a generic machine emulator and virtualizer" +url="http://qemu.org/" +arch="all" +license="GPL-2.0-only LGPL-2.1-only" +makedepends=" + alsa-lib-dev + bison + curl-dev + flex + glib-dev + glib-static + gnutls-dev + gtk+3.0-dev + icu-dev + icu-static + libaio-dev + libcap-dev + libcap-ng-dev + libjpeg-turbo-dev + libnfs-dev + libpng-dev + libssh2-dev + libusb-dev + libx11-dev + libxml2-dev + linux-headers + lzo-dev + ncurses-dev + paxmark + python3 + snappy-dev + spice-dev + texinfo + usbredir-dev + util-linux-dev + vde2-dev + xfsprogs-dev + zlib-dev + " +pkggroups="qemu" +install="$pkgname.pre-install $pkgname.post-install" +# suid needed for qemu-bridge-helper +# strip fails on .img files +# some tests does not run on our builders +# ROMs confuse dbg +options="suid !strip !check !dbg" +subpackages="$pkgname-doc $pkgname-lang $pkgname-guest-agent:guest + $pkgname-user $pkgname-system" + +_user_subsystems=" + aarch64 + alpha + arm + armeb + cris + hppa + i386 + m68k + microblaze + microblazeel + mips + mips64 + mips64el + mipsel + mipsn32 + mipsn32el + or1k + ppc + ppc64 + ppc64abi32 + ppc64le + s390x + sh4 + sh4eb + sparc + sparc32plus + sparc64 + tilegx + x86_64" +_system_subsystems=" + system-aarch64 + system-alpha + system-arm + system-cris + system-hppa + system-i386 + system-lm32 + system-m68k + system-microblaze + system-microblazeel + system-mips + system-mips64 + system-mips64el + system-mipsel + system-moxie + system-nios2 + system-or1k + system-ppc + system-ppc64 + system-ppcemb + system-riscv32 + system-riscv64 + system-s390x + system-sh4 + system-sh4eb + system-sparc + system-sparc64 + system-tricore + system-unicore32 + system-x86_64 + system-xtensa + system-xtensaeb + " +_subsystems="$_user_subsystems $_system_subsystems" +for _sub in $_subsystems; do + subpackages="$subpackages $pkgname-$_sub:_subsys" +done + +case "$CARCH" in + x86) _arch=i386 ;; + x86_64) _arch=x86_64 ;; + *) _arch="" ;; +esac +if [ -n "$_arch" ]; then + subpackages="$subpackages $pkgname-gtk" + gtk() { _subsys system-$_arch-gtk; } +fi + +subpackages="$subpackages $pkgname-img" # -img must be declared the last + +source="http://wiki.qemu-project.org/download/$pkgname-$pkgver.tar.bz2 + 0001-elfload-load-PIE-executables-to-right-address.patch + 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch + 0001-linux-user-fix-build-with-musl-on-aarch64.patch + musl-F_SHLCK-and-F_EXLCK.patch + fix-sigevent-and-sigval_t.patch + xattr_size_max.patch + ncurses.patch + ignore-signals-33-and-64-to-allow-golang-emulation.patch + 0001-linux-user-fix-build-with-musl-on-ppc64le.patch + fix-sockios-header.patch + test-crypto-ivgen-skip-essiv.patch + ppc-Fix-size-of-ppc64-xer-register-fwd.patch + sysinfo-header.patch + fix-lm32-underlinking.patch + + $pkgname-guest-agent.confd + $pkgname-guest-agent.initd + 80-kvm.rules + bridge.conf + " +builddir="$srcdir/$pkgname-$pkgver" + +# secfixes: +# 2.8.1-r1: +# - CVE-2016-7994 +# - CVE-2016-7995 +# - CVE-2016-8576 +# - CVE-2016-8577 +# - CVE-2016-8578 +# - CVE-2016-8668 +# - CVE-2016-8909 +# - CVE-2016-8910 +# - CVE-2016-9101 +# - CVE-2016-9102 +# - CVE-2016-9103 +# - CVE-2016-9104 +# - CVE-2016-9105 +# - CVE-2016-9106 +# - CVE-2017-2615 +# - CVE-2017-2620 +# - CVE-2017-5525 +# - CVE-2017-5552 +# - CVE-2017-5578 +# - CVE-2017-5579 +# - CVE-2017-5667 +# - CVE-2017-5856 +# - CVE-2017-5857 +# - CVE-2017-5898 +# - CVE-2017-5931 + +prepare() { + default_prepare # apply patches + + sed -i 's/^VL_LDFLAGS=$/VL_LDFLAGS=-Wl,-z,execheap/' \ + Makefile.target +} + +_compile_common() { + # -lx11 needed for qemu-system-lm32 + "$builddir"/configure \ + --prefix=/usr \ + --localstatedir=/var \ + --sysconfdir=/etc \ + --libexecdir=/usr/lib/qemu \ + --disable-glusterfs \ + --disable-debug-info \ + --disable-bsd-user \ + --disable-werror \ + --disable-sdl \ + --disable-xen \ + --cc="${CC:-gcc}" \ + --python="/usr/bin/python3" \ + "$@" + make ARFLAGS="rc" +} + +_compile_system() { + _compile_common \ + --audio-drv-list=oss,alsa \ + --enable-kvm \ + --enable-vde \ + --enable-virtfs \ + --enable-curl \ + --enable-cap-ng \ + --enable-linux-aio \ + --enable-usb-redir \ + --enable-libssh2 \ + --enable-vhost-net \ + --enable-snappy \ + --enable-tpm \ + --enable-libnfs \ + --enable-lzo \ + --enable-docs \ + --enable-curses \ + --enable-pie \ + --disable-linux-user \ + "$@" +} + +build() { + local systems + mkdir -p "$builddir"/build \ + "$builddir"/build-user \ + "$builddir"/build-gtk + + cd "$builddir"/build-user + _compile_common \ + --enable-linux-user \ + --disable-system \ + --static + + cd "$builddir"/build + _compile_system \ + --enable-vnc \ + --enable-vnc-png \ + --enable-vnc-jpeg \ + --enable-spice \ + --enable-guest-agent \ + --disable-gtk + + if [ -n "$_arch" ]; then + cd "$builddir"/build-gtk + _compile_system \ + --enable-gtk \ + --with-gtkabi=3.0 \ + --disable-vnc \ + --disable-spice \ + --disable-guest-agent \ + --target-list="$_arch-softmmu" + fi +} + +check() { + cd "$builddir"/build + + # XXX: ESSIV crypto tests are disabled, see test-crypto-ivgen-skip-essiv.patch. + make check V=1 +} + +package() { + cd "$builddir"/build-user + make DESTDIR="$pkgdir" install + + cd "$builddir"/build + make DESTDIR="$pkgdir" install + paxmark -m "$pkgdir"/usr/bin/qemu-system-* + + install -Dm640 -g qemu "$srcdir"/bridge.conf \ + "$pkgdir"/etc/qemu/bridge.conf + + install -Dm644 "$srcdir"/80-kvm.rules \ + "$pkgdir"/lib/udev/rules.d/80-kvm.rules + + # qemu-bridge-helper needs suid to create tunX devices; + # allow only users in the qemu group to run it. + chmod 04710 "$pkgdir"/usr/lib/qemu/qemu-bridge-helper + chgrp qemu "$pkgdir"/usr/lib/qemu/qemu-bridge-helper + + if [ -n "$_arch" ]; then + cd "$builddir"/build-gtk + install $_arch-softmmu/qemu-system-$_arch \ + "$pkgdir"/usr/bin/qemu-system-$_arch-gtk + fi + + # Do not install HTML docs. + rm "$pkgdir"/usr/share/doc/qemu/*.html +} + +_subsys() { + local name=${1:-"${subpkgname#$pkgname-}"} + pkgdesc="Qemu ${name/-/ } emulator" + options="" + depends="" + case "$name" in + system*) depends="qemu";; + esac + + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/qemu-$name "$subpkgdir"/usr/bin/ +} + +img() { + pkgdesc="QEMU command line tool for manipulating disk images" + depends="" + options="" + + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/qemu-img \ + "$pkgdir"/usr/bin/qemu-io \ + "$pkgdir"/usr/bin/qemu-nbd \ + "$subpkgdir"/usr/bin/ + + # We exploit the fact that -img subpackage are created last + # and check that we done have new systems that belongs in + # subpackage. + local path= retval=0 + for path in "$pkgdir"/usr/bin/qemu-system-*; do + if [ -r "$path" ]; then + error "Please create a subpackage for ${path##*/}" + retval=1 + fi + done + return $retval +} + +user() { + pkgdesc="All QEMU user targets (metapackage)" + depends="" + local u + for u in $_user_subsystems; do + depends="qemu-$u $depends" + done + mkdir -p "$subpkgdir" +} + +system() { + pkgdesc="All QEMU system targets (metapackage)" + depends="" + local s + for s in $_system_subsystems; do + depends="qemu-$s $depends" + done + mkdir -p "$subpkgdir" +} + +guest() { + pkgdesc="QEMU guest agent" + depends="" + options="" + + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/qemu-ga "$subpkgdir"/usr/bin/ + + install -Dm755 "$srcdir"/$pkgname-guest-agent.initd \ + "$subpkgdir"/etc/init.d/$pkgname-guest-agent + install -Dm644 "$srcdir"/$pkgname-guest-agent.confd \ + "$subpkgdir"/etc/conf.d/$pkgname-guest-agent +} + +sha512sums="91d829f44c431e4c1cd335f3efea5afff9da62d832b0296a92417463ea0826d09ce226c2ea8ac167fe7b99b6bb976c7cb1357aaf17735ee57af6602161e46346 qemu-2.12.0.tar.bz2 +405008589cad1c8b609eca004d520bf944366e8525f85a19fc6e283c95b84b6c2429822ba064675823ab69f1406a57377266a65021623d1cd581e7db000134fd 0001-elfload-load-PIE-executables-to-right-address.patch +ec84b27648c01c6e58781295dcd0c2ff8e5a635f9836ef50c1da5d0ed125db1afc4cb5b01cb97606d6dd8f417acba93e1560d9a32ca29161a4bb730b302440ea 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch +1ac043312864309e19f839a699ab2485bca51bbf3d5fdb39f1a87b87e3cbdd8cbda1a56e6b5c9ffccd65a8ac2f600da9ceb8713f4dbba26f245bc52bcd8a1c56 0001-linux-user-fix-build-with-musl-on-aarch64.patch +224f5b44da749921e8a821359478c5238d8b6e24a9c0b4c5738c34e82f3062ec4639d495b8b5883d304af4a0d567e38aa6623aac1aa3a7164a5757c036528ac0 musl-F_SHLCK-and-F_EXLCK.patch +5da8114b9bd2e62f0f1f0f73f393fdbd738c5dea827ea60cedffd6f6edd0f5a97489c7148d37a8ec5a148d4e65d75cbefe9353714ee6b6f51a600200133fc914 fix-sigevent-and-sigval_t.patch +4b1e26ba4d53f9f762cbd5cea8ef6f8062d827ae3ae07bc36c5b0c0be4e94fc1856ad2477e8e791b074b8a25d51ed6d0ddd75e605e54600e5dd0799143793ce4 xattr_size_max.patch +b6ed02aaf95a9bb30a5f107d35371207967edca058f3ca11348b0b629ea7a9c4baa618db68a3df72199eea6d86d14ced74a5a229d17604cc3f0adedcfeae7a73 ncurses.patch +fd178f2913639a0c33199b3880cb17536961f2b3ff171c12b27f4be6bca032d6b88fd16302d09c692bb34883346babef5c44407a6804b20a39a465bb2bc85136 ignore-signals-33-and-64-to-allow-golang-emulation.patch +d8933df9484158c2b4888254e62117d78f8ed7c18527b249419f39c2b2ab1afa148010884b40661f8965f1ef3105580fceffdfddbb2c9221dc1c62066722ba65 0001-linux-user-fix-build-with-musl-on-ppc64le.patch +39590476a4ebd7c1e79a4f0451b24c75b1817a2a83abaa1f71bb60b225d772152f0af8f3e51ff65645e378c536ffa6ff551dade52884d03a14b7c6a19c5c97d4 fix-sockios-header.patch +8b8db136f78bd26b5da171effa9e11016ec2bc3e2fc8107228b5543b47aa370978ed883794aa4f917f334e284a5b49e82070e1da2d31d49301195b6713a48eff test-crypto-ivgen-skip-essiv.patch +a4cbb020d6a839b5a129964027169babff2c1455170c5fec855232d999481eea2cae186fa66ceaa5c8a05f3eb87f9565aaf9bdcc0e56edf3060e39e80c10c782 ppc-Fix-size-of-ppc64-xer-register-fwd.patch +698f6b134f4ca87f4de62caf7a656841a40a451b8686ca95928f67a296e58a7493d432d9baa5f6360917865aa4929600baf1699993b0600923a066ca9d45d1da sysinfo-header.patch +2828cc612539aa93b5789de7de6d4f85d3cf82311484c0fe91fdd3efeb972057e2baa2a3809ed633d6caa1785642d49196cb282b095d7553c510c47ce7d6a702 fix-lm32-underlinking.patch +d90c034cae3f9097466854ed1a9f32ab4b02089fcdf7320e8f4da13b2b1ff65067233f48809911485e4431d7ec1a22448b934121bc9522a2dc489009e87e2b1f qemu-guest-agent.confd +1cd24c2444c5935a763c501af2b0da31635aad9cf62e55416d6477fcec153cddbe7de205d99616def11b085e0dd366ba22463d2270f831d884edbc307c7864a6 qemu-guest-agent.initd +9b7a89b20fcf737832cb7b4d5dc7d8301dd88169cbe5339eda69fbb51c2e537d8cb9ec7cf37600899e734209e63410d50d0821bce97e401421db39c294d97be2 80-kvm.rules +749efa2e764006555b4fd3a8e2f6d1118ad2ea4d45acf99104a41a93cfe66dc9685f72027c17d8211e5716246c2a52322c962cf4b73b27541b69393cd57f53bb bridge.conf" diff --git a/user/qemu/bridge.conf b/user/qemu/bridge.conf new file mode 100644 index 000000000..27c31c38a --- /dev/null +++ b/user/qemu/bridge.conf @@ -0,0 +1,9 @@ +# This should have the following permissions: root:qemu 0640 + +# Allow users in the "qemu" group to add devices to "br0". +#allow br0 + +# Uncomment the following line to allow users in the "bob" +# group to have permissions defined in it, iff it has the +# following permissions: root:bob 0640 +#include /etc/qemu/bob.conf diff --git a/user/qemu/fix-lm32-underlinking.patch b/user/qemu/fix-lm32-underlinking.patch new file mode 100644 index 000000000..6c93a894c --- /dev/null +++ b/user/qemu/fix-lm32-underlinking.patch @@ -0,0 +1,10 @@ +Fails to link due to missing 'XOpenDisplay' et al. + +--- qemu-2.12.0/target/lm32/Makefile.objs.old 2018-04-24 11:30:47.000000000 -0500 ++++ qemu-2.12.0/target/lm32/Makefile.objs 2018-07-03 04:12:04.080000000 -0500 +@@ -2,3 +2,5 @@ + obj-y += gdbstub.o + obj-y += lm32-semi.o + obj-$(CONFIG_SOFTMMU) += machine.o ++ ++helper.o-libs := -lX11 diff --git a/user/qemu/fix-sigevent-and-sigval_t.patch b/user/qemu/fix-sigevent-and-sigval_t.patch new file mode 100644 index 000000000..1f99eacb6 --- /dev/null +++ b/user/qemu/fix-sigevent-and-sigval_t.patch @@ -0,0 +1,24 @@ +--- qemu-2.2.1/linux-user/syscall.c.orig 2015-04-10 07:10:06.305662505 +0000 ++++ qemu-2.2.1/linux-user/syscall.c 2015-04-10 07:36:53.801871968 +0000 +@@ -5020,9 +5020,20 @@ + return 0; + } + +-static inline abi_long target_to_host_sigevent(struct sigevent *host_sevp, ++struct host_sigevent { ++ union sigval sigev_value; ++ int sigev_signo; ++ int sigev_notify; ++ union { ++ int _pad[64-sizeof(int) * 2 + sizeof(union sigval)]; ++ int _tid; ++ } _sigev_un; ++}; ++ ++static inline abi_long target_to_host_sigevent(struct sigevent *sevp, + abi_ulong target_addr) + { ++ struct host_sigevent *host_sevp = (struct host_sigevent *) sevp; + struct target_sigevent *target_sevp; + + if (!lock_user_struct(VERIFY_READ, target_sevp, target_addr, 1)) { diff --git a/user/qemu/fix-sockios-header.patch b/user/qemu/fix-sockios-header.patch new file mode 100644 index 000000000..1f3cd767c --- /dev/null +++ b/user/qemu/fix-sockios-header.patch @@ -0,0 +1,13 @@ +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 43d0562..afa0ac4 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -59,6 +59,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base, + #include <linux/icmp.h> + #include <linux/icmpv6.h> + #include <linux/errqueue.h> ++#include <linux/sockios.h> + #include <linux/random.h> + #include "qemu-common.h" + #ifdef CONFIG_TIMERFD + #include <sys/timerfd.h> diff --git a/user/qemu/ignore-signals-33-and-64-to-allow-golang-emulation.patch b/user/qemu/ignore-signals-33-and-64-to-allow-golang-emulation.patch new file mode 100644 index 000000000..116254223 --- /dev/null +++ b/user/qemu/ignore-signals-33-and-64-to-allow-golang-emulation.patch @@ -0,0 +1,56 @@ +From db186a3f83454268c43fc793a48bc28c41368a6c Mon Sep 17 00:00:00 2001 +From: Petros Angelatos <petrosagg@gmail.com> +Date: Thu, 3 Mar 2016 23:58:53 -0800 +Subject: [PATCH] linux-user: ignore signals 33 and 64 to allow golang + emulation + +Signal 33 will always fail. This causes golang crash since +https://github.com/golang/go/commit/675eb72c285cd0dd44a5f280bb3fa456ddf6de16 + +As explained in that commit, these signals are very rarely used in a +way that causes problems, so it's ok-ish to ignore one of them. + +Signal 64 will fail because QEMU uses SIGRTMAX for itself. This causes +golang to crash for versions earlier than +https://github.com/golang/go/commit/d10675089d74db0408f2432eae3bd89a8e1c2d6a + +Since after that commit golang ignores that signal, we also ignore it here to +allow earlier versions to run as well. + +Signed-off-by: Petros Angelatos <petrosagg@gmail.com> +--- + linux-user/signal.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/linux-user/signal.c b/linux-user/signal.c +index 9a4d894..90aca55 100644 +--- a/linux-user/signal.c ++++ b/linux-user/signal.c +@@ -744,6 +744,27 @@ int do_sigaction(int sig, const struct target_sigaction *act, + } + + k = &sigact_table[sig - 1]; ++ ++ /* This signal will always fail. This causes golang crash since ++ * https://github.com/golang/go/commit/675eb72c285cd0dd44a5f280bb3fa456ddf6de16 ++ * ++ * As explained in that commit, these signals are very rarely used in a ++ * way that causes problems, so it's ok-ish to ignore one of them here. ++ */ ++ if (sig == 33) { ++ return 0; ++ } ++ /* This signal will fail because QEMU uses SIGRTMAX for itself. This causes ++ * golang to crash for versions earlier than ++ * https://github.com/golang/go/commit/d10675089d74db0408f2432eae3bd89a8e1c2d6a ++ * ++ * Since after that commit golang ignores that signal, we also ignore it here to ++ * allow earlier versions to run as well. ++ */ ++ if (sig == 64) { ++ return 0; ++ } ++ + if (oact) { + __put_user(k->_sa_handler, &oact->_sa_handler); + __put_user(k->sa_flags, &oact->sa_flags); diff --git a/user/qemu/musl-F_SHLCK-and-F_EXLCK.patch b/user/qemu/musl-F_SHLCK-and-F_EXLCK.patch new file mode 100644 index 000000000..316819afa --- /dev/null +++ b/user/qemu/musl-F_SHLCK-and-F_EXLCK.patch @@ -0,0 +1,19 @@ +This patch was not upstreamed to qemu as those should probably be +defined in musl libc. + +--- ./linux-user/syscall.c.orig ++++ ./linux-user/syscall.c +@@ -114,6 +114,13 @@ + + #include "qemu.h" + ++#ifndef F_SHLCK ++#define F_SHLCK 8 ++#endif ++#ifndef F_EXLCK ++#define F_EXLCK 4 ++#endif ++ + #ifndef CLONE_IO + #define CLONE_IO 0x80000000 /* Clone io context */ + #endif diff --git a/user/qemu/ncurses.patch b/user/qemu/ncurses.patch new file mode 100644 index 000000000..2e9eb2a90 --- /dev/null +++ b/user/qemu/ncurses.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index 3770d7c..3fe8281 100755 +--- a/configure ++++ b/configure +@@ -2928,7 +2928,7 @@ if test "$curses" != "no" ; then + curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" + curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" + else +- curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" ++ curses_inc_list="-DNCURSES_WIDECHAR=1 $($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" + curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" + fi + curses_found=no diff --git a/user/qemu/ppc-Fix-size-of-ppc64-xer-register-fwd.patch b/user/qemu/ppc-Fix-size-of-ppc64-xer-register-fwd.patch new file mode 100644 index 000000000..87fd4a1ee --- /dev/null +++ b/user/qemu/ppc-Fix-size-of-ppc64-xer-register-fwd.patch @@ -0,0 +1,70 @@ +diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c +index 7a33813..b6f6693 100644 +--- a/target/ppc/gdbstub.c ++++ b/target/ppc/gdbstub.c +@@ -37,10 +37,10 @@ static int ppc_gdb_register_len_apple(int n) + case 65+32: /* msr */ + case 67+32: /* lr */ + case 68+32: /* ctr */ +- case 69+32: /* xer */ + case 70+32: /* fpscr */ + return 8; + case 66+32: /* cr */ ++ case 69+32: /* xer */ + return 4; + default: + return 0; +@@ -61,6 +61,8 @@ static int ppc_gdb_register_len(int n) + return 8; + case 66: + /* cr */ ++ case 69: ++ /* xer */ + return 4; + case 64: + /* nip */ +@@ -70,8 +72,6 @@ static int ppc_gdb_register_len(int n) + /* lr */ + case 68: + /* ctr */ +- case 69: +- /* xer */ + return sizeof(target_ulong); + case 70: + /* fpscr */ +@@ -152,7 +152,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) + gdb_get_regl(mem_buf, env->ctr); + break; + case 69: +- gdb_get_regl(mem_buf, env->xer); ++ gdb_get_reg32(mem_buf, env->xer); + break; + case 70: + gdb_get_reg32(mem_buf, env->fpscr); +@@ -208,7 +208,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, uint8_t *mem_buf, int n) + gdb_get_reg64(mem_buf, env->ctr); + break; + case 69 + 32: +- gdb_get_reg64(mem_buf, env->xer); ++ gdb_get_reg32(mem_buf, env->xer); + break; + case 70 + 32: + gdb_get_reg64(mem_buf, env->fpscr); +@@ -259,7 +259,7 @@ int ppc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) + env->ctr = ldtul_p(mem_buf); + break; + case 69: +- env->xer = ldtul_p(mem_buf); ++ env->xer = ldl_p(mem_buf); + break; + case 70: + /* fpscr */ +@@ -309,7 +309,7 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, uint8_t *mem_buf, int n) + env->ctr = ldq_p(mem_buf); + break; + case 69 + 32: +- env->xer = ldq_p(mem_buf); ++ env->xer = ldl_p(mem_buf); + break; + case 70 + 32: + /* fpscr */ diff --git a/user/qemu/qemu-guest-agent.confd b/user/qemu/qemu-guest-agent.confd new file mode 100644 index 000000000..228c03254 --- /dev/null +++ b/user/qemu/qemu-guest-agent.confd @@ -0,0 +1,7 @@ +# Specifies the transport method used to communicate to QEMU on the host side +# Default: virtio-serial +#GA_METHOD="virtio-serial" + +# Specifies the device path for the communications back to QEMU on the host +# Default: /dev/virtio-ports/org.qemu.guest_agent.0 +#GA_PATH="/dev/virtio-ports/org.qemu.guest_agent.0" diff --git a/user/qemu/qemu-guest-agent.initd b/user/qemu/qemu-guest-agent.initd new file mode 100644 index 000000000..aaf7de3f2 --- /dev/null +++ b/user/qemu/qemu-guest-agent.initd @@ -0,0 +1,6 @@ +#!/sbin/openrc-run + +name="QEMU Guest Agent" +pidfile="/run/qemu-ga.pid" +command="/usr/bin/qemu-ga" +command_args="-m ${GA_METHOD:-virtio-serial} -p ${GA_PATH:-/dev/virtio-ports/org.qemu.guest_agent.0} -l /var/log/qemu-ga.log -d" diff --git a/user/qemu/qemu.post-install b/user/qemu/qemu.post-install new file mode 100644 index 000000000..025f7304c --- /dev/null +++ b/user/qemu/qemu.post-install @@ -0,0 +1,10 @@ +#!/bin/sh + +cat 1>&2 <<EOF +* +* If you want to run VM as unprivileged user and let Qemu create tunX devices, +* then you must add that user to the group "qemu". +* If you use KVM for hardware-assisted virtualization, then you may also need +* to add that user to the group "kvm". +* +EOF diff --git a/user/qemu/qemu.pre-install b/user/qemu/qemu.pre-install new file mode 100644 index 000000000..2ef9b5366 --- /dev/null +++ b/user/qemu/qemu.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +addgroup -S -g 34 kvm 2>/dev/null +addgroup -S -g 36 qemu 2>/dev/null + +exit 0 diff --git a/user/qemu/sysinfo-header.patch b/user/qemu/sysinfo-header.patch new file mode 100644 index 000000000..d6e81d39c --- /dev/null +++ b/user/qemu/sysinfo-header.patch @@ -0,0 +1,13 @@ +<linux/netlink.h> pulls in <linux/sysinfo.h> which conflicts with the musl one. + +--- qemu-2.12.0/linux-user/syscall.c.old 2018-07-03 02:34:54.660000000 -0500 ++++ qemu-2.12.0/linux-user/syscall.c 2018-07-03 03:43:28.580000000 -0500 +@@ -45,7 +45,7 @@ + #include <sys/sem.h> + #include <sys/statfs.h> + #include <utime.h> +-#include <sys/sysinfo.h> ++#include <linux/sysinfo.h> + #include <sys/signalfd.h> + //#include <sys/user.h> + #include <netinet/ip.h> diff --git a/user/qemu/test-crypto-ivgen-skip-essiv.patch b/user/qemu/test-crypto-ivgen-skip-essiv.patch new file mode 100644 index 000000000..e72f489be --- /dev/null +++ b/user/qemu/test-crypto-ivgen-skip-essiv.patch @@ -0,0 +1,54 @@ +These tests fail with Illegal instruction and I don't have a clue why, +so skip them for now. + +--- a/tests/test-crypto-ivgen.c ++++ b/tests/test-crypto-ivgen.c +@@ -88,48 +88,6 @@ + "\x00\x00\x00\x00\x00\x00\x00\x00", + .niv = 16, + }, +- /* Small */ +- { +- "/crypto/ivgen/essiv/1", +- .sector = 0x1, +- .ivalg = QCRYPTO_IVGEN_ALG_ESSIV, +- .cipheralg = QCRYPTO_CIPHER_ALG_AES_128, +- .hashalg = QCRYPTO_HASH_ALG_SHA256, +- .key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" +- "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", +- .nkey = 16, +- .iv = (const uint8_t *)"\xd4\x83\x71\xb2\xa1\x94\x53\x88" +- "\x1c\x7a\x2d\06\x2d\x0b\x65\x46", +- .niv = 16, +- }, +- /* Big ! */ +- { +- "/crypto/ivgen/essiv/1f2e3d4c", +- .sector = 0x1f2e3d4cULL, +- .ivalg = QCRYPTO_IVGEN_ALG_ESSIV, +- .cipheralg = QCRYPTO_CIPHER_ALG_AES_128, +- .hashalg = QCRYPTO_HASH_ALG_SHA256, +- .key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" +- "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", +- .nkey = 16, +- .iv = (const uint8_t *)"\x5d\x36\x09\x5d\xc6\x9e\x5e\xe9" +- "\xe3\x02\x8d\xd8\x7a\x3d\xe7\x8f", +- .niv = 16, +- }, +- /* No Truncation */ +- { +- "/crypto/ivgen/essiv/1f2e3d4c5b6a7988", +- .sector = 0x1f2e3d4c5b6a7988ULL, +- .ivalg = QCRYPTO_IVGEN_ALG_ESSIV, +- .cipheralg = QCRYPTO_CIPHER_ALG_AES_128, +- .hashalg = QCRYPTO_HASH_ALG_SHA256, +- .key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" +- "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", +- .nkey = 16, +- .iv = (const uint8_t *)"\x58\xbb\x81\x94\x51\x83\x23\x23" +- "\x7a\x08\x93\xa9\xdc\xd2\xd9\xab", +- .niv = 16, +- }, + }; + + diff --git a/user/qemu/xattr_size_max.patch b/user/qemu/xattr_size_max.patch new file mode 100644 index 000000000..1a33cbf5e --- /dev/null +++ b/user/qemu/xattr_size_max.patch @@ -0,0 +1,15 @@ +diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c +index faebd91..a0f15b6 100644 +--- a/hw/9pfs/9p.c ++++ b/hw/9pfs/9p.c +@@ -25,6 +25,10 @@ + #include "trace.h" + #include "migration/migration.h" + ++#ifdef __linux__ ++#include <linux/limits.h> /* for XATTR_SIZE_MAX */ ++#endif ++ + int open_fd_hw; + int total_open_fd; + static int open_fd_rc; |