riboseinc / retrace

retrace is a versatile security vulnerability / bug discovery tool through monitoring and modifying the behavior of compiled binaries on Linux, OpenBSD/FreeBSD/NetBSD (shared object) and macOS (dynamic library).
Other
60 stars 19 forks source link

integrated retrace with libnereon #353

Open jjr840430 opened 6 years ago

jjr840430 commented 6 years ago

Here is the libnereon

jjr840430 commented 6 years ago

@ronaldtse @ikolomi Can you give the guide on how to use retrace_v2?

ghost commented 6 years ago

Sure Jin The main difference with v2 is that it’s designed to be programmable (I.e. shimming logic is described via common json syntax provided via environment var) and easily extendable (I.e. adding new shimable functions is merely a matter of providing its prototype and adding new actions is a mattter of implementing an interface).

The shiming mechanics is currently the same using LD preload. You will find 3 makefiles for different platforms- OS X,bsd and Linux

Please refer to examples in rertrace_v2/examples

Let me know in case you need more info

BR

On Wed, 4 Jul 2018 at 10:51 Jin notifications@github.com wrote:

@ronaldtse https://github.com/ronaldtse @ikolomi https://github.com/ikolomi Can you give the guide how to use retrace_v2?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/riboseinc/retrace/issues/353#issuecomment-402410996, or mute the thread https://github.com/notifications/unsubscribe-auth/AfMHW93yfZTIEVI6q1ZKnfWo20m8jCVlks5uDIH1gaJpZM4VCFWm .

jjr840430 commented 6 years ago

@ikolomi I did execute the following commands to test retrace_v2

cd retrace/src/retrace_v2
make
cd examples/getenv
make
LD_PRELOAD=$(pwd)/../../retrace_v2.so ./getenv_exmpl

Then it shows the following result:

