segmentation fault issue in qemu-option.c for both qemu-system-x86_64 and qemu-system-aarch64 Description of problem: Steps to reproduce: 1. Compile with; ``` | PKG_CONFIG_PATH="$PWD/../../lib/pkgconfig" ../../source/qemu-9.2.1/configure \ | |------------------------------------------------------------------------------------| | --extra-cflags="-I$PWD/../../source/angle/include -march=armv8-a+crc+crypto" \ | | --extra-ldflags="-L$PWD/../angle" \ | | --disable-cocoa \ | | --enable-sdl \ | | --prefix="$PWD/../.." | ``` 2.`./bin/qemu-system-aarch64 -machine virt,accel=hvf -cpu host` 3. Single liner for building: ``` curl -L https://gist.github.com/startergo/0d9a7425876c2b42f8b797af80fbe3d8/raw/run-arm-3dfx-sdl.sh | bash - ``` Additional information: ``` lldb -- ./bin/qemu-system-aarch64 -machine virt,accel=hvf -cpu host (lldb) target create "./bin/qemu-system-aarch64" Current executable set to '/Users/macbookpro/Downloads/qemu-3dfx-arch/bin/qemu-system-aarch64' (arm64). (lldb) settings set -- target.run-args "-machine" "virt,accel=hvf" "-cpu" "host" (lldb) run Process 64856 launched: '/Users/macbookpro/Downloads/qemu-3dfx-arch/bin/qemu-system-aarch64' (arm64) Process 64856 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGUSR2 frame #0: 0x0000000199d78cc0 libsystem_kernel.dylib`__sigsuspend + 8 libsystem_kernel.dylib`__sigsuspend: -> 0x199d78cc0 <+8>: b.lo 0x199d78ce0 ; <+40> 0x199d78cc4 <+12>: pacibsp 0x199d78cc8 <+16>: stp x29, x30, [sp, #-0x10]! 0x199d78ccc <+20>: mov x29, sp Target 0: (qemu-system-aarch64) stopped. (lldb) continue Process 64856 resuming Process 64856 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x0000000000000000 error: memory read failed for 0x0 Target 0: (qemu-system-aarch64) stopped. (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) * frame #0: 0x0000000000000000 frame #1: 0x00000001008539ec qemu-system-aarch64`get_opt_name_value [inlined] qemu_strchrnul(s="nic", c=44) at cutils.h:144:12 [opt] frame #2: 0x00000001008539e0 qemu-system-aarch64`get_opt_name_value [inlined] get_opt_value(p="nic", value=0x000000016fdff058) at qemu-option.c:71:18 [opt] frame #3: 0x00000001008539dc qemu-system-aarch64`get_opt_name_value(params=, firstname=, warn_on_flag=, help_wanted=0x0000000000000000, name=, value=0x000000016fdff058) at qemu-option.c:760:17 [opt] frame #4: 0x0000000100853c84 qemu-system-aarch64`opts_do_parse(opts=0x0000600002e30460, params="nic", firstname=, warn_on_flag=false, help_wanted=0x0000000000000000, errp=0x00000001018fd500) at qemu-option.c:808:13 [opt] frame #5: 0x0000000100853fbc qemu-system-aarch64`opts_parse(list=, params="nic", permit_abbrev=, warn_on_flag=false, help_wanted=0x0000000000000000, errp=0x00000001018fd500) at qemu-option.c:898:10 [opt] frame #6: 0x0000000100853ea0 qemu-system-aarch64`qemu_opts_parse(list=, params=, permit_abbrev=, errp=) at qemu-option.c:917:12 [opt] [artificial] frame #7: 0x00000001002937b4 qemu-system-aarch64`qemu_init [inlined] qemu_create_default_devices at vl.c:1446:9 [opt] frame #8: 0x0000000100293640 qemu-system-aarch64`qemu_init(argc=, argv=0x000000016fdff500) at vl.c:3692:5 [opt] frame #9: 0x00000001007b58c0 qemu-system-aarch64`main(argc=, argv=) at main.c:47:5 [opt] frame #10: 0x0000000199a2c274 dyld`start + 2840 lldb -- ./bin/qemu-system-x86_64 -machine q35,accel=hvf -cpu host (lldb) target create "./bin/qemu-system-x86_64" Current executable set to '/Users/macbookpro/Downloads/qemu-3dfx-arch/bin/qemu-system-x86_64' (arm64). (lldb) settings set -- target.run-args "-machine" "q35,accel=hvf" "-cpu" "host" (lldb) run Process 65669 launched: '/Users/macbookpro/Downloads/qemu-3dfx-arch/bin/qemu-system-x86_64' (arm64) Process 65669 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGUSR2 frame #0: 0x0000000199d78cc0 libsystem_kernel.dylib`__sigsuspend + 8 libsystem_kernel.dylib`__sigsuspend: -> 0x199d78cc0 <+8>: b.lo 0x199d78ce0 ; <+40> 0x199d78cc4 <+12>: pacibsp 0x199d78cc8 <+16>: stp x29, x30, [sp, #-0x10]! 0x199d78ccc <+20>: mov x29, sp Target 0: (qemu-system-x86_64) stopped. (lldb) continue Process 65669 resuming Process 65669 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x0000000000000000 error: memory read failed for 0x0 Target 0: (qemu-system-x86_64) stopped. (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) * frame #0: 0x0000000000000000 frame #1: 0x000000010053c7f0 qemu-system-x86_64`get_opt_name_value [inlined] qemu_strchrnul(s="nic", c=44) at cutils.h:144:12 [opt] frame #2: 0x000000010053c7e4 qemu-system-x86_64`get_opt_name_value [inlined] get_opt_value(p="nic", value=0x000000016fdff058) at qemu-option.c:71:18 [opt] frame #3: 0x000000010053c7e0 qemu-system-x86_64`get_opt_name_value(params=, firstname=, warn_on_flag=, help_wanted=0x0000000000000000, name=, value=0x000000016fdff058) at qemu-option.c:760:17 [opt] frame #4: 0x000000010053ca88 qemu-system-x86_64`opts_do_parse(opts=0x0000600002476ee0, params="nic", firstname=, warn_on_flag=false, help_wanted=0x0000000000000000, errp=0x00000001014fa230) at qemu-option.c:808:13 [opt] frame #5: 0x000000010053cdc0 qemu-system-x86_64`opts_parse(list=, params="nic", permit_abbrev=, warn_on_flag=false, help_wanted=0x0000000000000000, errp=0x00000001014fa230) at qemu-option.c:898:10 [opt] frame #6: 0x000000010053cca4 qemu-system-x86_64`qemu_opts_parse(list=, params=, permit_abbrev=, errp=) at qemu-option.c:917:12 [opt] [artificial] frame #7: 0x00000001001d6b00 qemu-system-x86_64`qemu_init [inlined] qemu_create_default_devices at vl.c:1446:9 [opt] frame #8: 0x00000001001d698c qemu-system-x86_64`qemu_init(argc=, argv=0x000000016fdff500) at vl.c:3692:5 [opt] frame #9: 0x000000010049e7c0 qemu-system-x86_64`main(argc=, argv=) at main.c:47:5 [opt] frame #10: 0x0000000199a2c274 dyld`start + 2840 --> ``` The line below ensures that proper tags are added to the issue. Please do not remove it. -->