blob: 3db32c4b4f65216902128684f791d4b664cda3a1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
Mutex initialization assertion failure due to incompatibility with macOS setrlimit() syscall
Description of problem:
Running the command with with any set of arguments instantly crashes with the following error message:
```
Assertion failed: (mutex->initialized), function qemu_mutex_lock_impl, file ../util/qemu-thread-posix.c, line 92.
zsh: abort ./qemu-system-x86_64
```
Steps to reproduce:
As per instructions for building from scratch:
1. `mkdir build && cd build`
2. `../configure --prefix=$PWD/.. --audio-drv-list=sdl --disable-cocoa --enable-sdl --enable-sdl-image`
3. `make && make install`
4. `cd ../bin`
5. `./qemu-system-x86_64`
Additional information:
The issue is coming from the `os_setup_limits()` function in `os-posix.c`. As it turns out, the `setrlimit()` syscall behaves subtly different on macOS than on Linux systems, and the macOS man pages explicitly forbade the code on line 273.
Line 273 from `os-posix.c`:
```
nofile.rlim_cur = nofile.rlim_max;
```
macOS `setrlimit()` man page:
```
COMPATIBILITY
setrlimit() now returns with errno set to EINVAL in places that historically succeeded. It no longer accepts "rlim_cur = RLIM_INFINITY" for
RLIM_NOFILE. Use "rlim_cur = min(OPEN_MAX, rlim_max)".
```
The man page thankfully gives us the [patch](/uploads/e7c8c6e3b5620c3b1ee34e89661097f3/qemu.patch)
|