dev@dev-virtual-machine:~/work/ribose/retrace/src/retrace_v2/examples/getenv$ ./getenv_exmpl LD_PRELOAD
[CONF][WARN]: config file not set, using the default conf
[FUNCS][DEBUG]: sizeof(struct FuncPrototype)=2412
[FUNCS][DEBUG]: Adding prototype for 'setlocale', hash: 21
[FUNCS][DEBUG]: New entry at hash: 21
[FUNCS][DEBUG]: Adding prototype for 'localeconv', hash: 85
[FUNCS][DEBUG]: New entry at hash: 85
[FUNCS][DEBUG]: Adding prototype for 'isalnum', hash: 42
[FUNCS][DEBUG]: New entry at hash: 42
[FUNCS][DEBUG]: Adding prototype for 'isalpha', hash: 13
[FUNCS][DEBUG]: New entry at hash: 13
[FUNCS][DEBUG]: Adding prototype for 'isblank', hash: 3
[FUNCS][DEBUG]: New entry at hash: 3
[FUNCS][DEBUG]: Adding prototype for 'iscntrl', hash: 18
[FUNCS][DEBUG]: New entry at hash: 18
[FUNCS][DEBUG]: Adding prototype for 'isdigit', hash: 92
[FUNCS][DEBUG]: New entry at hash: 92
[FUNCS][DEBUG]: Adding prototype for 'isgraph', hash: 125
[FUNCS][DEBUG]: New entry at hash: 125
[FUNCS][DEBUG]: Adding prototype for 'islower', hash: 48
[FUNCS][DEBUG]: New entry at hash: 48
[FUNCS][DEBUG]: Adding prototype for 'isprint', hash: 92
[FUNCS][DEBUG]: Added 'isprint' at hash: 92
[FUNCS][DEBUG]: Adding prototype for 'ispunct', hash: 105
[FUNCS][DEBUG]: New entry at hash: 105
[FUNCS][DEBUG]: Adding prototype for 'isspace', hash: 53
[FUNCS][DEBUG]: New entry at hash: 53
[FUNCS][DEBUG]: Adding prototype for 'isupper', hash: 81
[FUNCS][DEBUG]: New entry at hash: 81
[FUNCS][DEBUG]: Adding prototype for 'isxdigit', hash: 102
[FUNCS][DEBUG]: New entry at hash: 102
[FUNCS][DEBUG]: Adding prototype for 'toupper', hash: 32
[FUNCS][DEBUG]: New entry at hash: 32
[FUNCS][DEBUG]: Adding prototype for 'tolower', hash: 127
[FUNCS][DEBUG]: New entry at hash: 127
[FUNCS][DEBUG]: Adding prototype for 'signal', hash: 111
[FUNCS][DEBUG]: New entry at hash: 111
[FUNCS][DEBUG]: Adding prototype for 'raise', hash: 69
[FUNCS][DEBUG]: New entry at hash: 69
[FUNCS][DEBUG]: Adding prototype for 'fclose', hash: 25
[FUNCS][DEBUG]: New entry at hash: 25
[FUNCS][DEBUG]: Adding prototype for 'clearerr', hash: 127
[FUNCS][DEBUG]: Added 'clearerr' at hash: 127
[FUNCS][DEBUG]: Adding prototype for 'feof', hash: 93
[FUNCS][DEBUG]: New entry at hash: 93
[FUNCS][DEBUG]: Adding prototype for 'ferror', hash: 41
[FUNCS][DEBUG]: New entry at hash: 41
[FUNCS][DEBUG]: Adding prototype for 'fflush', hash: 37
[FUNCS][DEBUG]: New entry at hash: 37
[FUNCS][DEBUG]: Adding prototype for 'fgetpos', hash: 61
[FUNCS][DEBUG]: New entry at hash: 61
[FUNCS][DEBUG]: Adding prototype for 'fopen', hash: 9
[FUNCS][DEBUG]: New entry at hash: 9
[FUNCS][DEBUG]: Adding prototype for 'fread', hash: 85
[FUNCS][DEBUG]: Added 'fread' at hash: 85
[FUNCS][DEBUG]: Adding prototype for 'freopen', hash: 124
[FUNCS][DEBUG]: New entry at hash: 124
[FUNCS][DEBUG]: Adding prototype for 'fseek', hash: 55
[FUNCS][DEBUG]: New entry at hash: 55
[FUNCS][DEBUG]: Adding prototype for 'fsetpos', hash: 49
[FUNCS][DEBUG]: New entry at hash: 49
[FUNCS][DEBUG]: Adding prototype for 'ftell', hash: 112
[FUNCS][DEBUG]: New entry at hash: 112
[FUNCS][DEBUG]: Adding prototype for 'fwrite', hash: 0
[FUNCS][DEBUG]: New entry at hash: 0
[FUNCS][DEBUG]: Adding prototype for 'remove', hash: 75
[FUNCS][DEBUG]: New entry at hash: 75
[FUNCS][DEBUG]: Adding prototype for 'rename', hash: 5
[FUNCS][DEBUG]: New entry at hash: 5
[FUNCS][DEBUG]: Adding prototype for 'rewind', hash: 2
[FUNCS][DEBUG]: New entry at hash: 2
[FUNCS][DEBUG]: Adding prototype for 'setbuf', hash: 24
[FUNCS][DEBUG]: New entry at hash: 24
[FUNCS][DEBUG]: Adding prototype for 'setvbuf', hash: 56
[FUNCS][DEBUG]: New entry at hash: 56
[FUNCS][DEBUG]: Adding prototype for 'tmpfile', hash: 44
[FUNCS][DEBUG]: New entry at hash: 44
[FUNCS][DEBUG]: Adding prototype for 'tmpnam', hash: 106
[FUNCS][DEBUG]: New entry at hash: 106
[FUNCS][DEBUG]: Adding prototype for 'fgetc', hash: 12
[FUNCS][DEBUG]: New entry at hash: 12
[FUNCS][DEBUG]: Adding prototype for 'fgets', hash: 28
[FUNCS][DEBUG]: New entry at hash: 28
[FUNCS][DEBUG]: Adding prototype for 'fputc', hash: 115
[FUNCS][DEBUG]: New entry at hash: 115
[FUNCS][DEBUG]: Adding prototype for 'fputs', hash: 3
[FUNCS][DEBUG]: Added 'fputs' at hash: 3
[FUNCS][DEBUG]: Adding prototype for 'getc', hash: 84
[FUNCS][DEBUG]: New entry at hash: 84
[FUNCS][DEBUG]: Adding prototype for 'getchar', hash: 69
[FUNCS][DEBUG]: Added 'getchar' at hash: 69
[FUNCS][DEBUG]: Adding prototype for 'gets', hash: 100
[FUNCS][DEBUG]: New entry at hash: 100
[FUNCS][DEBUG]: Adding prototype for 'putc', hash: 59
[FUNCS][DEBUG]: New entry at hash: 59
[FUNCS][DEBUG]: Adding prototype for 'putchar', hash: 126
[FUNCS][DEBUG]: New entry at hash: 126
[FUNCS][DEBUG]: Adding prototype for 'puts', hash: 75
[FUNCS][DEBUG]: Added 'puts' at hash: 75
[FUNCS][DEBUG]: Adding prototype for 'ungetc', hash: 45
[FUNCS][DEBUG]: New entry at hash: 45
[FUNCS][DEBUG]: Adding prototype for 'perror', hash: 95
[FUNCS][DEBUG]: New entry at hash: 95
[FUNCS][DEBUG]: Adding prototype for 'atoi', hash: 84
[FUNCS][DEBUG]: Added 'atoi' at hash: 84
[FUNCS][DEBUG]: Adding prototype for 'atol', hash: 87
[FUNCS][DEBUG]: New entry at hash: 87
[FUNCS][DEBUG]: Adding prototype for 'strtol', hash: 71
[FUNCS][DEBUG]: New entry at hash: 71
[FUNCS][DEBUG]: Adding prototype for 'strtoul', hash: 28
[FUNCS][DEBUG]: Added 'strtoul' at hash: 28
[FUNCS][DEBUG]: Adding prototype for 'calloc', hash: 121
[FUNCS][DEBUG]: New entry at hash: 121
[FUNCS][DEBUG]: Adding prototype for 'free', hash: 115
[FUNCS][DEBUG]: Added 'free' at hash: 115
[FUNCS][DEBUG]: Adding prototype for 'malloc', hash: 47
[FUNCS][DEBUG]: New entry at hash: 47
[FUNCS][DEBUG]: Adding prototype for 'realloc', hash: 123
[FUNCS][DEBUG]: New entry at hash: 123
[FUNCS][DEBUG]: Adding prototype for 'abort', hash: 9
[FUNCS][DEBUG]: Added 'abort' at hash: 9
[FUNCS][DEBUG]: Adding prototype for 'atexit', hash: 24
[FUNCS][DEBUG]: Added 'atexit' at hash: 24
[FUNCS][DEBUG]: Adding prototype for 'exit', hash: 37
[FUNCS][DEBUG]: Added 'exit' at hash: 37
[FUNCS][DEBUG]: Adding prototype for 'getenv', hash: 30
[FUNCS][DEBUG]: New entry at hash: 30
[FUNCS][DEBUG]: Adding prototype for 'system', hash: 118
[FUNCS][DEBUG]: New entry at hash: 118
[FUNCS][DEBUG]: Adding prototype for 'bsearch', hash: 35
[FUNCS][DEBUG]: New entry at hash: 35
[FUNCS][DEBUG]: Adding prototype for 'qsort', hash: 104
[FUNCS][DEBUG]: New entry at hash: 104
[FUNCS][DEBUG]: Adding prototype for 'abs', hash: 11
[FUNCS][DEBUG]: New entry at hash: 11
[FUNCS][DEBUG]: Adding prototype for 'div', hash: 42
[FUNCS][DEBUG]: Added 'div' at hash: 42
[FUNCS][DEBUG]: Adding prototype for 'labs', hash: 13
[FUNCS][DEBUG]: Added 'labs' at hash: 13
[FUNCS][DEBUG]: Adding prototype for 'ldiv', hash: 44
[FUNCS][DEBUG]: Added 'ldiv' at hash: 44
[FUNCS][DEBUG]: Adding prototype for 'rand', hash: 44
[FUNCS][DEBUG]: Passing 'tmpfile' at hash: 44
[FUNCS][DEBUG]: Added 'rand' at hash: 44
[FUNCS][DEBUG]: Adding prototype for 'srand', hash: 113
[FUNCS][DEBUG]: New entry at hash: 113
[FUNCS][DEBUG]: Adding prototype for 'mblen', hash: 57
[FUNCS][DEBUG]: New entry at hash: 57
[FUNCS][DEBUG]: Adding prototype for 'mbstowcs', hash: 21
[FUNCS][DEBUG]: Added 'mbstowcs' at hash: 21
[FUNCS][DEBUG]: Adding prototype for 'mbtowc', hash: 99
[FUNCS][DEBUG]: New entry at hash: 99
[FUNCS][DEBUG]: Adding prototype for 'wcstombs', hash: 99
[FUNCS][DEBUG]: Added 'wcstombs' at hash: 99
[FUNCS][DEBUG]: Adding prototype for 'wctomb', hash: 99
[FUNCS][DEBUG]: Passing 'mbtowc' at hash: 99
[FUNCS][DEBUG]: Added 'wctomb' at hash: 99
[FUNCS][DEBUG]: Adding prototype for 'writev', hash: 62
[FUNCS][DEBUG]: New entry at hash: 62
[FUNCS][DEBUG]: Adding prototype for 'readv', hash: 121
[FUNCS][DEBUG]: Added 'readv' at hash: 121
[FUNCS][DEBUG]: Adding prototype for 'access', hash: 43
[FUNCS][DEBUG]: New entry at hash: 43
[FUNCS][DEBUG]: Adding prototype for 'alarm', hash: 42
[FUNCS][DEBUG]: Passing 'isalnum' at hash: 42
[FUNCS][DEBUG]: Added 'alarm' at hash: 42
[FUNCS][DEBUG]: Adding prototype for 'brk', hash: 52
[FUNCS][DEBUG]: New entry at hash: 52
[FUNCS][DEBUG]: Adding prototype for 'chdir', hash: 97
[FUNCS][DEBUG]: New entry at hash: 97
[FUNCS][DEBUG]: Adding prototype for 'chroot', hash: 14
[FUNCS][DEBUG]: New entry at hash: 14
[FUNCS][DEBUG]: Adding prototype for 'chown', hash: 90
[FUNCS][DEBUG]: New entry at hash: 90
[FUNCS][DEBUG]: Adding prototype for 'close', hash: 81
[FUNCS][DEBUG]: Added 'close' at hash: 81
[FUNCS][DEBUG]: Adding prototype for 'confstr', hash: 38
[FUNCS][DEBUG]: New entry at hash: 38
[FUNCS][DEBUG]: Adding prototype for 'crypt', hash: 71
[FUNCS][DEBUG]: Added 'crypt' at hash: 71
[FUNCS][DEBUG]: Adding prototype for 'ctermid', hash: 67
[FUNCS][DEBUG]: New entry at hash: 67
[FUNCS][DEBUG]: Adding prototype for 'cuserid', hash: 98
[FUNCS][DEBUG]: New entry at hash: 98
[FUNCS][DEBUG]: Adding prototype for 'dup', hash: 24
[FUNCS][DEBUG]: Passing 'setbuf' at hash: 24
[FUNCS][DEBUG]: Added 'dup' at hash: 24
[FUNCS][DEBUG]: Adding prototype for 'dup2', hash: 26
[FUNCS][DEBUG]: New entry at hash: 26
[FUNCS][DEBUG]: Adding prototype for 'encrypt', hash: 126
[FUNCS][DEBUG]: Added 'encrypt' at hash: 126
[FUNCS][DEBUG]: Adding prototype for 'execv', hash: 94
[FUNCS][DEBUG]: New entry at hash: 94
[FUNCS][DEBUG]: Adding prototype for 'execve', hash: 71
[FUNCS][DEBUG]: Passing 'strtol' at hash: 71
[FUNCS][DEBUG]: Added 'execve' at hash: 71
[FUNCS][DEBUG]: Adding prototype for 'execvp', hash: 82
[FUNCS][DEBUG]: New entry at hash: 82
[FUNCS][DEBUG]: Adding prototype for '_exit', hash: 86
[FUNCS][DEBUG]: New entry at hash: 86
[FUNCS][DEBUG]: Adding prototype for 'fchown', hash: 34
[FUNCS][DEBUG]: New entry at hash: 34
[FUNCS][DEBUG]: Adding prototype for 'fchdir', hash: 41
[FUNCS][DEBUG]: Added 'fchdir' at hash: 41
[FUNCS][DEBUG]: Adding prototype for 'fork', hash: 73
[FUNCS][DEBUG]: New entry at hash: 73
[FUNCS][DEBUG]: Adding prototype for 'fpathconf', hash: 8
[FUNCS][DEBUG]: New entry at hash: 8
[FUNCS][DEBUG]: Adding prototype for 'fsync', hash: 90
[FUNCS][DEBUG]: Added 'fsync' at hash: 90
[FUNCS][DEBUG]: Adding prototype for 'ftruncate', hash: 37
[FUNCS][DEBUG]: Passing 'fflush' at hash: 37
[FUNCS][DEBUG]: Added 'ftruncate' at hash: 37
[FUNCS][DEBUG]: Adding prototype for 'getcwd', hash: 33
[FUNCS][DEBUG]: New entry at hash: 33
[FUNCS][DEBUG]: Adding prototype for 'getdtablesize', hash: 26
[FUNCS][DEBUG]: Added 'getdtablesize' at hash: 26
[FUNCS][DEBUG]: Adding prototype for 'getegid', hash: 44
[FUNCS][DEBUG]: Passing 'tmpfile' at hash: 44
[FUNCS][DEBUG]: Passing 'ldiv' at hash: 44
[FUNCS][DEBUG]: Added 'getegid' at hash: 44
[FUNCS][DEBUG]: Adding prototype for 'geteuid', hash: 58
[FUNCS][DEBUG]: New entry at hash: 58
[FUNCS][DEBUG]: Adding prototype for 'getgid', hash: 115
[FUNCS][DEBUG]: Passing 'fputc' at hash: 115
[FUNCS][DEBUG]: Added 'getgid' at hash: 115
[FUNCS][DEBUG]: Adding prototype for 'getgroups', hash: 3
[FUNCS][DEBUG]: Passing 'isblank' at hash: 3
[FUNCS][DEBUG]: Added 'getgroups' at hash: 3
[FUNCS][DEBUG]: Adding prototype for 'gethostid', hash: 114
[FUNCS][DEBUG]: New entry at hash: 114
[FUNCS][DEBUG]: Adding prototype for 'getlogin', hash: 90
[FUNCS][DEBUG]: Passing 'chown' at hash: 90
[FUNCS][DEBUG]: Added 'getlogin' at hash: 90
[FUNCS][DEBUG]: Adding prototype for 'getlogin_r', hash: 77
[FUNCS][DEBUG]: New entry at hash: 77
[FUNCS][DEBUG]: Adding prototype for 'getopt', hash: 100
[FUNCS][DEBUG]: Added 'getopt' at hash: 100
[FUNCS][DEBUG]: Adding prototype for 'getpagesize', hash: 127
[FUNCS][DEBUG]: Passing 'tolower' at hash: 127
[FUNCS][DEBUG]: Added 'getpagesize' at hash: 127
[FUNCS][DEBUG]: Adding prototype for 'getpass', hash: 0
[FUNCS][DEBUG]: Added 'getpass' at hash: 0
[FUNCS][DEBUG]: Adding prototype for 'getpgid', hash: 65
[FUNCS][DEBUG]: New entry at hash: 65
[FUNCS][DEBUG]: Adding prototype for 'getpgrp', hash: 100
[FUNCS][DEBUG]: Passing 'gets' at hash: 100
[FUNCS][DEBUG]: Added 'getpgrp' at hash: 100
[FUNCS][DEBUG]: Adding prototype for 'getpid', hash: 60
[FUNCS][DEBUG]: New entry at hash: 60
[FUNCS][DEBUG]: Adding prototype for 'getppid', hash: 10
[FUNCS][DEBUG]: New entry at hash: 10
[FUNCS][DEBUG]: Adding prototype for 'getsid', hash: 127
[FUNCS][DEBUG]: Passing 'tolower' at hash: 127
[FUNCS][DEBUG]: Passing 'clearerr' at hash: 127
[FUNCS][DEBUG]: Added 'getsid' at hash: 127
[FUNCS][DEBUG]: Adding prototype for 'getuid', hash: 1
[FUNCS][DEBUG]: New entry at hash: 1
[FUNCS][DEBUG]: Adding prototype for 'getwd', hash: 124
[FUNCS][DEBUG]: Added 'getwd' at hash: 124
[FUNCS][DEBUG]: Adding prototype for 'isatty', hash: 105
[FUNCS][DEBUG]: Added 'isatty' at hash: 105
[FUNCS][DEBUG]: Adding prototype for 'lchown', hash: 92
[FUNCS][DEBUG]: Passing 'isdigit' at hash: 92
[FUNCS][DEBUG]: Added 'lchown' at hash: 92
[FUNCS][DEBUG]: Adding prototype for 'link', hash: 1
[FUNCS][DEBUG]: Added 'link' at hash: 1
[FUNCS][DEBUG]: Adding prototype for 'lockf', hash: 116
[FUNCS][DEBUG]: New entry at hash: 116
[FUNCS][DEBUG]: Adding prototype for 'lseek', hash: 61
[FUNCS][DEBUG]: Added 'lseek' at hash: 61
[FUNCS][DEBUG]: Adding prototype for 'nice', hash: 100
[FUNCS][DEBUG]: Passing 'gets' at hash: 100
[FUNCS][DEBUG]: Passing 'getopt' at hash: 100
[FUNCS][DEBUG]: Added 'nice' at hash: 100
[FUNCS][DEBUG]: Adding prototype for 'pathconf', hash: 80
[FUNCS][DEBUG]: New entry at hash: 80
[FUNCS][DEBUG]: Adding prototype for 'pause', hash: 79
[FUNCS][DEBUG]: New entry at hash: 79
[FUNCS][DEBUG]: Adding prototype for 'pipe', hash: 53
[FUNCS][DEBUG]: Added 'pipe' at hash: 53
[FUNCS][DEBUG]: Adding prototype for 'pread', hash: 95
[FUNCS][DEBUG]: Added 'pread' at hash: 95
[FUNCS][DEBUG]: Adding prototype for 'pthread_atfork', hash: 33
[FUNCS][DEBUG]: Added 'pthread_atfork' at hash: 33
[FUNCS][DEBUG]: Adding prototype for 'pwrite', hash: 54
[FUNCS][DEBUG]: New entry at hash: 54
[FUNCS][DEBUG]: Adding prototype for 'read', hash: 29
[FUNCS][DEBUG]: New entry at hash: 29
[FUNCS][DEBUG]: Adding prototype for 'readlink', hash: 23
[FUNCS][DEBUG]: New entry at hash: 23
[FUNCS][DEBUG]: Adding prototype for 'rmdir', hash: 75
[FUNCS][DEBUG]: Passing 'remove' at hash: 75
[FUNCS][DEBUG]: Added 'rmdir' at hash: 75
[FUNCS][DEBUG]: Adding prototype for 'sbrk', hash: 79
[FUNCS][DEBUG]: Added 'sbrk' at hash: 79
[FUNCS][DEBUG]: Adding prototype for 'setgid', hash: 103
[FUNCS][DEBUG]: New entry at hash: 103
[FUNCS][DEBUG]: Adding prototype for 'setpgid', hash: 77
[FUNCS][DEBUG]: Added 'setpgid' at hash: 77
[FUNCS][DEBUG]: Adding prototype for 'setpgrp', hash: 112
[FUNCS][DEBUG]: Added 'setpgrp' at hash: 112
[FUNCS][DEBUG]: Adding prototype for 'setregid', hash: 20
[FUNCS][DEBUG]: New entry at hash: 20
[FUNCS][DEBUG]: Adding prototype for 'setreuid', hash: 34
[FUNCS][DEBUG]: Added 'setreuid' at hash: 34
[FUNCS][DEBUG]: Adding prototype for 'setsid', hash: 115
[FUNCS][DEBUG]: Passing 'fputc' at hash: 115
[FUNCS][DEBUG]: Passing 'free' at hash: 115
[FUNCS][DEBUG]: Added 'setsid' at hash: 115
[FUNCS][DEBUG]: Adding prototype for 'setuid', hash: 117
[FUNCS][DEBUG]: New entry at hash: 117
[FUNCS][DEBUG]: Adding prototype for 'sleep', hash: 48
[FUNCS][DEBUG]: Added 'sleep' at hash: 48
[FUNCS][DEBUG]: Adding prototype for 'swab', hash: 12
[FUNCS][DEBUG]: Added 'swab' at hash: 12
[FUNCS][DEBUG]: Adding prototype for 'symlink', hash: 90
[FUNCS][DEBUG]: Passing 'chown' at hash: 90
[FUNCS][DEBUG]: Passing 'fsync' at hash: 90
[FUNCS][DEBUG]: Added 'symlink' at hash: 90
[FUNCS][DEBUG]: Adding prototype for 'sync', hash: 34
[FUNCS][DEBUG]: Passing 'fchown' at hash: 34
[FUNCS][DEBUG]: Added 'sync' at hash: 34
[FUNCS][DEBUG]: Adding prototype for 'sysconf', hash: 10
[FUNCS][DEBUG]: Added 'sysconf' at hash: 10
[FUNCS][DEBUG]: Adding prototype for 'tcgetpgrp', hash: 85
[FUNCS][DEBUG]: Passing 'localeconv' at hash: 85
[FUNCS][DEBUG]: Added 'tcgetpgrp' at hash: 85
[FUNCS][DEBUG]: Adding prototype for 'truncate', hash: 109
[FUNCS][DEBUG]: New entry at hash: 109
[FUNCS][DEBUG]: Adding prototype for 'ttyname', hash: 29
[FUNCS][DEBUG]: Added 'ttyname' at hash: 29
[FUNCS][DEBUG]: Adding prototype for 'ttyname_r', hash: 80
[FUNCS][DEBUG]: Added 'ttyname_r' at hash: 80
[FUNCS][DEBUG]: Adding prototype for 'ualarm', hash: 67
[FUNCS][DEBUG]: Added 'ualarm' at hash: 67
[FUNCS][DEBUG]: Adding prototype for 'unlink', hash: 90
[FUNCS][DEBUG]: Passing 'chown' at hash: 90
[FUNCS][DEBUG]: Passing 'fsync' at hash: 90
[FUNCS][DEBUG]: Passing 'getlogin' at hash: 90
[FUNCS][DEBUG]: Added 'unlink' at hash: 90
[FUNCS][DEBUG]: Adding prototype for 'usleep', hash: 73
[FUNCS][DEBUG]: Added 'usleep' at hash: 73
[FUNCS][DEBUG]: Adding prototype for 'vfork', hash: 17
[FUNCS][DEBUG]: New entry at hash: 17
[FUNCS][DEBUG]: Adding prototype for 'write', hash: 56
[FUNCS][DEBUG]: Added 'write' at hash: 56
[TYPES][DEBUG]: Adding data type 'int', hash: 8
[TYPES][DEBUG]: New entry at hash: 8
[TYPES][DEBUG]: Adding data type 'unsigned int', hash: 11
[TYPES][DEBUG]: New entry at hash: 11
[TYPES][DEBUG]: Adding data type 'int16_t', hash: 2
[TYPES][DEBUG]: New entry at hash: 2
[TYPES][DEBUG]: Adding data type 'long int', hash: 2
[TYPES][DEBUG]: Added 'long int' at hash: 2
[TYPES][DEBUG]: Adding data type 'unsigned long int', hash: 15
[TYPES][DEBUG]: New entry at hash: 15
[TYPES][DEBUG]: Adding data type 'sz', hash: 14
[TYPES][DEBUG]: New entry at hash: 14
[TYPES][DEBUG]: Adding data type 'size_t', hash: 13
[TYPES][DEBUG]: New entry at hash: 13
[TYPES][DEBUG]: Adding data type 'char', hash: 13
[TYPES][DEBUG]: Added 'char' at hash: 13
[TYPES][DEBUG]: Adding data type 'ptr', hash: 7
[TYPES][DEBUG]: New entry at hash: 7
[TYPES][DEBUG]: Adding data type 'intptr_t', hash: 11
[TYPES][DEBUG]: Added 'intptr_t' at hash: 11
[TYPES][DEBUG]: Adding data type 'iovec', hash: 7
[TYPES][DEBUG]: Added 'iovec' at hash: 7
[TYPES][DEBUG]: Adding data type 'useconds_t', hash: 6
[TYPES][DEBUG]: New entry at hash: 6
[TYPES][DEBUG]: Adding data type 'gid_t', hash: 0
[TYPES][DEBUG]: New entry at hash: 0
[TYPES][DEBUG]: Adding data type 'pid_t', hash: 9
[TYPES][DEBUG]: New entry at hash: 9
[TYPES][DEBUG]: Adding data type 'uid_t', hash: 14
[TYPES][DEBUG]: Added 'uid_t' at hash: 14
[TYPES][DEBUG]: Adding data type 'off_t', hash: 13
[TYPES][DEBUG]: Passing 'size_t' at hash: 13
[TYPES][DEBUG]: Added 'off_t' at hash: 13
[ACT][DEBUG]: Adding action 'log_params', hash: 8
[ACT][DEBUG]: New entry at hash: 8
[ACT][DEBUG]: Adding action 'call_real', hash: 24
[ACT][DEBUG]: New entry at hash: 24
[ACT][DEBUG]: Adding action 'modify_in_param_str', hash: 3
[ACT][DEBUG]: New entry at hash: 3
[ACT][DEBUG]: Adding action 'modify_in_param_int', hash: 1
[ACT][DEBUG]: New entry at hash: 1
[ACT][DEBUG]: Adding action 'modify_in_param_arr', hash: 19
[ACT][DEBUG]: New entry at hash: 19
[MAIN][INFO]: retrace init success
[FUNCS][DEBUG]: Seraching for prototype for 'getenv', hash: 30
[FUNCS][DEBUG]: Found 'getenv' at hash: 30
[ACT][DEBUG]: Seraching for action for 'log_params', hash: 8
[ACT][DEBUG]: Found 'log_params' at hash: 8
[ENGINE][DEBUG]: Running action log_params, for getenv:(nil), tpid 0x7f9474379700...
[TYPES][DEBUG]: Seraching for datatype for 'ptr', hash: 7
[TYPES][DEBUG]: Found 'ptr' at hash: 7
[TYPES][DEBUG]: Seraching for datatype for 'sz', hash: 14
[TYPES][DEBUG]: Found 'sz' at hash: 14
[ACT][INFO]: {
    "name": "0x7ffcc2fb9186",
    "*name": [
        "LD_PRELOAD"
    ]
}
[ACT][DEBUG]: Seraching for action for 'call_real', hash: 24
[ACT][DEBUG]: Found 'call_real' at hash: 24
[ENGINE][DEBUG]: Running action call_real, for getenv:(nil), tpid 0x7f9474379700...
[ACT][DEBUG]: calling real at 0x7f9473b3e770 for getenv...
[ACT][DEBUG]: real returned val=0x7ffcc2fb92ac
[FUNCS][DEBUG]: Seraching for prototype for 'printf', hash: 32
[FUNCS][DEBUG]: Not found 'printf'
'LD_PRELOAD' = '/home/dev/work/ribose/retrace/src/retrace_v2/examples/getenv/../../retrace_v2.so

