Kernel version (host): Linux version 5.11.0-40-generic (buildd@lgw01-amd64-010) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021
Kernel version (target): Linux version 5.4.154 (builder@buildhost) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r16325-88151b8303)) #0 SMP Sun Oct 24 09:01:35 2021
QEMU version: qemu-6.1.0 and 5.2.0
OpenWRT version: 21.02.1
Hello everyone,
I have an issue where an emulated x86_64 OpenWRT image will not restart.
With enabled KVM the issue will not occur.
The used OpenWRT image can be downloaded from
https://downloads.openwrt.org/releases/21.02.1/targets/x86/64/openwrt-21.02.1-x86-64-generic-ext4-combined.img.gz .
How to reproduce the problem:
# first copy the Dockerfile mentioned below in the working folder, after that:
# (from the host) build and run the image
docker build -t openwrt-qemu-sample:local ./ && docker run -it --rm openwrt-qemu-sample:local
# (from the container) start QEMU (but do not enable KVM!)
qemu-system-x86_64 -M q35 -rtc base=utc,clock=host,driftfix=none \
-m 4096 -nographic -serial mon:stdio \
-drive file=openwrt-21.02.1-x86-64-generic-ext4-combined.img,id=d0,if=none,bus=0,unit=0 \
-device ide-hd,drive=d0,bus=ide.0 \
-nic user,model=virtio-net-pci \
-d cpu_reset,unimp,guest_errors,nochain \
-D ./log.txt
# (from the VM inside the container) reboot OpenWRT
reboot
Shutting the VM down using 'halt' will not produce the issue.
I got following log output repeated in the log.txt file inside the container:
Triple fault
CPU Reset (CPU 0)
EAX=000f6006 EBX=00000000 ECX=00000000 EDX=00000cf9
ESI=00000000 EDI=00100000 EBP=00000000 ESP=00000fb4
EIP=000f1203 EFL=00000006 [-----P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
CS =0008 00000000 ffffffff 00cf9b00 DPL=0 CS32 [-RA]
SS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
DS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
FS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
GS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT= 000f6070 00000037
IDT= 000f60ae 00000000
CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
CCS=000f60b8 CCD=00009f44 CCO=SUBL
EFER=0000000000000000
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=0000000000000000 0000000000000000 XMM01=0000000000000000 0000000000000000
XMM02=0000000000000000 0000000000000000 XMM03=0000000000000000 0000000000000000
XMM04=0000000000000000 0000000000000000 XMM05=0000000000000000 0000000000000000
XMM06=0000000000000000 0000000000000000 XMM07=0000000000000000 0000000000000000
Invalid access at addr 0xB0000000, size 2, region '(null)', reason: rejected
Invalid access at addr 0xB0008000, size 2, region '(null)', reason: rejected
Invalid access at addr 0xB0010000, size 2, region '(null)', reason: rejected
...
To reproduce the problem I build the following Docker file:
FROM debian:stable-20211011
RUN apt-get update -y
RUN apt-get install -y wget
RUN apt-get install -y \
wget \
build-essential ninja-build \
git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev
RUN wget
https://downloads.openwrt.org/releases/21.02.1/targets/x86/64/openwrt-21.02.1-x86-64-generic-ext4-combined.img.gzRUN gunzip openwrt-21.02.1-x86-64-generic-ext4-combined.img.gz ; true
RUN wget
https://download.qemu.org/qemu-6.1.0.tar.xz && \
tar xf qemu-6.1.0.tar.xz && \
cd qemu-6.1.0 && \
./configure --target-list=x86_64-softmmu && \
make -j && \
make install && \
cd / && \
rm -rf qemu-6.1.0.tar.xz qemu-6.1.0
We found out that the issue will occur using QEMU 6.1.0 and 5.2.0, but not with version '4.2.1 (Debian 1:4.2-3ubuntu6.18)'.
Regards,
Raphael