Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

userland exec for Linux x86_64

License

NotificationsYou must be signed in to change notification settings

bediger4000/userlandexec

Repository files navigation

userland exec for Linux x86_64

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:

./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.


[8]ページ先頭

©2009-2025 Movatter.jp