diff options
author | Andy Lutomirski <luto@mit.edu> | 2011-06-16 14:02:11 -0400 |
---|---|---|
committer | Andy Lutomirski <luto@mit.edu> | 2011-06-16 14:02:11 -0400 |
commit | d892847eea2cca8ff86877919c360bbdfb1e15fe (patch) | |
tree | 558d7dafb4e884adde5a7a58bb9fdb4fcdc335f5 | |
parent | 83310bdd6db1fbd54d581039b1570b8baa4f7f55 (diff) | |
download | misc-tests-d892847eea2cca8ff86877919c360bbdfb1e15fe.tar.gz |
Add dump-vsyscall
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | dump-vsyscall.c | 20 |
3 files changed, 25 insertions, 1 deletions
@@ -1,4 +1,5 @@ dump-vdso +dump-vsyscall timing_test time-warp-test evil-clock-test @@ -1,5 +1,5 @@ .PHONY: all -all: timing_test evil-clock-test test_vsyscall dump-vdso +all: timing_test evil-clock-test test_vsyscall dump-vdso dump-vsyscall timing_test: timing_test.cc g++ -o $@ -lrt -ldl -O2 -Wall -g $^ @@ -12,3 +12,6 @@ test_vsyscall: test_vsyscall.cc dump-vdso: dump-vdso.c gcc -o $@ -ldl -O2 $^ + +dump-vsyscall: dump-vsyscall.c + gcc -o $@ -ldl -O2 $^ diff --git a/dump-vsyscall.c b/dump-vsyscall.c new file mode 100644 index 0000000..db11b83 --- /dev/null +++ b/dump-vsyscall.c @@ -0,0 +1,20 @@ +#include <unistd.h> +#include <stdio.h> +#include <string.h> + +int main() +{ + /* The kernel thinks that the vsyscall address is no good. */ + char buf[4096]; + memcpy(buf, (void *)0xffffffffff600000, 4096); + int ret = write(1, buf, 4096); + if (ret < 0) { + perror("write"); + return 1; + } else if (ret != 4096) { + fprintf(stderr, "output truncated -- whoops\n"); + return 1; + } + + return 0; +} |