Variables on the stack are not identified by bp/sp+<offset> anymore, but by their address from the bottom of the stack frame (RzStackAddr), independent of how they are accessed. So now there are only two kinds of variables: stack and register. This required some major refactoring and other changes: * RzAnalysisVar.isarg was removed. Whether a variable is an argument is now specified implicitly by its storage location. * Varsub of struct fields had to be rewritten so fields can be queried by arbitrary stack addresses using the recently introduced sp tracking, as the old approach to fill a list with all fields would not work anymore. * analysis.vars.stackname was removed, new behavior is more similar to this being true before. * Variables will not be created at stack+0 now, because the return address is there. Before, vars were only created sometimes in such cases. * Variables created from bp offsets in x86 are not deleted anymore if the function's bp_frame is false (see removed rz_analysis_function_delete_vars_by_kind(fcn, RZ_ANALYSIS_VAR_KIND_BPV); calls). This may lead to some false-positive detected variables. Whether this really is a practical issue is yet to be seen. At least there are no meaningful tests that are broken by this. * Applying variables from dwarf needed some fixes for determining the correct stack locations of variables in order to write meaningful tests. The handling is still not entirely correct for all possibilities of dwarf info, but at least the changed/added test cases are right and serve as a reference for future changes. * Projects version 11 is introduced. * afvb commands have been removed, afvs now handles all stack vars.
179 lines
7 KiB
Text
179 lines
7 KiB
Text
NAME=afl
|
|
FILE=bins/elf/ls
|
|
CMDS=<<EOF
|
|
aaa
|
|
afl
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x00005ae0 1 46 entry0
|
|
0x00015c80 7 161 -> 158 sym._obstack_begin
|
|
0x00015ca0 1 21 sym._obstack_begin_1
|
|
0x00015dc0 8 55 -> 45 sym._obstack_allocated_p
|
|
0x00015e70 5 41 -> 36 sym._obstack_memory_used
|
|
0x00015e00 9 73225 -> 102 sym._obstack_free
|
|
0x00015bd0 3 21 fcn.00015bd0
|
|
0x00015cc0 8 256 -> 250 sym._obstack_newchunk
|
|
0x00004070 300 6757 -> 6739 main
|
|
0x00005bd0 5 153 -> 60 entry.init0
|
|
0x00005b80 5 65 -> 55 entry.fini0
|
|
0x00005b10 4 41 -> 34 fcn.00005b10
|
|
0x00012580 8 162 fcn.00012580
|
|
0x00016770 1 19 fcn.00016770
|
|
0x00013c50 1 17 fcn.00013c50
|
|
0x0000c660 14 294 -> 271 fcn.0000c660
|
|
0x00015100 95 1137 -> 1129 fcn.00015100
|
|
0x00013c30 1 17 fcn.00013c30
|
|
0x0000c940 3 112 -> 109 fcn.0000c940
|
|
0x0000c790 4 124 -> 117 fcn.0000c790
|
|
0x00014370 1 19 fcn.00014370
|
|
0x00013f90 5 65498 -> 148 fcn.00013f90
|
|
0x00013a40 14 64434 -> 438 fcn.00013a40
|
|
0x0000c810 50 94160 -> 612 fcn.0000c810
|
|
0x00014c00 7 82 fcn.00014c00
|
|
0x0000fcc0 28 485 -> 456 fcn.0000fcc0
|
|
0x00005f20 8 128 -> 114 fcn.00005f20
|
|
0x00014390 1 24 fcn.00014390
|
|
0x00014ea0 12 257 -> 251 fcn.00014ea0
|
|
0x00014a90 11 222 -> 214 fcn.00014a90
|
|
0x00013bf0 1 56 fcn.00013bf0
|
|
0x00013c70 1 53 fcn.00013c70
|
|
0x0000dd60 4 96 -> 91 fcn.0000dd60
|
|
0x0000e660 20 426 -> 398 fcn.0000e660
|
|
0x00015f70 6 152 -> 142 fcn.00015f70
|
|
0x00009bd0 4 204 fcn.00009bd0
|
|
0x00009ca0 188 3632 -> 3494 fcn.00009ca0
|
|
0x0000aad0 76 1784 -> 1721 fcn.0000aad0
|
|
0x0000eee0 28 509 -> 487 fcn.0000eee0
|
|
0x0000e1c0 1 5 fcn.0000e1c0
|
|
0x0000e8c0 21 217 -> 211 fcn.0000e8c0
|
|
0x00006200 5 105 fcn.00006200
|
|
0x00007250 1 40 fcn.00007250
|
|
0x00007180 3 85 -> 76 fcn.00007180
|
|
0x00006fa0 20 473 -> 448 fcn.00006fa0
|
|
0x00014e40 1 20 fcn.00014e40
|
|
0x00005c40 45 634 -> 527 fcn.00005c40
|
|
0x000063e0 18 401 -> 395 fcn.000063e0
|
|
0x00009380 64 1388 -> 1269 fcn.00009380
|
|
0x00015020 10 210 -> 199 fcn.00015020
|
|
0x00006840 9 197 fcn.00006840
|
|
0x00005fa0 34 596 -> 585 fcn.00005fa0
|
|
0x00005ec0 6 89 -> 80 fcn.00005ec0
|
|
0x000065f0 22 379 -> 375 fcn.000065f0
|
|
0x0000bde0 18 1924 -> 1917 fcn.0000bde0
|
|
0x00015580 12 193 -> 186 fcn.00015580
|
|
0x00014e60 1 56 fcn.00014e60
|
|
0x00015650 98 1137 -> 1135 fcn.00015650
|
|
0x00010300 59 923 -> 891 fcn.00010300
|
|
0x00013d00 1 117 fcn.00013d00
|
|
0x00012740 304 64006 -> 4658 fcn.00012740
|
|
0x00010b80 23 575 -> 525 fcn.00010b80
|
|
0x0000d2f0 11 91 -> 82 fcn.0000d2f0
|
|
0x0000d6c0 12 285 -> 282 fcn.0000d6c0
|
|
0x0000d350 5 43 -> 40 fcn.0000d350
|
|
0x00010920 1 36 fcn.00010920
|
|
0x0000feb0 11 149 -> 139 fcn.0000feb0
|
|
0x000140b0 1 12 fcn.000140b0
|
|
0x00006c60 22 233 -> 190 fcn.00006c60
|
|
0x000071e0 37 118072 -> 1946 fcn.000071e0
|
|
0x00015ad0 7 136 -> 132 fcn.00015ad0
|
|
0x00010740 40 480 -> 447 fcn.00010740
|
|
0x000073d0 67 1135 -> 1075 fcn.000073d0
|
|
0x00006310 12 208 -> 202 fcn.00006310
|
|
0x00007840 41 1028 -> 981 fcn.00007840
|
|
0x00007280 12 219 -> 201 fcn.00007280
|
|
0x0000ca00 12 115 -> 99 fcn.0000ca00
|
|
0x00007360 5 100 -> 85 fcn.00007360
|
|
0x00007c50 63 1112 -> 1036 fcn.00007c50
|
|
0x000102b0 4 72 -> 68 fcn.000102b0
|
|
0x00006d50 6 75 -> 69 fcn.00006d50
|
|
0x0000f270 141 2626 -> 2515 fcn.0000f270
|
|
0x0000d6b0 17 392 -> 366 fcn.0000d6b0
|
|
0x00016270 12 166 -> 152 fcn.00016270
|
|
0x000161a0 12 176 -> 164 fcn.000161a0
|
|
0x00015ea0 6 72 -> 71 fcn.00015ea0
|
|
0x00015ef0 5 41 -> 36 fcn.00015ef0
|
|
0x00016010 25 397 -> 361 fcn.00016010
|
|
0x00015f20 3 66 fcn.00015f20
|
|
0x00012530 3 71 fcn.00012530
|
|
0x00010c30 310 6399 -> 6311 fcn.00010c30
|
|
0x00006910 8 188 -> 175 fcn.00006910
|
|
0x000069d0 4 64 -> 63 fcn.000069d0
|
|
0x00010060 11 149 -> 139 fcn.00010060
|
|
0x00010210 7 156 -> 150 fcn.00010210
|
|
0x0000dcf0 5 98 fcn.0000dcf0
|
|
0x00008c90 6 135 fcn.00008c90
|
|
0x00014c60 18 246 -> 234 fcn.00014c60
|
|
0x00008d20 23 428 -> 406 fcn.00008d20
|
|
0x000080b0 22 397 -> 388 fcn.000080b0
|
|
0x00008ed0 40 752 -> 741 fcn.00008ed0
|
|
0x00006770 14 193 -> 177 fcn.00006770
|
|
0x00008240 113 2633 -> 2504 fcn.00008240
|
|
0x00006a30 5 97 -> 94 fcn.00006a30
|
|
0x0000ca80 100 1741 -> 1681 fcn.0000ca80
|
|
0x00006290 6 122 -> 121 fcn.00006290
|
|
0x0000d380 15 191 -> 167 fcn.0000d380
|
|
0x00016470 7 35 -> 31 fcn.00016470
|
|
0x000141b0 5 66036 -> 154 fcn.000141b0
|
|
0x0000c570 13 224 -> 209 fcn.0000c570
|
|
0x0000d220 8 93 -> 89 fcn.0000d220
|
|
0x00009b00 9 204 -> 194 fcn.00009b00
|
|
0x0000ee80 7 90 -> 82 fcn.0000ee80
|
|
0x00006580 1 42 fcn.00006580
|
|
0x00014fe0 4 64 -> 56 fcn.00014fe0
|
|
0x0000d4d0 5 88 fcn.0000d4d0
|
|
0x0000d440 8 7527 -> 156 fcn.0000d440
|
|
0x000164a0 8 102 -> 96 fcn.000164a0
|
|
0x000165b0 24 53488 -> 248 fcn.000165b0
|
|
0x00016640 5 66 -> 63 fcn.00016640
|
|
0x00016690 7 89 fcn.00016690
|
|
0x00014180 4 193 -> 170 fcn.00014180
|
|
0x0000e3f0 9 83 -> 75 fcn.0000e3f0
|
|
0x0000d7e0 17 195 -> 166 fcn.0000d7e0
|
|
0x0000de80 3 40577 -> 39 fcn.0000de80
|
|
0x0000dfd0 11 126 -> 122 fcn.0000dfd0
|
|
0x0000ddc0 10 147 -> 145 fcn.0000ddc0
|
|
0x0000e050 20 331 -> 315 fcn.0000e050
|
|
0x0000deb0 19 281 -> 261 fcn.0000deb0
|
|
0x0000e9a0 23 43941 -> 527 fcn.0000e9a0
|
|
0x0000ebe0 37 44616 -> 630 fcn.0000ebe0
|
|
0x00016530 5 54 -> 50 fcn.00016530
|
|
0x0000f1b0 15 183 -> 168 fcn.0000f1b0
|
|
0x00010be0 4 65 fcn.00010be0
|
|
0x00016320 19 322 -> 302 fcn.00016320
|
|
0x00010b90 4 65 fcn.00010b90
|
|
0x00016570 3 60 -> 51 fcn.00016570
|
|
0x00012630 23 268 -> 247 fcn.00012630
|
|
0x00014e10 1 41 fcn.00014e10
|
|
0x00016510 3 32 fcn.00016510
|
|
0x0000d280 5 98 -> 92 fcn.0000d280
|
|
0x000145b0 20 67969 -> 1004 fcn.000145b0
|
|
0x00014d60 8 120 -> 114 fcn.00014d60
|
|
0x00015bb0 3 21 fcn.00015bb0
|
|
0x00004000 3 27 fcn.00004000
|
|
EOF
|
|
RUN
|
|
|
|
NAME=aflj
|
|
FILE=bins/elf/ls
|
|
CMDS=<<EOF
|
|
e analysis.jmp.cref=true
|
|
aaa
|
|
aflj~{[0]}
|
|
EOF
|
|
EXPECT=<<EOF
|
|
{"offset":23264,"name":"entry0","size":46,"is-pure":false,"realsz":46,"noreturn":false,"stackframe":8,"calltype":"amd64","cost":15,"cc":1,"loops":0,"bits":64,"type":"fcn","nbbs":1,"edges":0,"ebbs":1,"signature":"entry0 (void *rtld_fini);","minbound":23264,"maxbound":23310,"callrefs":[{"from":23304,"to":138776,"type":"CALL"}],"datarefs":[{"from":23283,"to":68710,"type":"DATA"},{"from":23283,"to":92000,"type":"DATA"},{"from":23290,"to":68591,"type":"DATA"},{"from":23290,"to":91888,"type":"DATA"},{"from":23297,"to":16496,"type":"DATA"},{"from":23304,"to":115466,"type":"DATA"}],"indegree":0,"outdegree":1,"nlocals":0,"nargs":1,"stackvars":[],"regvars":[{"name":"rtld_fini","arg":true,"type":"void *","storage":{"type":"reg","reg":"rdx"}}]}
|
|
EOF
|
|
RUN
|
|
|
|
NAME=aflj empty
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
afl
|
|
aflj
|
|
EOF
|
|
EXPECT=<<EOF
|
|
[]
|
|
EOF
|
|
RUN
|
|
|
|
|