qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Lauri Leukkunen" <lle@rahina.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Make user-mode emu drop LD_PRELOAD
Date: Sun, 22 Apr 2007 22:39:03 +0300	[thread overview]
Message-ID: <53fbb7580704221239y30eb99c2of276cb62806a7ca3@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

This patch makes user-mode emulation drop LD_PRELOAD environment variable
by default and adds an option "-keep-ld-preload" to override this behaviour.

/lauri

[-- Attachment #2: qemu-linux-user-drop-preload.diff --]
[-- Type: text/x-patch, Size: 1933 bytes --]

Index: linux-user/main.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/main.c,v
retrieving revision 1.108
diff -u -r1.108 main.c
--- linux-user/main.c	14 Apr 2007 12:17:09 -0000	1.108
+++ linux-user/main.c	22 Apr 2007 19:36:43 -0000
@@ -1642,11 +1642,12 @@
            "usage: qemu-" TARGET_ARCH " [-h] [-g] [-d opts] [-L path] [-s size] [-cpu model] program [arguments...]\n"
            "Linux CPU emulator (compiled for %s emulation)\n"
            "\n"
-           "-h           print this help\n"
-           "-g port      wait gdb connection to port\n"
-           "-L path      set the elf interpreter prefix (default=%s)\n"
-           "-s size      set the stack size in bytes (default=%ld)\n"
-           "-cpu model   select CPU (-cpu ? for list)\n"
+           "-h                print this help\n"
+           "-g port           wait gdb connection to port\n"
+           "-L path           set the elf interpreter prefix (default=%s)\n"
+           "-s size           set the stack size in bytes (default=%ld)\n"
+           "-cpu model        select CPU (-cpu ? for list)\n"
+           "-keep-ld-preload  retain LD_PRELOAD\n"
            "\n"
            "debug options:\n"
 #ifdef USE_CODE_COPY
@@ -1678,7 +1679,8 @@
     int optind;
     const char *r;
     int gdbstub_port = 0;
-    
+    int keep_ld_preload = 0;
+
     if (argc <= 1)
         usage();
 
@@ -1750,6 +1752,8 @@
 #endif
                 _exit(1);
             }
+        } else if (!strcmp(r, "keep-ld-preload")) {
+            keep_ld_preload = 1;
         } else 
 #ifdef USE_CODE_COPY
         if (!strcmp(r, "no-code-copy")) {
@@ -1778,6 +1782,8 @@
     env = cpu_init();
     global_env = env;
     
+    if (!keep_ld_preload) unsetenv("LD_PRELOAD");
+
     if (loader_exec(filename, argv+optind, environ, regs, info) != 0) {
 	printf("Error loading %s\n", filename);
 	_exit(1);

             reply	other threads:[~2007-04-22 19:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-22 19:39 Lauri Leukkunen [this message]
2007-04-22 20:03 ` [Qemu-devel] [PATCH] Make user-mode emu drop LD_PRELOAD Paul Brook
2007-04-22 20:37   ` Lauri Leukkunen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53fbb7580704221239y30eb99c2of276cb62806a7ca3@mail.gmail.com \
    --to=lle@rahina.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).