Bug 494075

Summary: openbios bug causes qemu-system-ppc "invalid/unsupported opcode" failure
Product: [Fedora] Fedora Reporter: Adam Goode <adam>
Component: openbiosAssignee: Glauber Costa <gcosta>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dwmw2, gcosta, jakub, jan.kratochvil, markmc, nickc, proski, rjones, rrakus, virt-maint, zikken
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.0-1.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-06-05 07:00:19 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 480594    
Attachments:
Description Flags
openbios-ppc, r482, working
none
Fix for the bug
none
openbios-ppc, r487, working, compiled by F10 binutils
none
openbios-ppc, r487, not working, compiled by F11 binutils
none
openbios-ppc, r487 with the sbss fix, working, compiled by F11 binutils
none
Simpler fix - just merge .sbss and .sbss.* into .bss none

Description Adam Goode 2009-04-03 21:19:43 EDT
Description of problem:
I am trying to boot a PPC Fedora image. This version worked:
2:qemu-system-ppc-0.10-0.12.kvm20090323git.fc11.x86_64, but now it fails with:

invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0



Version-Release number of selected component (if applicable):
qemu-system-ppc-0.10-4.fc11.x86_64


How reproducible:
Always.

Steps to Reproduce:
$ qemu-system-ppc -cdrom Fedora-10-ppc-netinst.iso
Comment 1 Adam Goode 2009-04-05 15:19:56 EDT
Also with this release, qemu-system-arm stopped working:

$ qemu-system-arm -M versatilepb rootfs-f10-dev -kernel zImage-versatile-2.6.24-rc7.armv5tel


#0  0x0000003ad6a17f07 in SDL_memcpySSE (to=<value optimized out>, 
    from=<value optimized out>, len=<value optimized out>)
    at src/video/SDL_blit.c:141
#1  SDL_BlitCopy (to=<value optimized out>, from=<value optimized out>, 
    len=<value optimized out>) at src/video/SDL_blit.c:172
#2  0x0000003ad6a17d4a in SDL_SoftBlit (src=0x2dd8f60, 
    srcrect=<value optimized out>, dst=0x2dc4010, dstrect=0x7fff18391dc0)
    at src/video/SDL_blit.c:97
#3  0x0000003ad6a2e0ec in SDL_LowerBlit (src=0x2dd8f60, srcrect=0x7fff18391d70, 
    dst=0xa00, dstrect=0xa00) at src/video/SDL_surface.c:440
#4  0x0000003ad6a2e2c7 in SDL_UpperBlit (src=0x7f9d013ea000, 
    srcrect=<value optimized out>, dst=0xa00, dstrect=0xa00)
    at src/video/SDL_surface.c:530
#5  0x00000000004c4cdf in sdl_update (ds=<value optimized out>, x=0, y=0, w=640, 
    h=<value optimized out>) at sdl.c:66
#6  0x000000000043c650 in dpy_update (h=<value optimized out>, 
    w=<value optimized out>, y=<value optimized out>, x=<value optimized out>, 
    s=<value optimized out>) at ../console.h:156
#7  pl110_update_display (h=<value optimized out>, w=<value optimized out>, 
    y=<value optimized out>, x=<value optimized out>, s=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/hw/pl110.c:225
#8  0x00000000004c4d4a in sdl_refresh (ds=0x2d24f80) at sdl.c:417
#9  0x00000000004087ce in dpy_refresh (s=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/console.h:183
#10 gui_update (s=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:3499
#11 0x000000000040908a in qemu_run_timers (current_time=<value optimized out>, 
    ptimer_head=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:1240
#12 main_loop_wait (current_time=<value optimized out>, 
    ptimer_head=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:3812
#13 0x000000000040cbaa in main_loop ()
    at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:3972
#14 main () at /usr/src/debug/qemu-kvm-0.10/qemu/vl.c:6126
Comment 2 Mark McLoughlin 2009-04-06 05:28:38 EDT
Thanks, it looks like a known bug in libSDL

*** This bug has been marked as a duplicate of bug 487720 ***
Comment 3 Glauber Costa 2009-04-07 10:49:58 EDT
Adam,

Can you include a trace of the ppc crash, for us to be sure about the problem?
Comment 4 Adam Goode 2009-04-07 11:59:01 EDT
ppc doesn't crash, it just produces this message and hangs:

invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0


I will test tonight with new SDL.
Comment 5 Adam Goode 2009-04-07 17:48:52 EDT
Oops, this has nothing to do with the SDL crash. I am not sure how to proceed in debugging this problem.
Comment 6 Mark McLoughlin 2009-04-09 11:01:52 EDT
Thanks Adam.

Could you confirm that it boots with -nographic?

