Skip to content

Instantly share code, notes, and snippets.

@dannas
Created November 21, 2015 21:51
Show Gist options
  • Save dannas/45cffc338cf3691f4519 to your computer and use it in GitHub Desktop.
Save dannas/45cffc338cf3691f4519 to your computer and use it in GitHub Desktop.
#include <sys/auxv.h>
#include <stdio.h>
/* Write vdso segment to a file for post inspection by objdump. */
int main(int argc, char* argv[], char** envp) {
FILE* fp = fopen("foo.vdso", "w+");
/* Fetch pointer to start of vdso section. */
void* p = (void*)getauxval(AT_SYSINFO_EHDR);
/* On my system vdso appears to use two pages when inspecting a couple
of running programs /proc/<pid>/maps files. */
fwrite(p, 2*4096, 1, fp);
fclose(fp);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment