Public bug reported:
The FreeBSD 15.0 powerpc64le install image does not boot on the pseries
machine with the qemu packages in noble, resolute and stonking. I came across
this on a GitHub ubuntu-24.04 runner while building a FreeBSD image:
https://github.com/zakinko/netbsd-ci-images/actions/runs/35805309470
FreeBSD/powerpc64le Open Firmware loader, Revision 3.0
Booting [/boot/kernel/kernel]...
( 700 ) Program Exception [ 2000 ]
To reproduce:
curl -O
https://download.freebsd.org/releases/powerpc/powerpc64le/ISO-IMAGES/15.0/FreeBSD-15.0-RELEASE-powerpc-powerpc64le-bootonly.iso
qemu-system-ppc64 -nographic -nic none -cpu power9 -m 4096 -smp 1 \
-machine
pseries,accel=tcg,usb=off,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off
\
-drive
file=FreeBSD-15.0-RELEASE-powerpc-powerpc64le-bootonly.iso,format=raw,if=none,id=cd,media=cdrom,readonly=on
\
-device virtio-scsi-pci,id=scsi0 -device
scsi-cd,bus=scsi0.0,drive=cd,bootindex=0
It should get to the installer's "Console type [vt100]:" prompt.
The cause is in SLOF. Its loops over the ELF program headers run once too
often, and for a little-endian image that byte-swaps the 32 bytes after the
last header. In this loader .text starts 12 bytes after it, so the first 20
bytes of code are swapped. One of them, a stwu (9421fff0), becomes f0ff2194,
which is decoded as a VSX instruction.
SLOF fixed it in June:
https://gitlab.com/slof/slof/-/commit/a82ac61
QEMU picked that up in 11.1.0 with 07a20852f4. FreeBSD has since padded its
loader to avoid this, so 14.5 and 15.1 are not affected, but the 15.0 image is.
The commit applies to roms/SLOF in the noble source as it is. I built
slof.bin from that source with and without it, and only the one with the
commit boots the image. With that slof.bin given by -bios:
noble 1:8.2.2+ds-0ubuntu1.18 Program Exception -> installer
resolute 1:10.2.1+ds-1ubuntu3.3 Program Exception -> installer
stonking 1:11.0.3+ds-2ubuntu2 Program Exception -> installer
On noble I also booted the Debian trixie ppc64el netboot image (to GRUB) and
FreeBSD 15.1 (to the installer). Both get as far with the new slof.bin as with
the packaged one.
The patch is attached. Would it be possible to have it in the development
release, and in noble as an SRU?
** Affects: qemu (Ubuntu)
Importance: Undecided
Status: New
** Patch added: "ubuntu-qemu-slof-phdr.patch"
https://bugs.launchpad.net/bugs/2176107/+attachment/6020954/+files/ubuntu-qemu-slof-phdr.patch
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2176107
Title:
qemu-system-ppc64: SLOF corrupts the first bytes of some ELF boot
loaders (FreeBSD/powerpc64le 15.0 does not boot)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2176107/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs