Skip to content

Instantly share code, notes, and snippets.

@GBuella
Created November 3, 2016 15:21
Show Gist options
  • Save GBuella/ef74bc099a180e90ca65565ba59c5302 to your computer and use it in GitHub Desktop.
Save GBuella/ef74bc099a180e90ca65565ba59c5302 to your computer and use it in GitHub Desktop.
Trampoline tables
Original case ( without intercepting ):
/------------------------------\
| application |
\------------------------------/
|
|
/------------------------------\
| libc |
| |
| syscall syscall syscall |
| | | | |
\----|----------|---------|----/
| | |
| | | user space/kernel boundary
#### | ######## | ####### | #######
| | |
Linux
After hotpaching ( without a trampoline table ):
/------------------------------\
| application |
\------------------------------/
|
|
/------------------------------\
| libc |
| |
| jmp jmp jmp |
| | | | |
| | | | | | | |
\----|---|------|--|------|--|-/
| | | | | |
/----|---|------|--|------|--|-\
| | | | | | | |
| open | read | write | |
| jmp jmp jmp |
| |
| intercepting library |
| |
| |
| syscall |
| | |
\----|-------------------------/
|
| user space/kernel boundary
#### | ############################
|
Linux
After hotpaching ( with a trampoline table ):
/------------------------------\
| application |
\------------------------------/
|
|
/------------------------------\
| libc |
| |
| /------------------------------\
| / | \
| / /----------------------\ \
| | | | \ \
| jmp jmp jmp -----------\ \ \
| | | | | \ \ \
| | | | | \ \ \
\--|--------|---------|--------/ \ \ \
| | | \ \ \
| | | | | |
/--|--------|---------|--------------\ | | |
| | | | trampoline | | | |
| jmp jmp jmp table | | | |
| | | | | | | |
| | | | | | | |
\----|--------|---------|------------/ | | |
| | | / / /
| | | / / /
/----|--------|---------|------\ / / /
| | | | | / / /
| open write read | / / /
| jmp jmp jmp------/ / /
| | | | / /
| \ \------------------/ /
| \ | /
| \-------------------------/
| |
| intercepting library |
| |
| |
| syscall |
| | |
\----|-------------------------/
|
| user space/kernel boundary
#### | ############################
|
Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment