You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This code emulates anexec() system call. That is, it reads an ELF format file,and loads it into memory at the correct address. It then starts the newly-loadedexecutable to running.
All this is usually done by the Linux kernel, so some bizarre things go on.For starters, the userland exec unmaps the currently-executing ELF file,so as to be able to put the new ELF file's contents in the right placein memory.
This code works with 64-bit Linux ELF files, compiled with GCC and linked against glibc.Other C runtimes (Musl libc, for example) cause errors mysterious to me.
Building
Runmake - that should compileexample andulexec.so. Once you'vedone that, you can try it out: