SHA256
1
0
forked from pool/qemu

- add workaround for KVM on PPC to support hugetlbfs

- add upstream patches to fake $0 in /proc/self/maps (fixes ps)

OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=37
This commit is contained in:
Alexander Graf 2012-01-06 00:19:18 +00:00 committed by Git OBS Bridge
parent 04b2842e10
commit 563031469d
38 changed files with 171 additions and 34 deletions

View File

@ -1,7 +1,7 @@
From 4cc09e9530fb08123594be6c72dfc381df5dcddc Mon Sep 17 00:00:00 2001
From: Peter Maydell <peter.maydell@linaro.org>
Date: Wed, 5 Oct 2011 10:04:02 +0100
Subject: [PATCH 01/33] Handle CPU interrupts by inline checking of a flag
Subject: [PATCH 01/36] Handle CPU interrupts by inline checking of a flag
Fix the nasty TCG race conditions and crashes by implementing cpu_exit
as setting a flag which is checked at the start of each TB. This is

View File

@ -1,7 +1,7 @@
From 0588bc446fd48bdb1965a6773d008c05a4ba16c1 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 20 Nov 2011 13:02:54 +0100
Subject: [PATCH 02/33] linux-user: fix QEMU_STRACE=1 segfault
Subject: [PATCH 02/36] linux-user: fix QEMU_STRACE=1 segfault
While debugging some issues with QEMU_STRACE I stumbled over segmentation
faults that were pretty reproducible. Turns out we tried to treat a

View File

@ -1,7 +1,7 @@
From 67c12998086c44ebef7f92a394154d6aba446178 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:22 +0000
Subject: [PATCH 03/33] linux-user: save auxv length
Subject: [PATCH 03/36] linux-user: save auxv length
We create our own AUXV segment on stack and save a pointer to it.
However we don't save the length of it, so any code that wants to

View File

@ -1,7 +1,7 @@
From 99590488e94b6b7f10ecf9a99398fd24a69a7039 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:23 +0000
Subject: [PATCH 04/33] linux-user: add open() hijack infrastructure
Subject: [PATCH 04/36] linux-user: add open() hijack infrastructure
There are a number of files in /proc that expose host information
to the guest program. This patch adds infrastructure to override

View File

@ -1,7 +1,7 @@
From 059e727a9a4be00de949769105e9e0ea876fc64b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:24 +0000
Subject: [PATCH 05/33] linux-user: fake /proc/self/maps
Subject: [PATCH 05/36] linux-user: fake /proc/self/maps
glibc's pthread_attr_getstack tries to find the stack range from
/proc/self/maps. Unfortunately, /proc is usually the host's /proc

View File

@ -1,7 +1,7 @@
From 7ee3fd47eed19e4dfa26a8d0176ed3550b8d0ccf Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:25 +0000
Subject: [PATCH 06/33] linux-user: fake /proc/self/stat
Subject: [PATCH 06/36] linux-user: fake /proc/self/stat
The boehm gc finds the program's stack starting pointer by
checking /proc/self/stat. Unfortunately, so far it reads

View File

@ -1,7 +1,7 @@
From ddf0d4037b10c07d9e5b168f9f96e60a1601c75b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:26 +0000
Subject: [PATCH 07/33] linux-user: fake /proc/self/auxv
Subject: [PATCH 07/36] linux-user: fake /proc/self/auxv
Gtk tries to read /proc/self/auxv to find its auxv table instead of
taking it from its own program memory space.

View File

@ -1,7 +1,7 @@
From 4bc96d88f91417aa2bb029da2e8343456fe86631 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 21 Nov 2011 23:50:36 +0100
Subject: [PATCH 08/33] XXX dont dump core on sigabort
Subject: [PATCH 08/36] XXX dont dump core on sigabort
---
linux-user/signal.c | 6 ++++++

View File

@ -1,7 +1,7 @@
From ee5137d38109fdcb55a58be447c2c27be2b16eb0 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 22 Nov 2011 17:53:40 +0100
Subject: [PATCH 09/33] linux-user: fix wait* syscall status returns
Subject: [PATCH 09/36] linux-user: fix wait* syscall status returns
When calling wait4 or waitpid with a status pointer and WNOHANG, the
syscall can potentially not modify the status pointer input. Now if we

View File

@ -1,7 +1,7 @@
From 5cfce885dd1b3a229cd2ea7a94dfe2445ec29417 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 24 Nov 2011 00:38:22 +0100
Subject: [PATCH 10/33] Revert "linux-user: fix wait* syscall status returns"
Subject: [PATCH 10/36] Revert "linux-user: fix wait* syscall status returns"
This reverts commit 93092792064d880eb91679004b4761639d754081.
---

View File

