relinker: guest module directory checks compare path spelling, so a different case or a symbolic link bypasses them #6136

Closed
opened 2026-10-14 23:05:35 +00:00 by zaryabzip · 3 comments
zaryabzip commented 2026-10-14 23:05:35 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by zaryabzip on 2026-10-14T23:05:35Z.


Two relinker checks compare guest module directories as path strings:

A directory reached under another spelling passes both checks. That happens with a different case on a case-insensitive volume (the default on APFS and NTFS), or with a symbolic link to the directory on any volume. Conversion still fails, but later and with an unrelated error.

Reproduced with a relinker-only build of main eea428ca8 (core/relinker is unchanged on 6239ceffc), on macOS 27.0.1 arm64 with APFS (case-insensitive). Linux and Windows output give the same results. picker/plugin.prx is a guest module, and picker.bin is a second main executable:

Arguments Result
--module-dir picker --executable picker/picker.bin --executable is in a guest module directory: picker/picker.bin
--module-dir Picker --executable picker/picker.bin .../Picker/picker.bin: Invalid string or symbol table
--executable sce_module/picker.bin --executable is in a guest module directory: sce_module/picker.bin
--executable SCE_MODULE/picker.bin .../sce_module/picker.bin: Invalid string or symbol table
--module-dir picker --module-dir picker Duplicate guest module directory: .../picker
--module-dir picker --module-dir Picker Conflicting guest output filename: plugin.prx.guest.prx

On a case-sensitive Ubuntu 24.04 container, a symbolic link linked to picker gives the same result as the Picker rows.

The module scan already compares the input executable with std::filesystem::equivalent. Comparing these directories the same way makes both checks hold. I have a fix with a regression test on a local branch (+30/−2), and I'll open it as a pull request if it is wanted while the queue is long. Not tested on a Windows host.

Found by @jotitadev in https://github.com/boykopovar/AnyPS5/pull/5512#issuecomment-6173073429.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5857118917 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6136). Originally posted by [zaryabzip](https://github.com/zaryabzip) on 2026-10-14T23:05:35Z. --- Two relinker checks compare guest module directories as path strings: - `--executable is in a guest module directory` ([core/relinker/main.cpp:213](https://github.com/boykopovar/AnyPS5/blob/6239ceffc84e0c104904e5454f8f3c1eb22a4049/core/relinker/main.cpp#L213-L214)) - `Duplicate guest module directory` ([core/relinker/cli/src/NativeModules.cpp:35](https://github.com/boykopovar/AnyPS5/blob/6239ceffc84e0c104904e5454f8f3c1eb22a4049/core/relinker/cli/src/NativeModules.cpp#L35)) A directory reached under another spelling passes both checks. That happens with a different case on a case-insensitive volume (the default on APFS and NTFS), or with a symbolic link to the directory on any volume. Conversion still fails, but later and with an unrelated error. Reproduced with a relinker-only build of `main` `eea428ca8` (`core/relinker` is unchanged on `6239ceffc`), on macOS 27.0.1 arm64 with APFS (case-insensitive). Linux and Windows output give the same results. `picker/plugin.prx` is a guest module, and `picker.bin` is a second main executable: | Arguments | Result | | --- | --- | | `--module-dir picker --executable picker/picker.bin` | `--executable is in a guest module directory: picker/picker.bin` | | `--module-dir Picker --executable picker/picker.bin` | `.../Picker/picker.bin: Invalid string or symbol table` | | `--executable sce_module/picker.bin` | `--executable is in a guest module directory: sce_module/picker.bin` | | `--executable SCE_MODULE/picker.bin` | `.../sce_module/picker.bin: Invalid string or symbol table` | | `--module-dir picker --module-dir picker` | `Duplicate guest module directory: .../picker` | | `--module-dir picker --module-dir Picker` | `Conflicting guest output filename: plugin.prx.guest.prx` | On a case-sensitive Ubuntu 24.04 container, a symbolic link `linked` to `picker` gives the same result as the `Picker` rows. The module scan already compares the input executable with `std::filesystem::equivalent`. Comparing these directories the same way makes both checks hold. I have a fix with a regression test on a local branch (+30/−2), and I'll open it as a pull request if it is wanted while the queue is long. Not tested on a Windows host. Found by @jotitadev in https://github.com/boykopovar/AnyPS5/pull/5512#issuecomment-6173073429.
jotitadev commented 2026-10-14 23:26:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T23:26:05Z.


Thanks for writing this up. I have a fix for both checks on jotitadev:fix/relinker-guest-module-path-identity (6e3b80d65, +39/−2, it merges cleanly on current main). It compares the directories with std::filesystem::equivalent, with regression tests for the case alias and the symbolic link in test_guest_module_dir.py and test_executables.py. I can't open it yet: with no merged PR, I'm limited to one open PR, and that slot is taken.

If yours is ready first, go ahead and open it. I'll run it on APFS (arm64 and x86-64 under Rosetta) and close my branch.

Written with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180724262 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6136#issuecomment-6180724262). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-14T23:26:05Z. --- Thanks for writing this up. I have a fix for both checks on `jotitadev:fix/relinker-guest-module-path-identity` (`6e3b80d65`, +39/−2, it merges cleanly on current `main`). It compares the directories with `std::filesystem::equivalent`, with regression tests for the case alias and the symbolic link in `test_guest_module_dir.py` and `test_executables.py`. I can't open it yet: with no merged PR, I'm limited to one open PR, and that slot is taken. If yours is ready first, go ahead and open it. I'll run it on APFS (arm64 and x86-64 under Rosetta) and close my branch. Written with AI assistance (Claude Code).
zaryabzip commented 2026-10-14 23:30:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by zaryabzip on 2026-10-14T23:30:43Z.


Thanks! You found it and your fix already covers both test files, so please open yours once your slot frees up. I'll drop my branch. Happy to run it on macOS when it's up.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180783658 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6136#issuecomment-6180783658). Originally posted by [zaryabzip](https://github.com/zaryabzip) on 2026-10-14T23:30:43Z. --- Thanks! You found it and your fix already covers both test files, so please open yours once your slot frees up. I'll drop my branch. Happy to run it on macOS when it's up.
MarcZX10 commented 2026-10-15 08:54:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T08:54:18Z.


I opened #6276 with the directory identity checks and Linux symlink regression coverage. Thanks for the report and for offering to validate the fix. @jotitadev @zaryabzip, if either of you can run the case-alias scenario on APFS or Windows, that would cover the platform behavior this Linux environment cannot exercise.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6188302161 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6136#issuecomment-6188302161). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-15T08:54:18Z. --- I opened #6276 with the directory identity checks and Linux symlink regression coverage. Thanks for the report and for offering to validate the fix. @jotitadev @zaryabzip, if either of you can run the case-alias scenario on APFS or Windows, that would cover the platform behavior this Linux environment cannot exercise.
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#6136
No description provided.