context/rnd: paging/stack/heap/virtualization

This commit is contained in:
steveej 2017-09-21 21:53:48 +02:00
parent 12b71b3744
commit 83c5540a42
8 changed files with 972 additions and 382 deletions

View file

@ -39,10 +39,27 @@ static void caller(void) {
printer(&a, &b);
}
static void shell() {
char *argv[] = {};
execve("/bin/sh", argv, NULL);
}
static void simple_printer(void) { fprintf(stderr, "I wonder who called me?"); }
static void modifier(void) {
uint64_t *p;
// without frame-pointer
*(&p + 1) = (uint64_t *)simple_printer;
// with frame-pointer
*(&p + 2) = (uint64_t *)simple_printer;
}
int main(void) {
caller();
many_args(0xfffffffffffffff0, 0xfffffffffffffff1, 0xfffffffffffffff3,
0xfffffffffffffff4, 0xfffffffffffffff5, 0xfffffffffffffff6,
0xfffffffffffffff7);
// caller();
// many_args(0xfffffffffffffff0, 0xfffffffffffffff1, 0xfffffffffffffff3,
// 0xfffffffffffffff4, 0xfffffffffffffff5, 0xfffffffffffffff6,
// 0xfffffffffffffff7);
modifier();
return 0;
}