@ -1,7 +1,7 @@
From b71ee7a063f7cffdf8a2cf73fcbc1d461fbbb80e Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 24 Nov 2011 00:39:35 +0100
Subject: [PATCH 11/33] linux-user: fix wait* syscall status returns
Subject: [PATCH 11/36] linux-user: fix wait* syscall status returns
When calling wait4 or waitpid with a status pointer and WNOHANG, the
syscall can potentially not modify the status pointer input. Now if we

View File

@ -1,7 +1,7 @@
From 146dddbec44c48417f776d54f823093b464e596c Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 28 Nov 2011 17:05:24 +0100
Subject: [PATCH 12/33] XXX linux-user: fake /proc/self/maps even more
Subject: [PATCH 12/36] XXX linux-user: fake /proc/self/maps even more
---
linux-user/syscall.c | 40 +++++++++++++++++++++++++++++++++++++++-

View File

@ -1,7 +1,7 @@
From 79a59902304b66e9270d11901a554e5b22042d6e Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 1 Dec 2011 19:00:01 +0100
Subject: [PATCH 13/33] XXX work around SA_RESTART race with boehm-gc (ARM only)
Subject: [PATCH 13/36] XXX work around SA_RESTART race with boehm-gc (ARM only)
---
linux-user/main.c | 25 ++++++++-----

View File

@ -1,7 +1,7 @@
From e534a77a0e1f880d0f74514ac50de5de3dd4811a Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 5 Dec 2011 23:37:52 +0100
Subject: [PATCH 14/33] XXX move qemu binary lower in address space so we have space for guest stuff
Subject: [PATCH 14/36] XXX move qemu binary lower in address space so we have space for guest stuff
---
x86_64.ld | 2 +-

View File

@ -1,7 +1,7 @@
From edda5e8f49b7857379733d652d6b259488bd7b70 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 6 Dec 2011 00:39:50 +0100
Subject: [PATCH 15/33] linux-user: map lower in address space
Subject: [PATCH 15/36] linux-user: map lower in address space
While trying to compile Java I can into situations where there was simply
no virtual address space left for a 32-bit guest to take. For example when

View File

@ -1,7 +1,7 @@
From 3580a90d40df10410b7268f89aae58ce05dd2bed Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 8 Dec 2011 23:19:32 +0100
Subject: [PATCH 16/33] XXX fake /proc/self/maps: also fclose real file
Subject: [PATCH 16/36] XXX fake /proc/self/maps: also fclose real file
---
linux-user/syscall.c | 1 +

View File

@ -1,7 +1,7 @@
From 91f12fe177833e0112cd7f7cf5781b26377667a5 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sat, 10 Dec 2011 00:03:56 +0100
Subject: [PATCH 17/33] XXX map qemu higher again so we have space for brk
Subject: [PATCH 17/36] XXX map qemu higher again so we have space for brk
---
linux-user/mmap.c | 2 +-

View File

@ -1,7 +1,7 @@
From 434801ec78b031170eb0762302b52062e6c27d0e Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:18:44 +0200
Subject: [PATCH 18/33] qemu-0.9.0.cvs-binfmt
Subject: [PATCH 18/36] qemu-0.9.0.cvs-binfmt
Fixes binfmt_misc setup script:
- x86_64 is i386-compatible

View File

@ -1,7 +1,7 @@
From b41a72d0c29f97610dfdd5573b8be383823bc88f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:20:50 +0200
Subject: [PATCH 19/33] qemu-cvs-alsa_bitfield
Subject: [PATCH 19/36] qemu-cvs-alsa_bitfield
Implements TYPE_INTBITFIELD partially. (required for ALSA support)

View File

@ -1,7 +1,7 @@
From 33f065c217c1921759df12467954eb4638f84a72 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:23:27 +0200
Subject: [PATCH 20/33] qemu-cvs-alsa_ioctl
Subject: [PATCH 20/36] qemu-cvs-alsa_ioctl
Implements ALSA ioctls on PPC hosts.

View File

@ -1,7 +1,7 @@
From 8b67814c8ab4645ddd43664b1092e78ea6a743d8 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:24:15 +0200
Subject: [PATCH 21/33] qemu-cvs-alsa_mmap
Subject: [PATCH 21/36] qemu-cvs-alsa_mmap
Hack to prevent ALSA from using mmap() interface to simplify emulation.

View File

@ -1,7 +1,7 @@
From c0ce4deb6c2ac843e337b7252fbefc190d625ca5 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:25:41 +0200
Subject: [PATCH 22/33] qemu-cvs-gettimeofday
Subject: [PATCH 22/36] qemu-cvs-gettimeofday
No clue what this is for.
---

View File

@ -1,7 +1,7 @@
From 6232258009a4735d7f4f53b5589e7ebd90a9885d Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:26:33 +0200
Subject: [PATCH 23/33] qemu-cvs-ioctl_debug
Subject: [PATCH 23/36] qemu-cvs-ioctl_debug
Extends unsupported ioctl debug output.