If so, then from what I can make out from qemu-devel discussion:

  http://www.archivum.info/qemu-devel@nongnu.org/2009-03/msg01087.html

the bug is in openbios and this should be the fix:

  http://tracker.coreboot.org/trac/openbios/changeset/481
Comment 7 Adam Goode 2009-04-09 11:39:10 EDT
No luck:

$ qemu-system-ppc -nographic Fedora-10-ppc-DVD.iso 
invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0
Comment 8 Adam Goode 2009-04-09 11:44:20 EDT
I'm running openbios-ppc-1.0-0.5.svn463.fc11.noarch, according to the message, the fix is in r481?
Comment 9 Mark McLoughlin 2009-04-09 11:54:39 EDT
(In reply to comment #8)
> I'm running openbios-ppc-1.0-0.5.svn463.fc11.noarch, according to the message,
> the fix is in r481?

Well, according to the message, if it was the same problem it should go away when you use -nographic.

Sounds like we're on an arbitrary svn snapshot, though.

Glauber, do you think it would be worthwhile updating to latest svn? Do you know if they have any plans to do a release?
Comment 10 Adam Goode 2009-04-09 12:01:28 EDT
Can you do a scratch build of the latest openbios? Happy to test it.
Comment 11 Pavel Roskin 2009-04-12 01:24:34 EDT
I've rebuild openbios from the source RPM on a PowerPC system (Fedora 10 PPC, G3 Blue & White) and it's working for me.  The binary from Rawhide is failing in exactly the same way as for the reported.  The binary must be miscompiled.
Comment 12 Pavel Roskin 2009-04-12 01:26:51 EDT
Created attachment 339211 [details]
openbios-ppc, r482, working
Comment 13 Glauber Costa 2009-04-14 13:16:12 EDT
r463 is not arbitrary. It _is_ the release (as odly as it seems).

If you go to openbios website, and try to get the "1.0" release, you'll get to this link:

http://tracker.coreboot.org/trac/openbios/changeset/463/openbios-devel?old_path=%2F&old=463&format=zip

Note the /changeset/463

There are no tarballs. I can update the revision, But I'd prefer to leave it this way, and apply this patch.
Comment 14 Adam Goode 2009-04-15 23:55:59 EDT
Not working for me:

$ rpm -q openbios-ppc
openbios-ppc-1.0-0.6.svn463.fc11.noarch

$ qemu-system-ppc Fedora-10-ppc-DVD.iso 
invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0
Comment 15 Mark McLoughlin 2009-04-19 11:01:37 EDT
(In reply to comment #13)
> There are no tarballs. I can update the revision, But I'd prefer to leave it
> this way

That's fine, thanks, I just didn't realize

(In reply to comment #14)
> Not working for me:
> 
> $ rpm -q openbios-ppc
> openbios-ppc-1.0-0.6.svn463.fc11.noarch
> 
> $ qemu-system-ppc Fedora-10-ppc-DVD.iso 
> invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
> invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0  

Adam - could you report this to the upstream mailing list?
Comment 16 Mark McLoughlin 2009-04-19 11:04:12 EDT
> (In reply to comment #14)
> > Not working for me:
> > 
> > $ rpm -q openbios-ppc
> > openbios-ppc-1.0-0.6.svn463.fc11.noarch
> > 
> > $ qemu-system-ppc Fedora-10-ppc-DVD.iso 
> > invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
> > invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0  
> 
> Adam - could you report this to the upstream mailing list?  

Sorry, I misread - could you confirm that Pavel's build in comment #12 works for you?
Comment 17 Adam Goode 2009-04-19 14:03:54 EDT
Sorry! Yes, Pavel's build works.
Comment 18 Henri Zikken 2009-05-05 08:29:10 EDT
That build works, however contains a new bug. Using that openbios version, my kernel doesn't boot at all. It will boot from CD-rom, but not with a -kernel option.

I was using:

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img -append "root=/dev/hdc3"

I want to use -nographic but versions < 482 give the mentioned error. This version does not give an error, but does not boot either.

Versions < 482 do boot with the above commandline.
Comment 19 Mark McLoughlin 2009-05-05 09:22:12 EDT
Henri, Adam, Pavel - the best way to get this resolved is to work with upstream to find a fix
Comment 20 Pavel Roskin 2009-05-05 12:54:19 EDT
I'm afraid we have drifted from the original problem.  The problem with reading iso images is present upstream.  I believe it has never worked, so it's not a "new bug".

But the problem with invalid opcode is not present upstream, not even in the release 1.0.  It must be caused by the Fedora build system and it's still not fixed.  The current version 0:1.0-0.6.svn463.fc11 is still broken.
Comment 21 Mark McLoughlin 2009-05-05 13:28:01 EDT
(In reply to comment #20)

> But the problem with invalid opcode is not present upstream, not even in the
> release 1.0.  It must be caused by the Fedora build system and it's still not
> fixed.

Agreed; I posted this request for help upstream a while back:

  http://lists.gnu.org/archive/html/qemu-devel/2009-04/msg01227.html

Just a suggestion to you guys to follow up with upstream and see if the problem can be narrowed down enough to confirm that it's a compiler issue
Comment 22 Henri Zikken 2009-05-05 14:29:18 EDT
To clarify: I don't get the opcode bug with the r482 build.

I'm getting the qemu prompt, instead of linux booting.

This boots from the CD-rom without errors (v482):

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img
-append "root=/dev/hdc3" -boot d -nographic

This boots without errors (V463):

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img
-append "root=/dev/hdc3"

This doesn't load the kernel, just loads the qemu prompt (v482):

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img
-append "root=/dev/hdc3"

So does this:

qemu-system-ppc -hda hd.img -cdrom cd.iso -kernel vmlinux -initrd initrd.img
-append "root=/dev/hdc3" -nographic

So the opcode bug was fixed, the -nographic option now works, but the fix broke the booting from a kernel.

I'll try 'upstream'..
Comment 23 Pavel Roskin 2009-05-06 11:59:39 EDT
It's not gcc, it's binutils.  Upgrading gcc from 4.3.2 to 4.4.0 from rawhide doesn't cause the invalid opcode.  However, upgrading binutils from 2.18.50.0.9 to 2.19.51.0.2 does cause it!
Comment 24 Mark McLoughlin 2009-05-06 13:54:13 EDT
Great stuff Pavel, moving to binutils
Comment 25 Nick Clifton 2009-05-08 06:18:50 EDT
Hi Guys,

  Would it be possible for someone to post a copy of the openbios-ppc file that is broken, so that I can compare it to the working r482 version ?

  One thing that has changed with the 2.19.51.0.2 binutils rpm is the addition of support for version 2.06 of the PowerPC ISA.  (This is the binutils-2.19.51.0.2-IBM.patch in the rpm).  You might like to try removing this patch from the sources and then rebuilding the binutils.  This may allow you to build a working bios image, (and help me isolate where the bug can be found).

Cheers
  Nick
Comment 26 Roman Rakus 2009-05-15 10:53:32 EDT
I have tried attachment -> not working
I have tried rebuild binutils without binutils-2.19.51.0.2-IBM.patch and then rebuilt openbios -> not working.
Comment 27 Pavel Roskin 2009-05-16 19:36:03 EDT
Rebuilding binutils without binutils-2.19.51.0.2-IBM.patch doesn't help.  Rebuilding binutils without any Fedora patches doesn't help either.  I'm still getting "invalid opcode".

I've patched r487 to fix a warning in the IDE code (the code was indeed buggy, to put it mildly) and to fix or suppress strict aliasing warnings.  Then I compared the "objdump -x" output for the binaries made with the F10 binutils and the F11 binutils.  The former has many sections starting with .sbss followed by a number.  The later has one .sbss section.  Also, the F11 version had an extra segment with vaddr 0x00000000:

    LOAD off    0x000000b4 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000044 flags rw-

I changed the linker script to consolidate and align the .sbss sections, and it helped!  The resulting binary has one .sbss section and no extra segment.  The "invalid opcode" error is gone.
Comment 28 Pavel Roskin 2009-05-16 19:50:31 EDT
Created attachment 344302 [details]
Fix for the bug
Comment 29 Pavel Roskin 2009-05-16 19:52:20 EDT
Created attachment 344303 [details]
openbios-ppc, r487, working, compiled by F10 binutils
Comment 30 Pavel Roskin 2009-05-16 19:53:01 EDT
Created attachment 344304 [details]
openbios-ppc, r487, not working, compiled by F11 binutils
Comment 31 Pavel Roskin 2009-05-16 19:53:45 EDT
Created attachment 344305 [details]
openbios-ppc, r487 with the sbss fix, working, compiled by F11 binutils
Comment 32 Pavel Roskin 2009-05-16 21:06:36 EDT
Created attachment 344309 [details]
Simpler fix - just merge .sbss and .sbss.* into .bss
Comment 33 Richard W.M. Jones 2009-05-18 13:34:52 EDT
Just a note that I'm seeing failures of libguestfs on
ppc and ppc64, apparently because of this.  Some
sample builds which have failed:

http://koji.fedoraproject.org/koji/taskinfo?taskID=1361259
http://koji.fedoraproject.org/koji/taskinfo?taskID=1361261
Comment 34 Pavel Roskin 2009-05-18 20:54:18 EDT
The bug is fixed upstream in r488.  You probably want to pull r489 as well, as it fixes the ATA breakage.  Actually, I still cannot get OpenBIOS to read any filesystem in qemu, but your mileage may vary.
Comment 35 Roman Rakus 2009-05-20 09:59:52 EDT
I have tried:
svn export -r489 svn://openbios.org/openbios/trunk/openbios-devel openbios-devel
cd openbios-devel
config/scripts/switch-arch ppc
make
cp obj-ppc/openbios-qemu.elf /usr/share/openbios/openbios-ppc

but I still get invalid/unsupported opcode...
Comment 36 Pavel Roskin 2009-05-20 16:59:05 EDT
I can reproduce your problem, but it's a separate bug.

qemu-system-ppc appears to be broken on PowerPC.  That's how it fails:

# qemu-system-ppc -hda noboot.iso
*** WARNING: no opcode defined !
invalid/unsupported opcode: 12 - 1e - 0d (4bf0237d) fffffffc 0

Note that the "WARNING" is absent on x86_64.  I believe it means that no opcodes are known to the emulator.  The invalid opcode is found at the position 0xfffffffc, which is the start address for PowerPC.  It comes from the .romentry section.

Disassembling openbios-ppc with objdump gives:

fffffffc <.romentry>:
fffffffc:       4b f0 23 7d     bl      0xfff02378

Thus, 4b f0 23 7d is a valid instruction, but qemu-system-ppc fails to interpret it.

This bug is about an error on x86_64.  In this case, there is no "WARNING" and the error is:

invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1

I believe it's caused by qemu starting at the position 0 because it finds a segment at that address corresponding to the .sbss section.  Grouping .sbss with .bss eliminates that segment.
Comment 37 Mark McLoughlin 2009-05-21 12:07:46 EDT
Thanks Pavel, I'm pushing an update with your fix:

* Thu May 21 2009 Mark McLoughlin <markmc@redhat.com> - 1.0-1
- Replace previous attempt to fix bug #494075 with fix from Pavel Roskin
- Drop the 0.x.463 numbering; we are using official upstream 1.0


Adam, Henri, Roman - please test out this new version and file new bugs for any issues other than:

  invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1

Things just get way to confusing if we mix different issues up in the one bug report
Comment 38 Richard W.M. Jones 2009-05-21 12:28:36 EDT
I'm very confused here ...  Which bug is qemu-system-ppc running
on PPC failing with:

invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0

Or do we need to open another bug for that?
Comment 39 Fedora Update System 2009-05-21 12:38:49 EDT
openbios-1.0-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/openbios-1.0-1.fc11
Comment 40 Mark McLoughlin 2009-05-21 13:40:58 EDT
(In reply to comment #38)
> I'm very confused here ...  Which bug is qemu-system-ppc running
> on PPC failing with:
> 
> invalid/unsupported opcode: 00 - 18 - 01 (00004070) 00000004 1
> invalid/unsupported opcode: 00 - 04 - 17 (000095c8) 000095ec 0
> 
> Or do we need to open another bug for that?  

This update should fix that issue, just make sure you have openbios-ppc-1.0-1.fc11.noarch installed

(The horribly confusing thing is that this is built on ppc using ppc binutils, but it's actually shipped as a noarch package installable on all arches)
Comment 41 Fedora Update System 2009-05-25 17:24:00 EDT
openbios-1.0-1.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update openbios'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-5394
Comment 42 Fedora Update System 2009-06-04 17:14:48 EDT
openbios-1.0-1.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 43 Roman Rakus 2009-06-05 06:35:37 EDT
Still not working here.
[rrakus@localhost ~]$ rpm -q openbios-ppc
openbios-ppc-1.0-1.fc11.noarch
[rrakus@localhost ~]$ qemu-system-ppc -boot d -m 256 -hda rhel-5 -cdrom RHEL5.3-Server-20090106.0-ppc-DVD.iso -M prep
*** WARNING: no opcode defined !
invalid/unsupported opcode: 12 - 02 - 18 (4bfffe05) fffffffc 0
invalid/unsupported opcode: 00 - 00 - 00 (00000000) 00000700 0
Comment 44 Mark McLoughlin 2009-06-05 07:00:19 EDT
Roman: I think you're testing on qemu-system-ppc on a ppc host? This bug is about qemu-system-ppc on an x86_64 host.

See what Pavel said above:

(In reply to comment #36)
> I can reproduce your problem, but it's a separate bug.
> 
> qemu-system-ppc appears to be broken on PowerPC.  That's how it fails:
> 
> # qemu-system-ppc -hda noboot.iso
> *** WARNING: no opcode defined !
> invalid/unsupported opcode: 12 - 1e - 0d (4bf0237d) fffffffc 0
> 
> Note that the "WARNING" is absent on x86_64.

Please file a new bug for this issue