firecracker
firecracker copied to clipboard
Memory map excludes 640th kB
Describe the bug
The memory map provided by Firecracker is
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003fffffff] usable
In other words, the first 639 kB of address space exists, and then addresses from 1 MB upwards (in this case up to 1 GB) exist.
The MP table is placed at address 0x9fc00, i.e.. in the last kB of the "normal" 640 kB of base memory -- but according to the memory map, this doesn't exist on the system!
This is harmless for Linux, because Linux's MP table parsing has a bug -- it assumes that there's always 640 kB of base memory. But it breaks FreeBSD, since FreeBSD looks at the memory map when following the Intel MP spec of "look in the last kB of base memory".
To Reproduce
- Start Firecracker
- Look at the memory map printed by the guest kernel
Expected behaviour
The memory map presented by Firecracker should go up to 640 kB, not 639 kB.
Environment
Latest Firecracker version checked out from main. Running on Ubuntu 22.04; guest kernel and rootfs from the "getting started" instructions.
Additional context
Checks
@cperciva seems like QEMU does this too:
qemu-system-x86_64 \
-nodefaults \
-no-user-config \
-display none \
-M microvm,accel=kvm,x-option-roms=off,pit=off,pic=off,rtc=off -cpu host \
-smp 1 -m 1024 \
-serial mon:stdio \
-kernel bzImage \
-initrd initrd.cpio.gz \
-append "earlyprintk=ttyS0 console=ttyS0 reboot=t"
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000d0000-0x00000000000effff] ACPI NVS
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003fffffff] usable
[ 0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
(I don't know anything about Firecracker, I just ran across this issue while searching for some e820 info)