QEMU 7.0.0-rc0: Random segfaults when running grep using qemu-arm-static
Host environment
- Operating system: Arch Linux
- OS/kernel version: Linux reki 5.16.14-arch1-1 #1 SMP PREEMPT Fri, 11 Mar 2022 17:40:36 +0000 x86_64 GNU/Linux
- Architecture: i386 (32 bit)
- QEMU flavor: qemu-arm-static
- QEMU version: qemu-arm version 6.2.90 (7.0.0 rc 0 from the qemu.org)
- QEMU command line: See the description
Emulated/Virtualized environment
- Operating system: Linux
- OS/kernel version: Any Linux
- Architecture: ARM
Description of problem
I'm running ARM binaries using 32 bit qemu-arm-static on x86_64 host. Sometimes when running grep via qemu, I get a random segmentation fault. Sometimes it happens faster, sometimes it takes several thousand iterations, but sooner or later it happens and really annoying.
This problem is also reproduced on 6.2, 5.2 and 5.1 releases, and NOT reproduced on 5.0
I wrote small test to demonstrate this bug.
Steps to reproduce
- Download the test environment: qemu-test-segfault.tar.bz2
$ make # To build the docker container
$ make shell # To run ARM bash
- Inside a container, run
while true; do /qemu /bin/grep -E f text > /dev/null; [ $? -ne 0 ] && break; done
. After a while you will get segfault:
[root@0d81b08f032b /]# /qemu --version
qemu-arm version 6.2.90
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
[root@0d81b08f032b /]# while true; do /qemu /bin/grep -E f text > /dev/null; [ $? -ne 0 ] && break; done
Segmentation fault (core dumped)
[root@0d81b08f032b /]#
Edited by Maxim Devaev