Is that expected?

ghost commented 6 years ago

Yes it is. First, you can see a warning that config json is not set - use RETRACE_JSON_CONFIG environment var to point to the json config (you will find examples of such jsons accompanying each example). I am sorry regarding the lack of docs - I am still deep in development stage and didn’t have time to attend to it properly. The configuration functionality is implemented in conf.c

Secondly, by default the log level is set to maximum for each of modules, you can modify the it in logger.c. I recommend to disable the debug level. Btw, an ability to configure the log levels from the json will be very welcomed for merging.

Thirdly, varargs funcs such as printf are not yet supported by the framework, I am currently working on it. (That’s why you see “printf is not prototyped” message)

BR

On Wed, 4 Jul 2018 at 11:14 Jin notifications@github.com wrote:

@ikolomi https://github.com/ikolomi I did execute the following commands to test retrace_v2

cd retrace/src/retrace_v2 make cd examples/getenv make LD_PRELOAD=$(pwd)/../../retrace_v2.so ./getenv_exmpl

Then it shows the following result:

dev@dev-virtual-machine:~/work/ribose/retrace/src/retrace_v2/examples/getenv$ ./getenv_exmpl LD_PRELOAD [CONF][WARN]: config file not set, using the default conf [FUNCS][DEBUG]: sizeof(struct FuncPrototype)=2412 [FUNCS][DEBUG]: Adding prototype for 'setlocale', hash: 21 [FUNCS][DEBUG]: New entry at hash: 21 [FUNCS][DEBUG]: Adding prototype for 'localeconv', hash: 85 [FUNCS][DEBUG]: New entry at hash: 85 [FUNCS][DEBUG]: Adding prototype for 'isalnum', hash: 42 [FUNCS][DEBUG]: New entry at hash: 42 [FUNCS][DEBUG]: Adding prototype for 'isalpha', hash: 13 [FUNCS][DEBUG]: New entry at hash: 13 [FUNCS][DEBUG]: Adding prototype for 'isblank', hash: 3 [FUNCS][DEBUG]: New entry at hash: 3 [FUNCS][DEBUG]: Adding prototype for 'iscntrl', hash: 18 [FUNCS][DEBUG]: New entry at hash: 18 [FUNCS][DEBUG]: Adding prototype for 'isdigit', hash: 92 [FUNCS][DEBUG]: New entry at hash: 92 [FUNCS][DEBUG]: Adding prototype for 'isgraph', hash: 125 [FUNCS][DEBUG]: New entry at hash: 125 [FUNCS][DEBUG]: Adding prototype for 'islower', hash: 48 [FUNCS][DEBUG]: New entry at hash: 48 [FUNCS][DEBUG]: Adding prototype for 'isprint', hash: 92 [FUNCS][DEBUG]: Added 'isprint' at hash: 92 [FUNCS][DEBUG]: Adding prototype for 'ispunct', hash: 105 [FUNCS][DEBUG]: New entry at hash: 105 [FUNCS][DEBUG]: Adding prototype for 'isspace', hash: 53 [FUNCS][DEBUG]: New entry at hash: 53 [FUNCS][DEBUG]: Adding prototype for 'isupper', hash: 81 [FUNCS][DEBUG]: New entry at hash: 81 [FUNCS][DEBUG]: Adding prototype for 'isxdigit', hash: 102 [FUNCS][DEBUG]: New entry at hash: 102 [FUNCS][DEBUG]: Adding prototype for 'toupper', hash: 32 [FUNCS][DEBUG]: New entry at hash: 32 [FUNCS][DEBUG]: Adding prototype for 'tolower', hash: 127 [FUNCS][DEBUG]: New entry at hash: 127 [FUNCS][DEBUG]: Adding prototype for 'signal', hash: 111 [FUNCS][DEBUG]: New entry at hash: 111 [FUNCS][DEBUG]: Adding prototype for 'raise', hash: 69 [FUNCS][DEBUG]: New entry at hash: 69 [FUNCS][DEBUG]: Adding prototype for 'fclose', hash: 25 [FUNCS][DEBUG]: New entry at hash: 25 [FUNCS][DEBUG]: Adding prototype for 'clearerr', hash: 127 [FUNCS][DEBUG]: Added 'clearerr' at hash: 127 [FUNCS][DEBUG]: Adding prototype for 'feof', hash: 93 [FUNCS][DEBUG]: New entry at hash: 93 [FUNCS][DEBUG]: Adding prototype for 'ferror', hash: 41 [FUNCS][DEBUG]: New entry at hash: 41 [FUNCS][DEBUG]: Adding prototype for 'fflush', hash: 37 [FUNCS][DEBUG]: New entry at hash: 37 [FUNCS][DEBUG]: Adding prototype for 'fgetpos', hash: 61 [FUNCS][DEBUG]: New entry at hash: 61 [FUNCS][DEBUG]: Adding prototype for 'fopen', hash: 9 [FUNCS][DEBUG]: New entry at hash: 9 [FUNCS][DEBUG]: Adding prototype for 'fread', hash: 85 [FUNCS][DEBUG]: Added 'fread' at hash: 85 [FUNCS][DEBUG]: Adding prototype for 'freopen', hash: 124 [FUNCS][DEBUG]: New entry at hash: 124 [FUNCS][DEBUG]: Adding prototype for 'fseek', hash: 55 [FUNCS][DEBUG]: New entry at hash: 55 [FUNCS][DEBUG]: Adding prototype for 'fsetpos', hash: 49 [FUNCS][DEBUG]: New entry at hash: 49 [FUNCS][DEBUG]: Adding prototype for 'ftell', hash: 112 [FUNCS][DEBUG]: New entry at hash: 112 [FUNCS][DEBUG]: Adding prototype for 'fwrite', hash: 0 [FUNCS][DEBUG]: New entry at hash: 0 [FUNCS][DEBUG]: Adding prototype for 'remove', hash: 75 [FUNCS][DEBUG]: New entry at hash: 75 [FUNCS][DEBUG]: Adding prototype for 'rename', hash: 5 [FUNCS][DEBUG]: New entry at hash: 5 [FUNCS][DEBUG]: Adding prototype for 'rewind', hash: 2 [FUNCS][DEBUG]: New entry at hash: 2 [FUNCS][DEBUG]: Adding prototype for 'setbuf', hash: 24 [FUNCS][DEBUG]: New entry at hash: 24 [FUNCS][DEBUG]: Adding prototype for 'setvbuf', hash: 56 [FUNCS][DEBUG]: New entry at hash: 56 [FUNCS][DEBUG]: Adding prototype for 'tmpfile', hash: 44 [FUNCS][DEBUG]: New entry at hash: 44 [FUNCS][DEBUG]: Adding prototype for 'tmpnam', hash: 106 [FUNCS][DEBUG]: New entry at hash: 106 [FUNCS][DEBUG]: Adding prototype for 'fgetc', hash: 12 [FUNCS][DEBUG]: New entry at hash: 12 [FUNCS][DEBUG]: Adding prototype for 'fgets', hash: 28 [FUNCS][DEBUG]: New entry at hash: 28 [FUNCS][DEBUG]: Adding prototype for 'fputc', hash: 115 [FUNCS][DEBUG]: New entry at hash: 115 [FUNCS][DEBUG]: Adding prototype for 'fputs', hash: 3 [FUNCS][DEBUG]: Added 'fputs' at hash: 3 [FUNCS][DEBUG]: Adding prototype for 'getc', hash: 84 [FUNCS][DEBUG]: New entry at hash: 84 [FUNCS][DEBUG]: Adding prototype for 'getchar', hash: 69 [FUNCS][DEBUG]: Added 'getchar' at hash: 69 [FUNCS][DEBUG]: Adding prototype for 'gets', hash: 100 [FUNCS][DEBUG]: New entry at hash: 100 [FUNCS][DEBUG]: Adding prototype for 'putc', hash: 59 [FUNCS][DEBUG]: New entry at hash: 59 [FUNCS][DEBUG]: Adding prototype for 'putchar', hash: 126 [FUNCS][DEBUG]: New entry at hash: 126 [FUNCS][DEBUG]: Adding prototype for 'puts', hash: 75 [FUNCS][DEBUG]: Added 'puts' at hash: 75 [FUNCS][DEBUG]: Adding prototype for 'ungetc', hash: 45 [FUNCS][DEBUG]: New entry at hash: 45 [FUNCS][DEBUG]: Adding prototype for 'perror', hash: 95 [FUNCS][DEBUG]: New entry at hash: 95 [FUNCS][DEBUG]: Adding prototype for 'atoi', hash: 84 [FUNCS][DEBUG]: Added 'atoi' at hash: 84 [FUNCS][DEBUG]: Adding prototype for 'atol', hash: 87 [FUNCS][DEBUG]: New entry at hash: 87 [FUNCS][DEBUG]: Adding prototype for 'strtol', hash: 71 [FUNCS][DEBUG]: New entry at hash: 71 [FUNCS][DEBUG]: Adding prototype for 'strtoul', hash: 28 [FUNCS][DEBUG]: Added 'strtoul' at hash: 28 [FUNCS][DEBUG]: Adding prototype for 'calloc', hash: 121 [FUNCS][DEBUG]: New entry at hash: 121 [FUNCS][DEBUG]: Adding prototype for 'free', hash: 115 [FUNCS][DEBUG]: Added 'free' at hash: 115 [FUNCS][DEBUG]: Adding prototype for 'malloc', hash: 47 [FUNCS][DEBUG]: New entry at hash: 47 [FUNCS][DEBUG]: Adding prototype for 'realloc', hash: 123 [FUNCS][DEBUG]: New entry at hash: 123 [FUNCS][DEBUG]: Adding prototype for 'abort', hash: 9 [FUNCS][DEBUG]: Added 'abort' at hash: 9 [FUNCS][DEBUG]: Adding prototype for 'atexit', hash: 24 [FUNCS][DEBUG]: Added 'atexit' at hash: 24 [FUNCS][DEBUG]: Adding prototype for 'exit', hash: 37 [FUNCS][DEBUG]: Added 'exit' at hash: 37 [FUNCS][DEBUG]: Adding prototype for 'getenv', hash: 30 [FUNCS][DEBUG]: New entry at hash: 30 [FUNCS][DEBUG]: Adding prototype for 'system', hash: 118 [FUNCS][DEBUG]: New entry at hash: 118 [FUNCS][DEBUG]: Adding prototype for 'bsearch', hash: 35 [FUNCS][DEBUG]: New entry at hash: 35 [FUNCS][DEBUG]: Adding prototype for 'qsort', hash: 104 [FUNCS][DEBUG]: New entry at hash: 104 [FUNCS][DEBUG]: Adding prototype for 'abs', hash: 11 [FUNCS][DEBUG]: New entry at hash: 11 [FUNCS][DEBUG]: Adding prototype for 'div', hash: 42 [FUNCS][DEBUG]: Added 'div' at hash: 42 [FUNCS][DEBUG]: Adding prototype for 'labs', hash: 13 [FUNCS][DEBUG]: Added 'labs' at hash: 13 [FUNCS][DEBUG]: Adding prototype for 'ldiv', hash: 44 [FUNCS][DEBUG]: Added 'ldiv' at hash: 44 [FUNCS][DEBUG]: Adding prototype for 'rand', hash: 44 [FUNCS][DEBUG]: Passing 'tmpfile' at hash: 44 [FUNCS][DEBUG]: Added 'rand' at hash: 44 [FUNCS][DEBUG]: Adding prototype for 'srand', hash: 113 [FUNCS][DEBUG]: New entry at hash: 113 [FUNCS][DEBUG]: Adding prototype for 'mblen', hash: 57 [FUNCS][DEBUG]: New entry at hash: 57 [FUNCS][DEBUG]: Adding prototype for 'mbstowcs', hash: 21 [FUNCS][DEBUG]: Added 'mbstowcs' at hash: 21 [FUNCS][DEBUG]: Adding prototype for 'mbtowc', hash: 99 [FUNCS][DEBUG]: New entry at hash: 99 [FUNCS][DEBUG]: Adding prototype for 'wcstombs', hash: 99 [FUNCS][DEBUG]: Added 'wcstombs' at hash: 99 [FUNCS][DEBUG]: Adding prototype for 'wctomb', hash: 99 [FUNCS][DEBUG]: Passing 'mbtowc' at hash: 99 [FUNCS][DEBUG]: Added 'wctomb' at hash: 99 [FUNCS][DEBUG]: Adding prototype for 'writev', hash: 62 [FUNCS][DEBUG]: New entry at hash: 62 [FUNCS][DEBUG]: Adding prototype for 'readv', hash: 121 [FUNCS][DEBUG]: Added 'readv' at hash: 121 [FUNCS][DEBUG]: Adding prototype for 'access', hash: 43 [FUNCS][DEBUG]: New entry at hash: 43 [FUNCS][DEBUG]: Adding prototype for 'alarm', hash: 42 [FUNCS][DEBUG]: Passing 'isalnum' at hash: 42 [FUNCS][DEBUG]: Added 'alarm' at hash: 42 [FUNCS][DEBUG]: Adding prototype for 'brk', hash: 52 [FUNCS][DEBUG]: New entry at hash: 52 [FUNCS][DEBUG]: Adding prototype for 'chdir', hash: 97 [FUNCS][DEBUG]: New entry at hash: 97 [FUNCS][DEBUG]: Adding prototype for 'chroot', hash: 14 [FUNCS][DEBUG]: New entry at hash: 14 [FUNCS][DEBUG]: Adding prototype for 'chown', hash: 90 [FUNCS][DEBUG]: New entry at hash: 90 [FUNCS][DEBUG]: Adding prototype for 'close', hash: 81 [FUNCS][DEBUG]: Added 'close' at hash: 81 [FUNCS][DEBUG]: Adding prototype for 'confstr', hash: 38 [FUNCS][DEBUG]: New entry at hash: 38 [FUNCS][DEBUG]: Adding prototype for 'crypt', hash: 71 [FUNCS][DEBUG]: Added 'crypt' at hash: 71 [FUNCS][DEBUG]: Adding prototype for 'ctermid', hash: 67 [FUNCS][DEBUG]: New entry at hash: 67 [FUNCS][DEBUG]: Adding prototype for 'cuserid', hash: 98 [FUNCS][DEBUG]: New entry at hash: 98 [FUNCS][DEBUG]: Adding prototype for 'dup', hash: 24 [FUNCS][DEBUG]: Passing 'setbuf' at hash: 24 [FUNCS][DEBUG]: Added 'dup' at hash: 24 [FUNCS][DEBUG]: Adding prototype for 'dup2', hash: 26 [FUNCS][DEBUG]: New entry at hash: 26 [FUNCS][DEBUG]: Adding prototype for 'encrypt', hash: 126 [FUNCS][DEBUG]: Added 'encrypt' at hash: 126 [FUNCS][DEBUG]: Adding prototype for 'execv', hash: 94 [FUNCS][DEBUG]: New entry at hash: 94 [FUNCS][DEBUG]: Adding prototype for 'execve', hash: 71 [FUNCS][DEBUG]: Passing 'strtol' at hash: 71 [FUNCS][DEBUG]: Added 'execve' at hash: 71 [FUNCS][DEBUG]: Adding prototype for 'execvp', hash: 82 [FUNCS][DEBUG]: New entry at hash: 82 [FUNCS][DEBUG]: Adding prototype for '_exit', hash: 86 [FUNCS][DEBUG]: New entry at hash: 86 [FUNCS][DEBUG]: Adding prototype for 'fchown', hash: 34 [FUNCS][DEBUG]: New entry at hash: 34 [FUNCS][DEBUG]: Adding prototype for 'fchdir', hash: 41 [FUNCS][DEBUG]: Added 'fchdir' at hash: 41 [FUNCS][DEBUG]: Adding prototype for 'fork', hash: 73 [FUNCS][DEBUG]: New entry at hash: 73 [FUNCS][DEBUG]: Adding prototype for 'fpathconf', hash: 8 [FUNCS][DEBUG]: New entry at hash: 8 [FUNCS][DEBUG]: Adding prototype for 'fsync', hash: 90 [FUNCS][DEBUG]: Added 'fsync' at hash: 90 [FUNCS][DEBUG]: Adding prototype for 'ftruncate', hash: 37 [FUNCS][DEBUG]: Passing 'fflush' at hash: 37 [FUNCS][DEBUG]: Added 'ftruncate' at hash: 37 [FUNCS][DEBUG]: Adding prototype for 'getcwd', hash: 33 [FUNCS][DEBUG]: New entry at hash: 33 [FUNCS][DEBUG]: Adding prototype for 'getdtablesize', hash: 26 [FUNCS][DEBUG]: Added 'getdtablesize' at hash: 26 [FUNCS][DEBUG]: Adding prototype for 'getegid', hash: 44 [FUNCS][DEBUG]: Passing 'tmpfile' at hash: 44 [FUNCS][DEBUG]: Passing 'ldiv' at hash: 44 [FUNCS][DEBUG]: Added 'getegid' at hash: 44 [FUNCS][DEBUG]: Adding prototype for 'geteuid', hash: 58 [FUNCS][DEBUG]: New entry at hash: 58 [FUNCS][DEBUG]: Adding prototype for 'getgid', hash: 115 [FUNCS][DEBUG]: Passing 'fputc' at hash: 115 [FUNCS][DEBUG]: Added 'getgid' at hash: 115 [FUNCS][DEBUG]: Adding prototype for 'getgroups', hash: 3 [FUNCS][DEBUG]: Passing 'isblank' at hash: 3 [FUNCS][DEBUG]: Added 'getgroups' at hash: 3 [FUNCS][DEBUG]: Adding prototype for 'gethostid', hash: 114 [FUNCS][DEBUG]: New entry at hash: 114 [FUNCS][DEBUG]: Adding prototype for 'getlogin', hash: 90 [FUNCS][DEBUG]: Passing 'chown' at hash: 90 [FUNCS][DEBUG]: Added 'getlogin' at hash: 90 [FUNCS][DEBUG]: Adding prototype for 'getlogin_r', hash: 77 [FUNCS][DEBUG]: New entry at hash: 77 [FUNCS][DEBUG]: Adding prototype for 'getopt', hash: 100 [FUNCS][DEBUG]: Added 'getopt' at hash: 100 [FUNCS][DEBUG]: Adding prototype for 'getpagesize', hash: 127 [FUNCS][DEBUG]: Passing 'tolower' at hash: 127 [FUNCS][DEBUG]: Added 'getpagesize' at hash: 127 [FUNCS][DEBUG]: Adding prototype for 'getpass', hash: 0 [FUNCS][DEBUG]: Added 'getpass' at hash: 0 [FUNCS][DEBUG]: Adding prototype for 'getpgid', hash: 65 [FUNCS][DEBUG]: New entry at hash: 65 [FUNCS][DEBUG]: Adding prototype for 'getpgrp', hash: 100 [FUNCS][DEBUG]: Passing 'gets' at hash: 100 [FUNCS][DEBUG]: Added 'getpgrp' at hash: 100 [FUNCS][DEBUG]: Adding prototype for 'getpid', hash: 60 [FUNCS][DEBUG]: New entry at hash: 60 [FUNCS][DEBUG]: Adding prototype for 'getppid', hash: 10 [FUNCS][DEBUG]: New entry at hash: 10 [FUNCS][DEBUG]: Adding prototype for 'getsid', hash: 127 [FUNCS][DEBUG]: Passing 'tolower' at hash: 127 [FUNCS][DEBUG]: Passing 'clearerr' at hash: 127 [FUNCS][DEBUG]: Added 'getsid' at hash: 127 [FUNCS][DEBUG]: Adding prototype for 'getuid', hash: 1 [FUNCS][DEBUG]: New entry at hash: 1 [FUNCS][DEBUG]: Adding prototype for 'getwd', hash: 124 [FUNCS][DEBUG]: Added 'getwd' at hash: 124 [FUNCS][DEBUG]: Adding prototype for 'isatty', hash: 105 [FUNCS][DEBUG]: Added 'isatty' at hash: 105 [FUNCS][DEBUG]: Adding prototype for 'lchown', hash: 92 [FUNCS][DEBUG]: Passing 'isdigit' at hash: 92 [FUNCS][DEBUG]: Added 'lchown' at hash: 92 [FUNCS][DEBUG]: Adding prototype for 'link', hash: 1 [FUNCS][DEBUG]: Added 'link' at hash: 1 [FUNCS][DEBUG]: Adding prototype for 'lockf', hash: 116 [FUNCS][DEBUG]: New entry at hash: 116 [FUNCS][DEBUG]: Adding prototype for 'lseek', hash: 61 [FUNCS][DEBUG]: Added 'lseek' at hash: 61 [FUNCS][DEBUG]: Adding prototype for 'nice', hash: 100 [FUNCS][DEBUG]: Passing 'gets' at hash: 100 [FUNCS][DEBUG]: Passing 'getopt' at hash: 100 [FUNCS][DEBUG]: Added 'nice' at hash: 100 [FUNCS][DEBUG]: Adding prototype for 'pathconf', hash: 80 [FUNCS][DEBUG]: New entry at hash: 80 [FUNCS][DEBUG]: Adding prototype for 'pause', hash: 79 [FUNCS][DEBUG]: New entry at hash: 79 [FUNCS][DEBUG]: Adding prototype for 'pipe', hash: 53 [FUNCS][DEBUG]: Added 'pipe' at hash: 53 [FUNCS][DEBUG]: Adding prototype for 'pread', hash: 95 [FUNCS][DEBUG]: Added 'pread' at hash: 95 [FUNCS][DEBUG]: Adding prototype for 'pthread_atfork', hash: 33 [FUNCS][DEBUG]: Added 'pthread_atfork' at hash: 33 [FUNCS][DEBUG]: Adding prototype for 'pwrite', hash: 54 [FUNCS][DEBUG]: New entry at hash: 54 [FUNCS][DEBUG]: Adding prototype for 'read', hash: 29 [FUNCS][DEBUG]: New entry at hash: 29 [FUNCS][DEBUG]: Adding prototype for 'readlink', hash: 23 [FUNCS][DEBUG]: New entry at hash: 23 [FUNCS][DEBUG]: Adding prototype for 'rmdir', hash: 75 [FUNCS][DEBUG]: Passing 'remove' at hash: 75 [FUNCS][DEBUG]: Added 'rmdir' at hash: 75 [FUNCS][DEBUG]: Adding prototype for 'sbrk', hash: 79 [FUNCS][DEBUG]: Added 'sbrk' at hash: 79 [FUNCS][DEBUG]: Adding prototype for 'setgid', hash: 103 [FUNCS][DEBUG]: New entry at hash: 103 [FUNCS][DEBUG]: Adding prototype for 'setpgid', hash: 77 [FUNCS][DEBUG]: Added 'setpgid' at hash: 77 [FUNCS][DEBUG]: Adding prototype for 'setpgrp', hash: 112 [FUNCS][DEBUG]: Added 'setpgrp' at hash: 112 [FUNCS][DEBUG]: Adding prototype for 'setregid', hash: 20 [FUNCS][DEBUG]: New entry at hash: 20 [FUNCS][DEBUG]: Adding prototype for 'setreuid', hash: 34 [FUNCS][DEBUG]: Added 'setreuid' at hash: 34 [FUNCS][DEBUG]: Adding prototype for 'setsid', hash: 115 [FUNCS][DEBUG]: Passing 'fputc' at hash: 115 [FUNCS][DEBUG]: Passing 'free' at hash: 115 [FUNCS][DEBUG]: Added 'setsid' at hash: 115 [FUNCS][DEBUG]: Adding prototype for 'setuid', hash: 117 [FUNCS][DEBUG]: New entry at hash: 117 [FUNCS][DEBUG]: Adding prototype for 'sleep', hash: 48 [FUNCS][DEBUG]: Added 'sleep' at hash: 48 [FUNCS][DEBUG]: Adding prototype for 'swab', hash: 12 [FUNCS][DEBUG]: Added 'swab' at hash: 12 [FUNCS][DEBUG]: Adding prototype for 'symlink', hash: 90 [FUNCS][DEBUG]: Passing 'chown' at hash: 90 [FUNCS][DEBUG]: Passing 'fsync' at hash: 90 [FUNCS][DEBUG]: Added 'symlink' at hash: 90 [FUNCS][DEBUG]: Adding prototype for 'sync', hash: 34 [FUNCS][DEBUG]: Passing 'fchown' at hash: 34 [FUNCS][DEBUG]: Added 'sync' at hash: 34 [FUNCS][DEBUG]: Adding prototype for 'sysconf', hash: 10 [FUNCS][DEBUG]: Added 'sysconf' at hash: 10 [FUNCS][DEBUG]: Adding prototype for 'tcgetpgrp', hash: 85 [FUNCS][DEBUG]: Passing 'localeconv' at hash: 85 [FUNCS][DEBUG]: Added 'tcgetpgrp' at hash: 85 [FUNCS][DEBUG]: Adding prototype for 'truncate', hash: 109 [FUNCS][DEBUG]: New entry at hash: 109 [FUNCS][DEBUG]: Adding prototype for 'ttyname', hash: 29 [FUNCS][DEBUG]: Added 'ttyname' at hash: 29 [FUNCS][DEBUG]: Adding prototype for 'ttyname_r', hash: 80 [FUNCS][DEBUG]: Added 'ttyname_r' at hash: 80 [FUNCS][DEBUG]: Adding prototype for 'ualarm', hash: 67 [FUNCS][DEBUG]: Added 'ualarm' at hash: 67 [FUNCS][DEBUG]: Adding prototype for 'unlink', hash: 90 [FUNCS][DEBUG]: Passing 'chown' at hash: 90 [FUNCS][DEBUG]: Passing 'fsync' at hash: 90 [FUNCS][DEBUG]: Passing 'getlogin' at hash: 90 [FUNCS][DEBUG]: Added 'unlink' at hash: 90 [FUNCS][DEBUG]: Adding prototype for 'usleep', hash: 73 [FUNCS][DEBUG]: Added 'usleep' at hash: 73 [FUNCS][DEBUG]: Adding prototype for 'vfork', hash: 17 [FUNCS][DEBUG]: New entry at hash: 17 [FUNCS][DEBUG]: Adding prototype for 'write', hash: 56 [FUNCS][DEBUG]: Added 'write' at hash: 56 [TYPES][DEBUG]: Adding data type 'int', hash: 8 [TYPES][DEBUG]: New entry at hash: 8 [TYPES][DEBUG]: Adding data type 'unsigned int', hash: 11 [TYPES][DEBUG]: New entry at hash: 11 [TYPES][DEBUG]: Adding data type 'int16_t', hash: 2 [TYPES][DEBUG]: New entry at hash: 2 [TYPES][DEBUG]: Adding data type 'long int', hash: 2 [TYPES][DEBUG]: Added 'long int' at hash: 2 [TYPES][DEBUG]: Adding data type 'unsigned long int', hash: 15 [TYPES][DEBUG]: New entry at hash: 15 [TYPES][DEBUG]: Adding data type 'sz', hash: 14 [TYPES][DEBUG]: New entry at hash: 14 [TYPES][DEBUG]: Adding data type 'size_t', hash: 13 [TYPES][DEBUG]: New entry at hash: 13 [TYPES][DEBUG]: Adding data type 'char', hash: 13 [TYPES][DEBUG]: Added 'char' at hash: 13 [TYPES][DEBUG]: Adding data type 'ptr', hash: 7 [TYPES][DEBUG]: New entry at hash: 7 [TYPES][DEBUG]: Adding data type 'intptr_t', hash: 11 [TYPES][DEBUG]: Added 'intptr_t' at hash: 11 [TYPES][DEBUG]: Adding data type 'iovec', hash: 7 [TYPES][DEBUG]: Added 'iovec' at hash: 7 [TYPES][DEBUG]: Adding data type 'useconds_t', hash: 6 [TYPES][DEBUG]: New entry at hash: 6 [TYPES][DEBUG]: Adding data type 'gid_t', hash: 0 [TYPES][DEBUG]: New entry at hash: 0 [TYPES][DEBUG]: Adding data type 'pid_t', hash: 9 [TYPES][DEBUG]: New entry at hash: 9 [TYPES][DEBUG]: Adding data type 'uid_t', hash: 14 [TYPES][DEBUG]: Added 'uid_t' at hash: 14 [TYPES][DEBUG]: Adding data type 'off_t', hash: 13 [TYPES][DEBUG]: Passing 'size_t' at hash: 13 [TYPES][DEBUG]: Added 'off_t' at hash: 13 [ACT][DEBUG]: Adding action 'log_params', hash: 8 [ACT][DEBUG]: New entry at hash: 8 [ACT][DEBUG]: Adding action 'call_real', hash: 24 [ACT][DEBUG]: New entry at hash: 24 [ACT][DEBUG]: Adding action 'modify_in_param_str', hash: 3 [ACT][DEBUG]: New entry at hash: 3 [ACT][DEBUG]: Adding action 'modify_in_param_int', hash: 1 [ACT][DEBUG]: New entry at hash: 1 [ACT][DEBUG]: Adding action 'modify_in_param_arr', hash: 19 [ACT][DEBUG]: New entry at hash: 19 [MAIN][INFO]: retrace init success [FUNCS][DEBUG]: Seraching for prototype for 'getenv', hash: 30 [FUNCS][DEBUG]: Found 'getenv' at hash: 30 [ACT][DEBUG]: Seraching for action for 'log_params', hash: 8 [ACT][DEBUG]: Found 'log_params' at hash: 8 [ENGINE][DEBUG]: Running action log_params, for getenv:(nil), tpid 0x7f9474379700... [TYPES][DEBUG]: Seraching for datatype for 'ptr', hash: 7 [TYPES][DEBUG]: Found 'ptr' at hash: 7 [TYPES][DEBUG]: Seraching for datatype for 'sz', hash: 14 [TYPES][DEBUG]: Found 'sz' at hash: 14