View File

@ -1,7 +1,7 @@
From 926d75fa4b4b5d95d4b0111e3e0af4d983a9d46b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:27:36 +0200
Subject: [PATCH 24/33] qemu-cvs-ioctl_nodirection
Subject: [PATCH 24/36] qemu-cvs-ioctl_nodirection
the direction given in the ioctl should be correct so we can assume the
communication is uni-directional. The alsa developers did not like this

View File

@ -1,7 +1,7 @@
From 90b3180677c5615bafc9a1f8252fbc4af1dc1ae4 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:37:42 +0200
Subject: [PATCH 25/33] qemu-img-vmdk-scsi
Subject: [PATCH 25/36] qemu-img-vmdk-scsi
Support creation of SCSI VMDK images in qemu-img.

View File

@ -1,7 +1,7 @@
From 7e6479e0d45e45e888cb79759fd44d6c14be19f4 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:38:20 +0200
Subject: [PATCH 26/33] qemu-nonvoid_return
Subject: [PATCH 26/36] qemu-nonvoid_return
Squelches GCC warnings about undefined return values.

View File

@ -1,7 +1,7 @@
From 164cf539481164978d9fa6ad69eb20cda7dc0e12 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Wed, 25 Aug 2010 14:23:43 +0200
Subject: [PATCH 27/33] fix mipsn32*-linux-user builds
Subject: [PATCH 27/36] fix mipsn32*-linux-user builds
Signed-off-by: Ulrich Hecht <uli@suse.de>
---

View File

@ -1,7 +1,7 @@
From 15d6a32b38abc6c2f8143ebccfcdd05d204f0fcd Mon Sep 17 00:00:00 2001
From: Benjamin <mlspirat42@gmail.com>
Date: Sat, 8 Oct 2011 07:31:33 +0000
Subject: [PATCH 28/33] Integrating Dynamips and GNS3 UDP tunnels (Patches)
Subject: [PATCH 28/36] Integrating Dynamips and GNS3 UDP tunnels (Patches)
On 10/07/11 10:35, Jan Kiszka wrote:
>

View File

@ -1,7 +1,7 @@
From 47ff084e9af71b217e6f842f720d12fe9e12f2fd Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Fri, 30 Sep 2011 19:40:36 +0200
Subject: [PATCH 29/33] linux-user: add binfmt wrapper for argv[0] handling
Subject: [PATCH 29/36] linux-user: add binfmt wrapper for argv[0] handling
When using qemu's linux-user binaries through binfmt, argv[0] gets lost
along the execution because qemu only gets passed in the full file name

View File

@ -1,7 +1,7 @@
From 269d801698bf7640dd325cfb4b195c4a207a07ee Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 11 Dec 2011 01:19:24 +0100
Subject: [PATCH 30/33] linux-user: Ignore timer_create syscall
Subject: [PATCH 30/36] linux-user: Ignore timer_create syscall
We don't implement the timer_create syscall, but shouting out loud
about it breaks some %check tests in OBS, so better ignore it silently.

View File

@ -1,7 +1,7 @@
From 36f403e159ecb5fcaeda5346c2df762cc904a91b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 11 Dec 2011 01:21:51 +0100
Subject: [PATCH 31/33] linux-user: be silent about capget failures
Subject: [PATCH 31/36] linux-user: be silent about capget failures
Complaining about capget doesn't buy us anything, but makes %check
fail in certain builds. So better not complain about its missing

View File

@ -1,7 +1,7 @@
From 4fddaa4befeb3ddb1c14d9b2c882474ba4166940 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 12 Dec 2011 23:16:43 +0100
Subject: [PATCH 32/33] PPC: Fix linker scripts on ppc hosts
Subject: [PATCH 32/36] PPC: Fix linker scripts on ppc hosts
When compiling qemu statically with multilib on PPC, we hit the
same issue that commit 845f2c2812d9ed24b36c02a3d06ee83aeafe8b49

View File

@ -1,7 +1,7 @@
From ac233b323ad7e498c665e8c74df7e44de4a542c0 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 14 Dec 2011 00:33:28 +0100
Subject: [PATCH 33/33] linux-user: reserve 4GB of vmem for 32-on-64
Subject: [PATCH 33/36] linux-user: reserve 4GB of vmem for 32-on-64
When running 32-on-64 bit guests, we should always reserve as much
virtual memory as we possibly can for the guest process, so it can

View File

