FEX-Emu / FEX

A fast usermode x86 and x86-64 emulator for Arm64 Linux
https://fex-emu.com
MIT License
2.34k stars 123 forks source link

Reasons to fork glibc #1208

Open Sonicadvance1 opened 3 years ago

Sonicadvance1 commented 3 years ago

We really don't want to do this, but there are some reasons to go about doing this and we need to track the pain points. This list will grow as we care about more things

Sonicadvance1 commented 3 years ago

Another reason. Glibc has deprecated a static application calling dlopen. It technically still works today but may be removed at any moment. We've already encountered a bug where FEX loading a thunk hasn't set up glibc's allocator function pointers, causing a crash. Dangerous as a fork since we would need to forgo the host glibc entirely for even host glibc. Spooky.

Sonicadvance1 commented 2 years ago

Another reason: With IR/Code caching we need to understand RIP relocations to named regions. Some relocations go in to the BSS region of an ELF. BSS regions aren't tracked through the named region tracking since they aren't bound to an FD. With a fork we could have an interface for defining a full named region including BSS to capture these sections.

ifquant commented 2 years ago

we could supply ld.so compatible with glibc, but without change libc.so. and FEXLoader is work as a libfex.so preload by ld.so. ? it seem's more reasonable.

neobrain commented 1 year ago

Being able to hook into longjmp could enable us to address a potential limitation of deferred asynchronous signal handling. Hooking into longjmp allows for detecting exits out of guest-provided signal handlers (see #2493 and https://github.com/FEX-Emu/FEX/blob/master/docs/DeferredSignals.md#disadvantages-of-cooperative-signal-deferring).