"name": "0x7ffcc2fb9186",
"*name": [
    "LD_PRELOAD"
]

} [ACT][DEBUG]: Seraching for action for 'call_real', hash: 24 [ACT][DEBUG]: Found 'call_real' at hash: 24 [ENGINE][DEBUG]: Running action call_real, for getenv:(nil), tpid 0x7f9474379700... [ACT][DEBUG]: calling real at 0x7f9473b3e770 for getenv... [ACT][DEBUG]: real returned val=0x7ffcc2fb92ac [FUNCS][DEBUG]: Seraching for prototype for 'printf', hash: 32 [FUNCS][DEBUG]: Not found 'printf' 'LD_PRELOAD' = '/home/dev/work/ribose/retrace/src/retrace_v2/examples/getenv/../../retrace_v2.so

Is that expected?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/riboseinc/retrace/issues/353#issuecomment-402417666, or mute the thread https://github.com/notifications/unsubscribe-auth/AfMHW0MgjGol47HzDsObC5lY5HcYAyi4ks5uDIdigaJpZM4VCFWm .

jjr840430 commented 6 years ago

@ikolomi Thanks for your help!

ghost commented 6 years ago

My pleasure, let me know if you need anything

Br

On Wed, 4 Jul 2018 at 11:34 Jin notifications@github.com wrote:

@ikolomi https://github.com/ikolomi Thanks for your help!

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/riboseinc/retrace/issues/353#issuecomment-402423506, or mute the thread https://github.com/notifications/unsubscribe-auth/AfMHW2sMdTmxl8loLFXrROsJsiBFyHgkks5uDIwugaJpZM4VCFWm .