@ -0,0 +1,34 @@
From 96ac7aa8753cb2d79121c5a579a6e93160428a40 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Fri, 6 Jan 2012 01:05:55 +0100
Subject: [PATCH 34/36] PPC: KVM: Disable mmu notifier check
When using hugetlbfs (which is required for HV mode KVM on 970), we
check for MMU notifiers that on 970 can not be implemented properly.
So disable the check for mmu notifiers on PowerPC guests, making
KVM guests work there, even if possibly racy in some odd circumstances.
---
exec.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index 6c923f2..9f10868 100644
--- a/exec.c
+++ b/exec.c
@@ -2831,10 +2831,12 @@ static void *file_ram_alloc(RAMBlock *block,
return NULL;
}
+#ifndef TARGET_PPC
if (kvm_enabled() && !kvm_has_sync_mmu()) {
fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path unsupported\n");
return NULL;
}
+#endif
if (asprintf(&filename, "%s/qemu_back_mem.XXXXXX", path) == -1) {
return NULL;
--
1.6.0.2

View File

@ -0,0 +1,54 @@
From 872ebeaa24ed1c4b0c1596a7ad37f2bf2275efb0 Mon Sep 17 00:00:00 2001
From: Fabio Erculiani <lxnay@sabayon.org>
Date: Tue, 3 Jan 2012 09:38:34 +0000
Subject: [PATCH 35/36] linux-user: improve fake /proc/self/stat making `ps` not segfault.
With the current fake /proc/self/stat implementation `ps` is
segfaulting because it expects to read PID and argv[0] as first and
second field respectively, with the latter being enclosed between
backets.
Reproducing is as easy as running: `ps` inside qemu-user chroot
with /proc mounted.
Signed-off-by: Fabio Erculiani <lxnay@sabayon.org>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9ba51bf..3e8e3dd 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4678,11 +4678,22 @@ static int open_self_stat(void *cpu_env, int fd)
int len;
uint64_t val = 0;
- if (i == 27) {
- /* stack bottom */
- val = start_stack;
+ if (i == 0) {
+ /* pid */
+ val = getpid();
+ snprintf(buf, sizeof(buf), "%"PRId64 " ", val);
+ } else if (i == 1) {
+ /* app name */
+ snprintf(buf, sizeof(buf), "(%s) ", ts->bprm->argv[0]);
+ } else if (i == 27) {
+ /* stack bottom */
+ val = start_stack;
+ snprintf(buf, sizeof(buf), "%"PRId64 " ", val);
+ } else {
+ /* for the rest, there is MasterCard */
+ snprintf(buf, sizeof(buf), "0%c", i == 43 ? '\n' : ' ');
}
- snprintf(buf, sizeof(buf), "%"PRId64 "%c", val, i == 43 ? '\n' : ' ');
+
len = strlen(buf);
if (write(fd, buf, len) != len) {
return -1;
--
1.6.0.2

View File

@ -0,0 +1,37 @@
From 7dc45b21c5ef8a9445463f8d3754e502621192a7 Mon Sep 17 00:00:00 2001
From: Fabio Erculiani <lxnay@sabayon.org>
Date: Tue, 3 Jan 2012 09:38:35 +0000
Subject: [PATCH 36/36] linux-user: target_argv is placed on ts->bprm->argv and can't be freed()
TaskState contains linux_bprm struct which encapsulates argv among
other things.
argv might be used around the code and is expected to contain valid
data. Before this patch, ts->bprm->argv was NULL due to it being
freed right after loader_exec().
Signed-off-by: Fabio Erculiani <lxnay@sabayon.org>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/main.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 3ffee40..6a5dfde 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3503,11 +3503,6 @@ int main(int argc, char **argv, char **envp)
_exit(1);
}
- for (i = 0; i < target_argc; i++) {
- free(target_argv[i]);
- }
- free(target_argv);
-
for (wrk = target_environ; *wrk; wrk++) {
free(*wrk);
}
--
1.6.0.2

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jan 6 01:18:00 UTC 2012 - agraf@suse.de
- add workaround for KVM on PPC to support hugetlbfs
- add upstream patches to fake $0 in /proc/self/maps (fixes ps)
-------------------------------------------------------------------
Wed Dec 14 00:16:28 UTC 2011 - agraf@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package qemu
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -59,6 +59,9 @@ Patch0030: 0030-linux-user-Ignore-timer_create-syscall.patch
Patch0031: 0031-linux-user-be-silent-about-capget-failures.patch
Patch0032: 0032-PPC-Fix-linker-scripts-on-ppc-hosts.patch
Patch0033: 0033-linux-user-reserve-4GB-of-vmem-for-32-on-64.patch
Patch0034: 0034-PPC-KVM-Disable-mmu-notifier-check.patch
Patch0035: 0035-linux-user-improve-fake-proc-self-stat-making-ps.patch
Patch0036: 0036-linux-user-target_argv-is-placed-on-ts-bprm-argv.patch
# this is to make lint happy
Source300: rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -151,6 +154,9 @@ run cross architectures builds
%patch0031 -p1
%patch0032 -p1
%patch0033 -p1
%patch0034 -p1
%patch0035 -p1
%patch0036 -p1
%build
# build QEMU