From: Stefan Weil <weil@mail.berlios.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-i386 segfaults running "hello world".
Date: Sat, 23 Jun 2007 13:12:39 +0200 [thread overview]
Message-ID: <467D0027.6040503@mail.berlios.de> (raw)
In-Reply-To: <200706221831.20531.rob@landley.net>
[-- Attachment #1: Type: text/plain, Size: 731 bytes --]
Rob Landley schrieb:
> Ok, it's a more fundamental problem:
>
> landley@triolith:/sys$ qemu-i386
> Segmentation fault (core dumped)
>
> Nothing to do with the program it's trying to run, it segfaults with no
> arguments.
>
> Is anybody else seeing this?
>
> Rob
Yes, I see this on Debian Linux since several months (libc update?).
The crash is caused by libc startup code which calls a null pointer.
QEMU provides this null pointer with the __init_array_start
workaround in linux-user/main.c.
This can be fixed with some kind of code hack - see my patch
(which is not really a solution, but one more workaround).
Nevertheless user mode emulations remains unusable even
with this patch because of TLS problems.
Regards,
Stefan
[-- Attachment #2: main.patch --]
[-- Type: text/x-diff, Size: 1200 bytes --]
Index: linux-user/main.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/main.c,v
retrieving revision 1.116
diff -u -b -B -r1.116 main.c
--- linux-user/main.c 21 Jun 2007 22:55:02 -0000 1.116
+++ linux-user/main.c 23 Jun 2007 11:03:42 -0000
@@ -45,12 +45,16 @@
/* for recent libc, we add these dummy symbols which are not declared
when generating a linked object (bug in ld ?) */
#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(CONFIG_STATIC)
-long __preinit_array_start[0];
-long __preinit_array_end[0];
-long __init_array_start[0];
-long __init_array_end[0];
-long __fini_array_start[0];
-long __fini_array_end[0];
+typedef void (*dummy_function_t)(void);
+static void dummy_function(void)
+{
+}
+dummy_function_t __preinit_array_start = dummy_function;
+dummy_function_t __preinit_array_end = dummy_function;
+dummy_function_t __init_array_start = dummy_function;
+dummy_function_t __init_array_end = dummy_function;
+dummy_function_t __fini_array_start = dummy_function;
+dummy_function_t __fini_array_end = dummy_function;
#endif
/* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
next prev parent reply other threads:[~2007-06-23 11:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-22 21:15 [Qemu-devel] qemu-i386 segfaults running "hello world" Rob Landley
2007-06-22 22:31 ` Rob Landley
2007-06-22 23:13 ` Alexander Graf
2007-06-22 23:27 ` andrzej zaborowski
2007-06-23 6:38 ` Rob Landley
2007-06-23 5:31 ` Rob Landley
2007-06-23 7:27 ` Alexander Graf
2007-06-24 5:40 ` Rob Landley
2007-06-23 7:41 ` Rob Landley
2007-06-23 11:00 ` Jens Axboe
2007-06-24 7:01 ` Rob Landley
2007-06-26 13:05 ` Jens Axboe
2007-06-23 9:50 ` Nigel Horne
2007-06-23 11:12 ` Stefan Weil [this message]
2007-06-24 7:36 ` [Qemu-devel] [PATCH] " Rob Landley
2007-07-02 15:02 ` Alexander Graf
2007-07-10 15:47 ` Rob Landley
2007-07-10 16:10 ` Andreas Färber
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=467D0027.6040503@mail.berlios.de \
--to=weil@mail.berlios.de \
--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).