Accepting request 439065 from home:a_faerber:branches:Virtualization
Update patch by schwab OBS-URL: https://build.opensuse.org/request/show/439065 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=317
This commit is contained in:
parent
1d9697697f
commit
a7a58f6d5e
82
0040-linux-user-remove-all-traces-of-qem.patch
Normal file
82
0040-linux-user-remove-all-traces-of-qem.patch
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
From e2e103eaa7e3ba94f3e32184c7fa2c694072b9e1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andreas Schwab <schwab@suse.de>
|
||||||
|
Date: Wed, 28 Sep 2016 16:36:40 +0200
|
||||||
|
Subject: [PATCH] linux-user: remove all traces of qemu from /proc/self/cmdline
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Instead of post-processing the real contents use the remembered target
|
||||||
|
argv. That removes all traces of qemu, including command line options,
|
||||||
|
and handles QEMU_ARGV0.
|
||||||
|
|
||||||
|
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
||||||
|
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
||||||
|
---
|
||||||
|
linux-user/syscall.c | 47 +++++++----------------------------------------
|
||||||
|
1 file changed, 7 insertions(+), 40 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
|
||||||
|
index 856e75d..31bf618 100644
|
||||||
|
--- a/linux-user/syscall.c
|
||||||
|
+++ b/linux-user/syscall.c
|
||||||
|
@@ -7013,52 +7013,19 @@ 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;
|
||||||
|
-
|
||||||
|
- fd_orig = open("/proc/self/cmdline", O_RDONLY);
|
||||||
|
- if (fd_orig < 0) {
|
||||||
|
- return fd_orig;
|
||||||
|
- }
|
||||||
|
+ CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env);
|
||||||
|
+ struct linux_binprm *bprm = ((TaskState *)cpu->opaque)->bprm;
|
||||||
|
+ int i;
|
||||||
|
|
||||||
|
- while (true) {
|
||||||
|
- ssize_t nb_read;
|
||||||
|
- char buf[128];
|
||||||
|
- char *cp_buf = buf;
|
||||||
|
+ for (i = 0; i < bprm->argc; i++) {
|
||||||
|
+ size_t len = strlen(bprm->argv[i]) + 1;
|
||||||
|
|
||||||
|
- nb_read = read(fd_orig, buf, sizeof(buf));
|
||||||
|
- if (nb_read < 0) {
|
||||||
|
- int e = errno;
|
||||||
|
- fd_orig = close(fd_orig);
|
||||||
|
- errno = e;
|
||||||
|
+ if (write(fd, bprm->argv[i], len) != len) {
|
||||||
|
return -1;
|
||||||
|
- } else if (nb_read == 0) {
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (!word_skipped) {
|
||||||
|
- /* Skip the first string, which is the path to qemu-*-static
|
||||||
|
- instead of the actual command. */
|
||||||
|
- cp_buf = memchr(buf, 0, nb_read);
|
||||||
|
- if (cp_buf) {
|
||||||
|
- /* Null byte found, skip one string */
|
||||||
|
- cp_buf++;
|
||||||
|
- nb_read -= cp_buf - buf;
|
||||||
|
- word_skipped = true;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (word_skipped) {
|
||||||
|
- if (write(fd, cp_buf, nb_read) != nb_read) {
|
||||||
|
- int e = errno;
|
||||||
|
- close(fd_orig);
|
||||||
|
- errno = e;
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- return close(fd_orig);
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int open_self_maps(void *cpu_env, int fd)
|
@ -1,65 +0,0 @@
|
|||||||
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);
|
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Nov 7 16:14:20 UTC 2016 - afaerber@suse.de
|
||||||
|
|
||||||
|
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.7
|
||||||
|
* Patch updated:
|
||||||
|
0040-linux-user-skip-0-flag-from-proc-se.patch -> 0040-linux-user-remove-all-traces-of-qem.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Sep 27 16:18:35 UTC 2016 - afaerber@suse.de
|
Tue Sep 27 16:18:35 UTC 2016 - afaerber@suse.de
|
||||||
|
|
||||||
|
@ -64,7 +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
|
Patch0040: 0040-linux-user-remove-all-traces-of-qem.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
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Nov 7 16:14:15 UTC 2016 - afaerber@suse.de
|
||||||
|
|
||||||
|
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.7
|
||||||
|
* Patch updated:
|
||||||
|
0040-linux-user-skip-0-flag-from-proc-se.patch -> 0040-linux-user-remove-all-traces-of-qem.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Sep 27 16:18:31 UTC 2016 - afaerber@suse.de
|
Tue Sep 27 16:18:31 UTC 2016 - afaerber@suse.de
|
||||||
|
|
||||||
|
@ -126,7 +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
|
Patch0040: 0040-linux-user-remove-all-traces-of-qem.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.
|
||||||
|
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Nov 7 16:14:15 UTC 2016 - afaerber@suse.de
|
||||||
|
|
||||||
|
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.7
|
||||||
|
* Patch updated:
|
||||||
|
0040-linux-user-skip-0-flag-from-proc-se.patch -> 0040-linux-user-remove-all-traces-of-qem.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Sep 27 16:18:31 UTC 2016 - afaerber@suse.de
|
Tue Sep 27 16:18:31 UTC 2016 - afaerber@suse.de
|
||||||
|
|
||||||
|
@ -126,7 +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
|
Patch0040: 0040-linux-user-remove-all-traces-of-qem.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.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user