summary refs log tree commit diff stats
path: root/results/scraper/fex/documentation/1914
blob: 8d85ec4f8c76b49d56880f2da9cc14d471b7a737 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Address Space Stealing
As part of #1885 a few ideas turned up

We want to steal the address space first thing, before libc's _start, and also before the dynamic linker.

Current ideas on how to get there
- Make a custom ld-linux replacement, ld-stealmem
- ld-stealmem should steal the address space (example: https://github.com/FEX-Emu/fex-assorted-tests-bins/blob/main/address-space-stealing/alloc.cpp) 
- Implement our own mmap, munmap and put them in a section
- Use seccomp-bpf (test: https://github.com/FEX-Emu/fex-assorted-tests-bins/blob/main/seccomp/secccomp.c) to redirect to our internal mmap, munmap if the syscall doesn't come from our special section. Verified to work on x86_64 (ubuntu 22.04) and arm64 (ubuntu 20.04)
- Possibly make a virtual mmap flag to control host/guest mmaps
- Load the real ld-linux via our ELF loader (example: https://github.com/FEX-Emu/FEX/blob/main/Source/Tests/ELFCodeLoader2.h#L104)
- Modify the AT_ENTRYPOINT & friends 'as if' ld-linux was launched by the kernel
- destroy the stack frame and jump to ld-loader, which will load FEX
- (maybe for each thread?) make a je_malloc arena that is host-prefered
- provide host_malloc & friends

We can also define virtual syscalls, or extend prctl to control `ld-stealmem` better