* [Qemu-devel] TCG/GCC breakage
@ 2009-03-11 3:40 Glauber Costa
2009-03-11 8:32 ` Aurelien Jarno
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Glauber Costa @ 2009-03-11 3:40 UTC (permalink / raw)
To: qemu-devel@nongnu.org
I'm seeing a strange behaviour here using qemu-system-x86_64
(kvm not even compiled in) on an i386 host
I'm suspecting gcc is doing something nasty in here, but I'll open it
up here to see if any
of you have any suggestion.
I get segfaults very early in execution, and after some investigation,
I figured out that
ebp register is corrupted. I can't determine where the corruption starts.
I then did rm x86-64-softmmu/op_helper.o; make CC=gcc34, so only this
file get compiled
by an older gcc, and it worked again.
So it seems to me gcc may be generating gibberish somewhere in
helpers, but since
this code is a bit fragile, it might well be some mistake on our part.
Ideas on how to attack it ?
--
Glauber Costa.
"Free as in Freedom"
http://glommer.net
"The less confident you are, the more serious you have to act."
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Qemu-devel] TCG/GCC breakage
2009-03-11 3:40 [Qemu-devel] TCG/GCC breakage Glauber Costa
@ 2009-03-11 8:32 ` Aurelien Jarno
2009-03-11 10:34 ` Paul Bolle
2009-03-16 8:26 ` Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2009-03-11 8:32 UTC (permalink / raw)
To: qemu-devel
On Wed, Mar 11, 2009 at 12:40:20AM -0300, Glauber Costa wrote:
> I'm seeing a strange behaviour here using qemu-system-x86_64
> (kvm not even compiled in) on an i386 host
>
> I'm suspecting gcc is doing something nasty in here, but I'll open it
> up here to see if any
> of you have any suggestion.
>
> I get segfaults very early in execution, and after some investigation,
> I figured out that
> ebp register is corrupted. I can't determine where the corruption starts.
Does QEMU segfault, or processes in the guest? How to reproduce that?
Which QEMU version are you using? I am able to run a Debian Etch x86_64
guest without problem here.
> I then did rm x86-64-softmmu/op_helper.o; make CC=gcc34, so only this
> file get compiled
> by an older gcc, and it worked again.
Which versions of gcc did you tried? I am using gcc 4.3 here.
> So it seems to me gcc may be generating gibberish somewhere in
> helpers, but since
> this code is a bit fragile, it might well be some mistake on our part.
>
> Ideas on how to attack it ?
>
You may want to use the -d option to find the offending helper function.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] TCG/GCC breakage
2009-03-11 3:40 [Qemu-devel] TCG/GCC breakage Glauber Costa
2009-03-11 8:32 ` Aurelien Jarno
@ 2009-03-11 10:34 ` Paul Bolle
2009-03-16 8:26 ` Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Paul Bolle @ 2009-03-11 10:34 UTC (permalink / raw)
To: Glauber Costa; +Cc: qemu-devel
On Wed, 2009-03-11 at 00:40 -0300, Glauber Costa wrote:
> I'm seeing a strange behaviour here using qemu-system-x86_64
> (kvm not even compiled in) on an i386 host
For what it's worth, the same seems to happen here with an i386 guest on
an i386 host.
> I get segfaults very early in execution, and after some investigation,
> I figured out that ebp register is corrupted. I can't determine where
> the corruption starts.
>
> I then did rm x86-64-softmmu/op_helper.o; make CC=gcc34, so only this
> file get compiled by an older gcc, and it worked again.
If I compile (i386-softmmu/qemu and thus) i386-softmmu/op_helper.o with
Fedora rawhide's current gcc (i.e. 4.4.0 20090307 (Red Hat 4.4.0-0.23))
qemu segfaults very early too. If I recompile just that file with gcc34
(i.e, 3.4.6 20060404 (Red Hat 3.4.6-13)) qemu does not segfault very
early anymore.
Paul Bolle
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] TCG/GCC breakage
2009-03-11 3:40 [Qemu-devel] TCG/GCC breakage Glauber Costa
2009-03-11 8:32 ` Aurelien Jarno
2009-03-11 10:34 ` Paul Bolle
@ 2009-03-16 8:26 ` Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2009-03-16 8:26 UTC (permalink / raw)
To: qemu-devel
On Wed, Mar 11, 2009 at 12:40:20AM -0300, Glauber Costa wrote:
> I'm seeing a strange behaviour here using qemu-system-x86_64
> (kvm not even compiled in) on an i386 host
>
> I'm suspecting gcc is doing something nasty in here, but I'll open it
> up here to see if any
> of you have any suggestion.
>
> I get segfaults very early in execution, and after some investigation,
> I figured out that
> ebp register is corrupted. I can't determine where the corruption starts.
>
> I then did rm x86-64-softmmu/op_helper.o; make CC=gcc34, so only this
> file get compiled
> by an older gcc, and it worked again.
>
> So it seems to me gcc may be generating gibberish somewhere in
> helpers, but since
> this code is a bit fragile, it might well be some mistake on our part.
>
> Ideas on how to attack it ?
>
I have been able to find time to look a bit more closer at this issue. I
confirm that I am able to reproduce it with GCC 4.4, and that the %ebp
register is corrupted after a call to some helpers.
However, contrary to what I expected, it doesn't crash on call to
helpers from TCG code, but rather on call of helper from cpu-exec.c. One
of them is helper_cc_compute_all(). A diff on the assembly code between
GCC 4.3 and 4.4 shows that %ebp is now used to access values in static
tables, but is then never restored.
It looks like that GCC is being mistaken by the fact that %ebp is used
as the env register and consider that this register does not have to be
saved and restored. That's why I really think it is a GCC 4.4 issue, and
not a QEMU one.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-16 8:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-11 3:40 [Qemu-devel] TCG/GCC breakage Glauber Costa
2009-03-11 8:32 ` Aurelien Jarno
2009-03-11 10:34 ` Paul Bolle
2009-03-16 8:26 ` Aurelien Jarno
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).