barbudreadmon / fbalpha-backup-dontuse-ty

Deprecated port of Final Burn Alpha to Libretro (v0.2.97.43).
61 stars 43 forks source link

Segfault with some pgm games #144

Closed alarixnia closed 7 years ago

alarixnia commented 7 years ago

Only happens when launching games from the menu, not the command line (or standalone fba). Observable in kov2p:

Thread 1 "retroarch" received signal SIGSEGV, Segmentation fault.
0x00007fffe6778497 in Arm7ReadByte (addr=939524096) at src/cpu/arm7_intf.cpp:208
208                     return membase[READ][addr >> PAGE_SHIFT][addr & PAGE_BYTE_AND];
(gdb) bt
#0  0x00007fffe6778497 in Arm7ReadByte (addr=939524096) at src/cpu/arm7_intf.cpp:208
#1  0x00007fffe677fb1d in arm7_cpu_read8 (addr=939524096) at src/cpu/arm7/arm7core.c:187
#2  0x00007fffe6788eaa in Arm7Run (cycles=1039) at src/cpu/arm7/arm7exec.c:802
#3  0x00007fffe61a4956 in pgm_cpu_sync () at src/burn/drv/pgm/pgm_asic27a_type2.cpp:23
#4  0x00007fffe61a49fe in asic27a_read_byte (address=13697025) at src/burn/drv/pgm/pgm_asic27a_type2.cpp:50
#5  0x00007fffe6770d55 in ReadByte (a=13697025) at src/cpu/m68000_intf.cpp:221
#6  0x00007fffe677194f in M68KReadByte (a=13697025) at src/cpu/m68000_intf.cpp:659
#7  0x00007fffe5c807f1 in m68ki_read_8_fc (address=13697025, fc=5) at src/cpu/m68k/m68kcpu.h:1135
#8  0x00007fffe5c81456 in OPER_AL_8 () at src/cpu/m68k/m68kcpu.h:1350
#9  0x00007fffe5cb3d00 in m68k_op_move_8_d_al () at src/cpu/m68k/m68kops.c:17358
#10 0x00007fffe5c80107 in m68k_execute (num_cycles=1666) at src/cpu/m68k/m68kcpu.c:827
#11 0x00007fffe6772a56 in SekRun (nCycles=1666) at src/cpu/m68000_intf.cpp:1423
#12 0x00007fffe61a0979 in pgmFrame () at src/burn/drv/pgm/pgm_run.cpp:866
#13 0x00007fffe5d4eade in BurnDrvFrame () at src/burn/burn.cpp:719
#14 0x00007fffe68ea5b0 in ForceFrameStep () at src/burner/libretro/libretro.cpp:795
#15 0x00007fffe68ebcb0 in retro_run () at src/burner/libretro/libretro.cpp:1317
#16 0x000000000040d819 in core_run () at core_impl.c:415
#17 0x0000000000411e35 in runloop_iterate (sleep_ms=sleep_ms@entry=0x7fffffffe8ec) at retroarch.c:3051
#18 0x000000000040c732 in rarch_main (argc=1, argv=<optimized out>, data=0x0) at frontend/frontend.c:129
#19 0x00007ffff55f64ca in __libc_start_main () from /usr/lib/libc.so.6
#20 0x0000000000409fba in _start ()

Also happens with theglad and kovsh.

barbudreadmon commented 7 years ago

What do you mean, the game will crash only if you access it from a retroarch playlist ?

alarixnia commented 7 years ago

Yes. Also through the load content option.

barbudreadmon commented 7 years ago

Hmmm perhaps it is worth mentioning this to @twinaphex then. What's your OS exactly ?

alarixnia commented 7 years ago

Arch Linux, x86_64. I also have Armbian and NetBSD amd64 to hand, where I can't reproduce it.

FWIW, I don't think this is a RetroArch bug. It's likely a memory safety issue that exists in standalone FBA but it doesn't always result in the program crashing, depending on operating system and process memory layout. I can only get standalone FB Alpha working on Windows because its SDL build system needs a bit of love...

barbudreadmon commented 7 years ago

This is quite misleading, didn't you say the bug won't happen on command line ? If the bug happen from the retroarch menu but not from command line, there is obviously something weird with retroarch. Or did you mean the fba standalone command line ? Your first post was unclear about it, this is why i asked if "the game will crash only if you access it from a retroarch playlist".

I noticed a similar issue with happy6 and kovqhsgs 6 months ago, only happening on linux x86_64 :

================================================================= ==14897==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fe7fe39e9bd sp 0x7ffe59c37a80 bp 0x7ffe59c37a90 T0)

0 0x7fe7fe39e9bc in Arm7WriteByte(unsigned int, unsigned char) src/cpu/arm7_intf.cpp:141

1 0x7fe7fe3c696a in arm7_cpu_write8 src/cpu/arm7/arm7core.c:151

2 0x7fe7fe3c696a in HandleMemSingle src/cpu/arm7/arm7core.c:920

3 0x7fe7fe3c696a in Arm7Run(int) src/cpu/arm7/arm7exec.c:1312

4 0x7fe7fd7e5184 in pgmFrame() src/burn/drv/pgm/pgm_run.cpp:873

5 0x7fe7fe5782ec in ForceFrameStep src/burner/libretro/libretro.cpp:792

6 0x7fe7fe5782ec in retro_run src/burner/libretro/libretro.cpp:1314

7 0x41b090 (/usr/bin/retroarch+0x41b090)

8 0x42ba65 (/usr/bin/retroarch+0x42ba65)

9 0x41a009 (/usr/bin/retroarch+0x41a009)

10 0x7fe8109e778f in __libc_start_main (/lib64/libc.so.6+0x2078f)

11 0x417508 (/usr/bin/retroarch+0x417508)

Never found out what was happening

barbudreadmon commented 7 years ago

It should be solved with the latest commit.