Created
February 3, 2015 17:36
-
-
Save jjelinek/9722817c1b00c9ee12e4 to your computer and use it in GitHub Desktop.
vsyscall
This file contains hidden or 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
#include <stdio.h> | |
#include <signal.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int (*gettod)(int *) = (void *)0xffffffffff600000; | |
static void | |
vsyscall() | |
{ | |
char buf[256]; | |
int now, rval; | |
rval = gettod(&now); | |
snprintf(buf, sizeof (buf), "result of gettod is %d\n", now); | |
write(1, buf, strlen(buf) + 1); | |
} | |
int | |
main(int argc, char **argv) | |
{ | |
struct sigaction act; | |
(void) sigemptyset(&act.sa_mask); | |
act.sa_flags = SA_SIGINFO; | |
act.sa_handler = NULL; | |
if (sigaction(SIGSEGV, &act, NULL) != 0) { | |
perror("sigaction"); | |
exit(EXIT_FAILURE); | |
} | |
vsyscall(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment