-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# userlandexec | ||
## userland exec for Linux x86_64 | ||
|
||
This code emulates an `exec()` system call. That is, it reads and ELF format file, | ||
and loads it into memory at the right place, and then starts the newly-loaded | ||
executable 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 place | ||
in memory. | ||
|
||
### Building | ||
|
||
Run `make` - that should compile `example` and `ulexec.so`. Once you've | ||
done that, you can try it out: | ||
|
||
`./example ./ulexec.so /usr/bin/cat /proc/self/maps` | ||
|
||
### Fun | ||
|
||
`./example ./ulexec.so `./example ./ulexec.so `./example ./ulexec.so /usr/bin/cat /proc/self/maps` | ||
|
||
Yes! You can have it overlay itself with another copy of itself. |