45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
#include <iostream>
|
|
|
|
/*
|
|
TODO
|
|
1. getopt -> --spslr=<dir>, --bin=<file>
|
|
2. Recursively gather all spslr CU files
|
|
3. Loop over all symbols of the binary
|
|
-> associate blocks via CU uid symbol
|
|
-> find __spslr_program symbol (spslr vaddr pivot)
|
|
4. Find virtual address and file address for all pins
|
|
5. Calculate target randomization order
|
|
6. Emit patcher program into final executable and set __spslr_program
|
|
*/
|
|
|
|
/*
|
|
<sourcefile>.spslr:
|
|
|
|
SPSLR <CU filename> <CU uid symbol>
|
|
target <name> <local uid> <size> <field count>
|
|
f <offset> <size> <flags>
|
|
f <offset> <size> <flags>
|
|
...
|
|
ipin <label> <target uid> <field offset>
|
|
ipin <label> <target uid> <field offset>
|
|
ipin <label> <target uid> <field offset>
|
|
...
|
|
dpin <local/global> <symbol> <offset> <level> <target uid>
|
|
dpin <local/global> <symbol> <offset> <level> <target uid>
|
|
...
|
|
|
|
|
|
|
|
Datapins for same var/symbol are randomized in order of their level, from bottom of nest to top
|
|
The CU uid symbol helps differentiating between e.g. "file.c" and "sub/file.c" (symbtab has no idea)
|
|
Between CUs, types with the same name HAVE TO HAVE the same layout -> randomized together
|
|
To begin with, anonymous types are not allowed for randomization (later solved with hash(type) instead of name)!
|
|
|
|
Note -> field alignment should probably be gathered by pinpoint plugin!
|
|
|
|
*/
|
|
|
|
int main(int argc, char** argv) {
|
|
std::cout << "Hello World!" << std::endl;
|
|
}
|