Ruffle, VLC and XPSemu read their GOT at a fixed 0x400000 base from app0/imports.txt and fault once all imports load #4013

Closed
opened 2026-10-11 21:15:49 +00:00 by babyhuey · 9 comments
babyhuey commented 2026-10-11 21:15:49 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T21:15:49Z.


Three catalog titles ship app0/imports.txt and contain the same start-up code: Ruffle (PPSA68091), VLC (PPSA85300) and XPSemu (PPSA97358). Each line of the file is <offset> <name>, an import's GOT slot as an offset from the start of the image. For example, the first line of Ruffle's is 00000000024d5370 _init_env.

The title reads the file with fscanf(file, "%lx %127s", &offset, name) and then reads the slot at offset + 0x400000. So it assumes the executable (ET_SCE_DYNEXEC, first PT_LOAD at vaddr 0) is loaded at 0x400000. In Ruffle, at vaddr 0x1d4b:

1d36: call  [fscanf]                 ; rdi=FILE*, rsi="%lx %127s", rdx=&offset, rcx=name
1d42: cmp   eax, 2
1d4b: mov   rax, [rbp-0x30]          ; offset
1d4f: cmp   QWORD PTR [rax+0x400000], 0

The relinked image is mapped elsewhere, so the first read (0x24d5370 + 0x400000) faults.

On main 0a8b1d32, Ruffle reaches this point after #3725 (sinhf), #3580 (pause) and #3494 (pthread_attr_getscope) are merged. With those, every import loads and it logs can't write /data/ruffle/ruffle.log, then:

  • Linux: SIGSEGV at app.elf vaddr 0x1d4f, rax = 0x24d5370 (gdb).
  • Windows 11 (MinGW GCC 15.2): FATAL: unhandled exception 0xc0000005 ... app.exe+0x11d4f, read of 0x00000000028d5370.

