SHA256
1
0
forked from pool/qemu

Accepting request 430644 from home:a_faerber:branches:Virtualization

Drop -0 argument for linux-user (schwab)

OBS-URL: https://build.opensuse.org/request/show/430644
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=316
This commit is contained in:
Andreas Färber 2016-09-27 22:31:52 +00:00 committed by Git OBS Bridge
parent e38c41b04c
commit 1d9697697f
7 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,65 @@
From c591019f7c3d6d1ca45a8773313aeb5ffac686c2 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Mon, 26 Sep 2016 10:08:59 +0200
Subject: [PATCH] linux-user: skip -0 flag from /proc/self/cmdline
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This removes the "-0 argv0" flag from /proc/self/cmdline that was passed in
by the qemu-ARCH-binfmt wrapper.
Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
linux-user/syscall.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 856e75d..9be99d6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7014,7 +7014,7 @@ int host_to_target_waitstatus(int status)
static int open_self_cmdline(void *cpu_env, int fd)
{
int fd_orig = -1;
- bool word_skipped = false;
+ int skip_words = 3;
fd_orig = open("/proc/self/cmdline", O_RDONLY);
if (fd_orig < 0) {
@@ -7036,19 +7036,29 @@ static int open_self_cmdline(void *cpu_env, int fd)
break;
}
- if (!word_skipped) {
+ while (skip_words) {
/* Skip the first string, which is the path to qemu-*-static
instead of the actual command. */
- cp_buf = memchr(buf, 0, nb_read);
+ char *p = cp_buf;
+ cp_buf = memchr(p, 0, nb_read);
if (cp_buf) {
/* Null byte found, skip one string */
cp_buf++;
- nb_read -= cp_buf - buf;
- word_skipped = true;
+ nb_read -= cp_buf - p;
+ skip_words--;
+ if (skip_words == 2) {
+ /* Check for presence of -0 flag. */
+ if (nb_read > 0 && cp_buf[0] != '-' ||
+ nb_read > 1 && cp_buf[1] != '0') {
+ skip_words = 0;
+ }
+ }
+ } else {
+ break;
}
}
- if (word_skipped) {
+ if (skip_words == 0) {
if (write(fd, cp_buf, nb_read) != nb_read) {
int e = errno;
close(fd_orig);

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Sep 27 16:18:35 UTC 2016 - afaerber@suse.de
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.7
* Fix issue with diffutils under qemu-ARCH-binfmt (schwab)
0040-linux-user-skip-0-flag-from-proc-se.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 22 15:04:48 UTC 2016 - afaerber@suse.de Thu Sep 22 15:04:48 UTC 2016 - afaerber@suse.de

View File

@ -64,6 +64,7 @@ Patch0036: 0036-qemu-binfmt-conf-use-qemu-ARCH-binf.patch
Patch0037: 0037-configure-Fix-detection-of-seccomp-.patch Patch0037: 0037-configure-Fix-detection-of-seccomp-.patch
Patch0038: 0038-linux-user-properly-test-for-infini.patch Patch0038: 0038-linux-user-properly-test-for-infini.patch
Patch0039: 0039-Fix-tlb_vaddr_to_host-with-CONFIG_U.patch Patch0039: 0039-Fix-tlb_vaddr_to_host-with-CONFIG_U.patch
Patch0040: 0040-linux-user-skip-0-flag-from-proc-se.patch
# Please do not add patches manually here, run update_git.sh. # Please do not add patches manually here, run update_git.sh.
# this is to make lint happy # this is to make lint happy
Source300: qemu-rpmlintrc Source300: qemu-rpmlintrc
@ -156,6 +157,7 @@ run cross-architecture builds.
%patch0037 -p1 %patch0037 -p1
%patch0038 -p1 %patch0038 -p1
%patch0039 -p1 %patch0039 -p1
%patch0040 -p1
%build %build
./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \ ./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Sep 27 16:18:31 UTC 2016 - afaerber@suse.de
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.7
* Patches added:
0040-linux-user-skip-0-flag-from-proc-se.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 22 15:04:43 UTC 2016 - afaerber@suse.de Thu Sep 22 15:04:43 UTC 2016 - afaerber@suse.de

View File

@ -126,6 +126,7 @@ Patch0036: 0036-qemu-binfmt-conf-use-qemu-ARCH-binf.patch
Patch0037: 0037-configure-Fix-detection-of-seccomp-.patch Patch0037: 0037-configure-Fix-detection-of-seccomp-.patch
Patch0038: 0038-linux-user-properly-test-for-infini.patch Patch0038: 0038-linux-user-properly-test-for-infini.patch
Patch0039: 0039-Fix-tlb_vaddr_to_host-with-CONFIG_U.patch Patch0039: 0039-Fix-tlb_vaddr_to_host-with-CONFIG_U.patch
Patch0040: 0040-linux-user-skip-0-flag-from-proc-se.patch
# Please do not add QEMU patches manually here. # Please do not add QEMU patches manually here.
# Run update_git.sh to regenerate this queue. # Run update_git.sh to regenerate this queue.
@ -745,6 +746,7 @@ This package provides a service file for starting and stopping KSM.
%patch0037 -p1 %patch0037 -p1
%patch0038 -p1 %patch0038 -p1
%patch0039 -p1 %patch0039 -p1
%patch0040 -p1
%if %{build_x86_fw_from_source} %if %{build_x86_fw_from_source}
pushd roms/seabios pushd roms/seabios

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Sep 27 16:18:31 UTC 2016 - afaerber@suse.de
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.7
* Patches added:
0040-linux-user-skip-0-flag-from-proc-se.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 22 15:04:43 UTC 2016 - afaerber@suse.de Thu Sep 22 15:04:43 UTC 2016 - afaerber@suse.de

View File

@ -126,6 +126,7 @@ Patch0036: 0036-qemu-binfmt-conf-use-qemu-ARCH-binf.patch
Patch0037: 0037-configure-Fix-detection-of-seccomp-.patch Patch0037: 0037-configure-Fix-detection-of-seccomp-.patch
Patch0038: 0038-linux-user-properly-test-for-infini.patch Patch0038: 0038-linux-user-properly-test-for-infini.patch
Patch0039: 0039-Fix-tlb_vaddr_to_host-with-CONFIG_U.patch Patch0039: 0039-Fix-tlb_vaddr_to_host-with-CONFIG_U.patch
Patch0040: 0040-linux-user-skip-0-flag-from-proc-se.patch
# Please do not add QEMU patches manually here. # Please do not add QEMU patches manually here.
# Run update_git.sh to regenerate this queue. # Run update_git.sh to regenerate this queue.
@ -745,6 +746,7 @@ This package provides a service file for starting and stopping KSM.
%patch0037 -p1 %patch0037 -p1
%patch0038 -p1 %patch0038 -p1
%patch0039 -p1 %patch0039 -p1
%patch0040 -p1
%if %{build_x86_fw_from_source} %if %{build_x86_fw_from_source}
pushd roms/seabios pushd roms/seabios