Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2022 19:36:08 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 268418] UEFI boot; i386 VM ; crash before jump to kernel
Message-ID:  <bug-268418-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268418

            Bug ID: 268418
           Summary: UEFI boot; i386 VM ; crash before jump to kernel
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: martin@bxlr.sk

Failure to uefi boot i386 VM on various hypervisors: qemu, VMware, VirtualB=
ox.
Crash happens when jump to kernel is done.
I've created test qemu VM, used the bios from sysutils/edk2.

VM:
qemu-system-i386 -s -m 2048 -bios QEMU_UEFI-i386.fd -debugcon file:debug.log
-global isa-debugcon.iobase=3D0x402 \
-serial file:serial.log \
-hda FreeBSD-13.1-RELEASE-i386.qcow2


Problem:

Loading kernel...
/boot/kernel/kernel text=3D0xfc084 text=3D0xb39210 text=3D0x5b5100 data=3D0=
xb0
data=3D0x109290+0x2d5540 syms=3D[0x4+0xe91c0+0x4+0x17caac]
Loading configured modules...
/boot/entropy size=3D0x1000
/etc/hostid size=3D0x25
Start @ 0x8fd000 ...
!!!! IA32 Exception Type - 06(#UD - Invalid Opcode)  CPU Apic ID - 00000000
!!!!
EIP  - 000B0000, CS  - 00000010, EFLAGS - 00000082
EAX  - 7FED4E40, ECX - 0000000C, EDX - 7FEBF2D4, EBX - 7FEBF2D4
ESP  - 7FEBF25C, EBP - 7FEBF298, ESI - 80000007, EDI - 7F347010
DS   - 00000008, ES  - 00000008, FS  - 00000008, GS  - 00000008, SS - 00000=
008
CR0  - 40000033, CR2 - 00000000, CR3 - 00000000, CR4 - 00000640
DR0  - 00000000, DR1 - 00000000, DR2 - 00000000, DR3 - 00000000
DR6  - FFFF0FF0, DR7 - 00000400
GDTR - 7FC7F000 00000047, IDTR - 7F88D010 000007FF
LDTR - 00000000, TR - 00000000
FXSAVE_STATE - 7FEBEFA0
!!!! Can't find image information. !!!!

With gdb I found the location where jump to kernel it being done:

   0x7f463a55:  mov    eax,ds:0x7f464734
   0x7f463a5a:  mov    ebx,edx
   0x7f463a5c:  push   0x10
   0x7f463a5e:  mov    esi,0x80000007
=3D> 0x7f463a63:  call   DWORD PTR [eax+0x18]

(gdb) x/16xw $eax
0x7fed4ea0:     0x00000000      0x00000000      0x00000000      0x00000000
0x7fed4eb0:     0x00000000      0x00000000      0x00000000      0x00000000
0x7fed4ec0:     0x00000000      0x00000000      0x00000000      0x00000000
0x7fed4ed0:     0x00000000      0x00000000      0x00000000      0x00000000
(gdb)

That explains the #UD exception. Problem is that kernel is not loaded at al=
l:

(gdb) x/2xw 0x8fd000
0x8fd000:       0xffffffff      0xffffffff
(gdb)

I don't have i386 HW capable of UEFI boot, I can test this only in VM.

I'm not familiar with the UEFI, debugging this is a bit of challenge for me=
. If
I understand it correctly at this stage (after
https://github.com/freebsd/freebsd-src/blob/main/stand/efi/loader/arch/i386=
/elf32_freebsd.c#L94)
I can't call printf any more.
I'm trying to get familiar with this but I thought opening PR would be worth
it.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268418-227>