VLC and XPSemu have the same %lx %127s scan and an imports.txt starting with _init_env. Both still stop on imports on main (VLC: getlogin_r, #3606; XPSemu: execv, #3544), so they would reach the same fault after those.

Possible directions: load the main executable at 0x400000 when that range is free, or reserve 0x400000 + image size and mirror the image's GOT there. I have not checked which fits the loader better.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5805268020 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T21:15:49Z. --- Three catalog titles ship `app0/imports.txt` and contain the same start-up code: Ruffle (PPSA68091), VLC (PPSA85300) and XPSemu (PPSA97358). Each line of the file is `<offset> <name>`, an import's GOT slot as an offset from the start of the image. For example, the first line of Ruffle's is `00000000024d5370 _init_env`. The title reads the file with `fscanf(file, "%lx %127s", &offset, name)` and then reads the slot at `offset + 0x400000`. So it assumes the executable (`ET_SCE_DYNEXEC`, first `PT_LOAD` at vaddr 0) is loaded at 0x400000. In Ruffle, at vaddr 0x1d4b: ``` 1d36: call [fscanf] ; rdi=FILE*, rsi="%lx %127s", rdx=&offset, rcx=name 1d42: cmp eax, 2 1d4b: mov rax, [rbp-0x30] ; offset 1d4f: cmp QWORD PTR [rax+0x400000], 0 ``` The relinked image is mapped elsewhere, so the first read (`0x24d5370 + 0x400000`) faults. On `main` 0a8b1d32, Ruffle reaches this point after #3725 (`sinhf`), #3580 (`pause`) and #3494 (`pthread_attr_getscope`) are merged. With those, every import loads and it logs `can't write /data/ruffle/ruffle.log`, then: - Linux: SIGSEGV at app.elf vaddr 0x1d4f, `rax` = 0x24d5370 (gdb). - Windows 11 (MinGW GCC 15.2): `FATAL: unhandled exception 0xc0000005 ... app.exe+0x11d4f`, `read of 0x00000000028d5370`. VLC and XPSemu have the same `%lx %127s` scan and an `imports.txt` starting with `_init_env`. Both still stop on imports on `main` (VLC: `getlogin_r`, #3606; XPSemu: `execv`, #3544), so they would reach the same fault after those. Possible directions: load the main executable at 0x400000 when that range is free, or reserve 0x400000 + image size and mirror the image's GOT there. I have not checked which fits the loader better.
babyhuey commented 2026-10-12 14:36:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-12T14:36:26Z.


Update: this is now Ruffle's stop on plain main. With #3725, #3580 and #3494 merged, main 8fa5cc48 (Linux, catalog run without extra PRs) loads every import, logs jailbreak ok: already root ... (can't write /data/ruffle/ruffle.log) and exits with SIGSEGV. gdb shows the same read as above:

rip 0x555555555d4f  (app.elf + 0x1d4f)
rax 0x24d5370
=> cmpq $0x0,0x400000(%rax)

app.elf's first segment is mapped at 0x555555554000, so 0x24d5370 + 0x400000 is unmapped.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6126433728 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6126433728). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-12T14:36:26Z. --- Update: this is now Ruffle's stop on plain `main`. With #3725, #3580 and #3494 merged, `main` 8fa5cc48 (Linux, catalog run without extra PRs) loads every import, logs `jailbreak ok: already root ... (can't write /data/ruffle/ruffle.log)` and exits with SIGSEGV. gdb shows the same read as above: ``` rip 0x555555555d4f (app.elf + 0x1d4f) rax 0x24d5370 => cmpq $0x0,0x400000(%rax) ``` app.elf's first segment is mapped at 0x555555554000, so `0x24d5370 + 0x400000` is unmapped.
Recapi commented 2026-10-12 15:27:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-12T15:27:45Z.


I'm taking the Linux side of this: a relinker option that places the executable's lowest load page at a requested address on Linux (--linux-fixed-base 0x400000), the counterpart of #4140's --windows-fixed-base. Guest modules keep their normal placement. I'll post it here with Ruffle (PPSA68091) before and after, so nobody duplicates it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127335948 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6127335948). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-12T15:27:45Z. --- I'm taking the Linux side of this: a relinker option that places the executable's lowest load page at a requested address on Linux (`--linux-fixed-base 0x400000`), the counterpart of #4140's `--windows-fixed-base`. Guest modules keep their normal placement. I'll post it here with Ruffle (PPSA68091) before and after, so nobody duplicates it.
Recapi commented 2026-10-12 16:27:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-12T16:27:59Z.


Linux side is #4593: --linux-fixed-base 0x400000 writes the executable as ET_EXEC with every address rebased. With it, Ruffle (PPSA68091) gets past the 0x400000(%rax) read on Linux and renders, then stops at an unrelated AGC limit (CB_COLOR_CONTROL 0x00cc0050, mode FMASK decompress). It also fixes libkernel's default-scope dlsym, which missed symbols of a non-PIE main program.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128338380 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6128338380). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-12T16:27:59Z. --- Linux side is #4593: `--linux-fixed-base 0x400000` writes the executable as `ET_EXEC` with every address rebased. With it, Ruffle (PPSA68091) gets past the `0x400000(%rax)` read on Linux and renders, then stops at an unrelated AGC limit (`CB_COLOR_CONTROL 0x00cc0050, mode FMASK decompress`). It also fixes libkernel's default-scope `dlsym`, which missed symbols of a non-PIE main program.
Recapi commented 2026-10-12 18:53:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-12T18:53:13Z.


With #4593, Ruffle's game library UI runs on Linux. It initializes the display, input and audio, and presented 2,400 frames in 60 s until the timeout. Opening Favorites starts the Flash player, which stops at an AGC limit: CB_COLOR_CONTROL 0x00cc0050, mode FMASK decompress. Details are in the PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6130594584 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6130594584). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-12T18:53:13Z. --- With #4593, Ruffle's game library UI runs on Linux. It initializes the display, input and audio, and presented 2,400 frames in 60 s until the timeout. Opening Favorites starts the Flash player, which stops at an AGC limit: `CB_COLOR_CONTROL 0x00cc0050, mode FMASK decompress`. Details are in the PR.
Recapi commented 2026-10-12 18:59:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-12T18:59:25Z.


Ruffle's next stop after #4593, the player's first FMASK decompress over a 4x MSAA target with DCC, is tracked in #4685, with the register state and a quality=Low workaround.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6130689581 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6130689581). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-12T18:59:25Z. --- Ruffle's next stop after #4593, the player's first FMASK decompress over a 4x MSAA target with DCC, is tracked in #4685, with the register state and a quality=Low workaround.
dantdmdarealguy commented 2026-10-14 05:45:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-10-14T05:45:37Z.


Windows side, confirmed on main 30f961266: Ruffle (PPSA68091, catalog release) runs when it's relinked with #4140's --windows-fixed-base 0x400000.

Windows 11 Pro, i9-14900K, RTX 5080 (driver 32.0.16.1714), WinLibs GCC 15.2.0, Release. eboot.bin and sce_module/libc.prx were unwrapped, and eboot.bin and imports.txt were kept in app0. Each run lasted 60 s.

  • relinker --windows --registry eboot.elf app.exe: exits 0xC0000005 after 3.8 s, at rip = app.exe+0x11d4f, reading 0x28d5370. That is the fault in this issue.
  • The same command plus --windows-fixed-base 0x400000: runs the full 60 s to the library screen ("No games yet") at about 62 FPS, and exits 0 on WM_CLOSE.

Ruffle with --windows-fixed-base 0x400000, 57 s

So no Windows code change is needed, only the option. The Linux side is #4593.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161807328 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6161807328). Originally posted by [dantdmdarealguy](https://github.com/dantdmdarealguy) on 2026-10-14T05:45:37Z. --- Windows side, confirmed on `main` `30f961266`: Ruffle (PPSA68091, catalog release) runs when it's relinked with #4140's `--windows-fixed-base 0x400000`. Windows 11 Pro, i9-14900K, RTX 5080 (driver 32.0.16.1714), WinLibs GCC 15.2.0, Release. `eboot.bin` and `sce_module/libc.prx` were unwrapped, and `eboot.bin` and `imports.txt` were kept in `app0`. Each run lasted 60 s. - `relinker --windows --registry eboot.elf app.exe`: exits `0xC0000005` after 3.8 s, at `rip` = `app.exe+0x11d4f`, reading `0x28d5370`. That is the fault in this issue. - The same command plus `--windows-fixed-base 0x400000`: runs the full 60 s to the library screen ("No games yet") at about 62 FPS, and exits 0 on `WM_CLOSE`. ![Ruffle with --windows-fixed-base 0x400000, 57 s](https://raw.githubusercontent.com/dantdmdarealguy/AnyPS5/pr-assets/issue4013/ruffle-fixed-base-57s.png) So no Windows code change is needed, only the option. The Linux side is #4593.
adriadam10 commented 2026-10-14 11:56:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T11:56:11Z.


#4593 adds --linux-fixed-base (Linux side, covered by linux_fixed_base); Ruffle and XPSemu get past the GOT read on Linux, the titles' later stops are tracked elsewhere, so this issue stays open.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6167771102 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6167771102). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T11:56:11Z. --- #4593 adds `--linux-fixed-base` (Linux side, covered by `linux_fixed_base`); Ruffle and XPSemu get past the GOT read on Linux, the titles' later stops are tracked elsewhere, so this issue stays open.
babyhuey commented 2026-10-22 06:44:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-22T06:44:54Z.


Linux update: since #8973 made 0x400000 the default Linux base, all three titles get past the GOT read with a plain relink, with no --linux-fixed-base. On main d6eafa54 in my catalog sweep (headless, SDL offscreen driver):

Title main 94fbb8cea (PIE base) main d6eafa54
Ruffle (PPSA68091) SIGSEGV at 0.2 s DisplayWindow Vulkan check, like the other headless UI titles
VLC (PPSA85300) SIGSEGV at 0.1 s same
XPSemu (PPSA97358) SIGSEGV runs about 3 s into its GPU work (compute dispatches), its later stop in #5437

On Windows the default from #4237 is 0x140000000, and VLC still needed --windows-fixed-base 0x400000 in my last Windows runs. Should this stay open for the Windows default, or is --windows-fixed-base the intended answer there?

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6334568450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6334568450). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-22T06:44:54Z. --- Linux update: since #8973 made `0x400000` the default Linux base, all three titles get past the GOT read with a plain relink, with no `--linux-fixed-base`. On `main` `d6eafa54` in my catalog sweep (headless, SDL offscreen driver): | Title | `main` `94fbb8cea` (PIE base) | `main` `d6eafa54` | |---|---|---| | Ruffle (PPSA68091) | SIGSEGV at 0.2 s | `DisplayWindow` Vulkan check, like the other headless UI titles | | VLC (PPSA85300) | SIGSEGV at 0.1 s | same | | XPSemu (PPSA97358) | SIGSEGV | runs about 3 s into its GPU work (compute dispatches), its later stop in #5437 | On Windows the default from #4237 is `0x140000000`, and VLC still needed `--windows-fixed-base 0x400000` in my last Windows runs. Should this stay open for the Windows default, or is `--windows-fixed-base` the intended answer there? AI-assisted: yes
babyhuey commented 2026-10-22 09:39:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-22T09:39:00Z.


The Windows half, on main 7e2ba73e4 (Windows 11, RTX 3080, WinLibs GCC 15.2, Release, 60 s each). The relink is the harness's default command, with and without --windows-fixed-base 0x400000:

Title Default relink (ImageBase 0x140000000) --windows-fixed-base 0x400000
Ruffle (PPSA68091) 0xC0000005 at 2.6 s, rip app.exe+0x11d4f still running, 98.85 FPS
VLC (PPSA85300) 0xC0000005 at 2.1 s, rip app.exe+0x107004 still running, 119.88 FPS
XPSemu (PPSA97358) 0xC0000005 at 2.1 s, rip app.exe+0xc88d9f still running, 109.78 FPS

So on Windows these titles still need the option, as USAGE.md says. The default comes from WindowsPeFormat.hpp (ImageBase = 0x140000000), which #8973 didn't touch. Would 0x400000 work as the Windows default too, the way #8973 did it for Linux, or does something on Windows rule that address out?

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337638270 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4013#issuecomment-6337638270). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-22T09:39:00Z. --- The Windows half, on `main` `7e2ba73e4` (Windows 11, RTX 3080, WinLibs GCC 15.2, Release, 60 s each). The relink is the harness's default command, with and without `--windows-fixed-base 0x400000`: | Title | Default relink (`ImageBase` 0x140000000) | `--windows-fixed-base 0x400000` | |---|---|---| | Ruffle (PPSA68091) | 0xC0000005 at 2.6 s, rip `app.exe+0x11d4f` | still running, 98.85 FPS | | VLC (PPSA85300) | 0xC0000005 at 2.1 s, rip `app.exe+0x107004` | still running, 119.88 FPS | | XPSemu (PPSA97358) | 0xC0000005 at 2.1 s, rip `app.exe+0xc88d9f` | still running, 109.78 FPS | So on Windows these titles still need the option, as `USAGE.md` says. The default comes from `WindowsPeFormat.hpp` (`ImageBase = 0x140000000`), which #8973 didn't touch. Would `0x400000` work as the Windows default too, the way #8973 did it for Linux, or does something on Windows rule that address out? AI-assisted: yes
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#4013
No description provided.