diff options
Diffstat (limited to 'results/scraper/fex/1647')
| -rw-r--r-- | results/scraper/fex/1647 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/results/scraper/fex/1647 b/results/scraper/fex/1647 new file mode 100644 index 00000000..bd9a45a6 --- /dev/null +++ b/results/scraper/fex/1647 @@ -0,0 +1,24 @@ +Inconsistency in RootFS handling between bare ELFs and shebangs +As mentioned on Discord the other day, there is an inconsistency in how the binary lookup in LinuxSyscalls is handled between actual ELF binaries and files with a shebang. + +For the `execve()`/… path, the RootFS path is only prepended to absolute paths if the file actually exists there: + +https://github.com/FEX-Emu/FEX/blob/8ad14728f6e4b5da4d1a42a38910785aa18802c7/Source/Tests/LinuxSyscalls/Syscalls.cpp#L122-L131 + +For actual ELF binaries, this is the only path involved. If that file starts with a shebang, however, the RootFS path is prepended unconditionally to the path specified in the shebang, no matter whether the file actually exists in the RootFS or not: + +https://github.com/FEX-Emu/FEX/blob/8ad14728f6e4b5da4d1a42a38910785aa18802c7/Source/Tests/LinuxSyscalls/Syscalls.cpp#L98-L103 + +(same in FEXLoader) + +This seems odd, and breaks use cases where most of the x86_64 files actually do exist on the host (with proper paths), and only few "emulated" binaries are to be read from the RootFS instead. + +Additionally, part of the shebang handling logic is duplicated between FEXLoader and LinuxSyscalls, which might sensibly be merged: + +https://github.com/FEX-Emu/FEX/blob/8ad14728f6e4b5da4d1a42a38910785aa18802c7/Source/Tests/FEXLoader.cpp#L125-L155 + +https://github.com/FEX-Emu/FEX/blob/8ad14728f6e4b5da4d1a42a38910785aa18802c7/Source/Tests/LinuxSyscalls/Syscalls.cpp#L74-L103 + +--- + +I was working on a fix for this, until @Sonicadvance1 pointed out that in situations where the RootFS isn't really necessary (e.g. when using Nix with binfmt_misc or similar, where binaries for both architectures exist side-by-side on the host and paths are properly set up for this), I might just as well disable the RootFS altogether. Still, it seems that the inconsistency here is unexpected behaviour – I am happy to finish this up and open a PR if desired. \ No newline at end of file |