Fix string ref direction and improve false positive xref types ##analysis

This commit is contained in:
pancake 2024-11-14 18:29:40 +01:00 committed by pancake
parent 1c363de830
commit e14fa9a5ec
14 changed files with 362 additions and 36 deletions

View File

@ -286,6 +286,7 @@ R_API RList *r_anal_vtable_search(RVTableContext *context) {
return vtables;
}
// R2_600 - rename to RAnal.vtablesList()
R_API void r_anal_list_vtables(RAnal *anal, int rad) {
RVTableContext context = {0};
r_anal_vtable_begin (anal, &context);

View File

@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2019-2022 - pancake */
/* radare2 - LGPL - Copyright 2019-2024 - pancake */
/* This code has been written by pancake which has been based on Alvaro's
* r2pipe-python script which was based on FireEye script for IDA Pro.
@ -303,6 +303,7 @@ static bool objc_find_refs(RCore *core) {
if (xrefs) {
RAnalRef *ref;
R_VEC_FOREACH (xrefs, ref) {
// maybe ICOD?
r_anal_xrefs_set (core->anal, ref->addr, funcVA, R_ANAL_REF_TYPE_CODE);
total_xrefs++;
}

View File

@ -4602,6 +4602,10 @@ static bool found_xref(RCore *core, ut64 at, ut64 xref_to, RAnalRefType type, PJ
if (!rad) {
if (cfg_anal_strings && R_ANAL_REF_TYPE_MASK (type) == R_ANAL_REF_TYPE_DATA) {
add_string_ref (core, at, xref_to);
} else if (cfg_anal_strings && R_ANAL_REF_TYPE_MASK (type) == R_ANAL_REF_TYPE_ICOD) {
add_string_ref (core, at, xref_to);
} else if (cfg_anal_strings && R_ANAL_REF_TYPE_MASK (type) == R_ANAL_REF_TYPE_STRN) {
add_string_ref (core, at, xref_to);
} else if (xref_to) {
r_anal_xrefs_set (core->anal, at, xref_to, type);
}
@ -4745,10 +4749,10 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int
}
uninit = false;
}
// check if meta tells its code
(void) r_anal_op (core->anal, &op, at, buf, bsz, R_ARCH_OP_MASK_BASIC | R_ARCH_OP_MASK_HINT);
while ((i + maxopsz) < bsz && !r_cons_is_breaked ()) {
r_anal_op_fini (&op);
// check if meta tells its code
{
ut64 size;
RAnalMetaItem *mi = r_meta_get_at (core->anal, at + i, R_META_TYPE_ANY, &size);
@ -4766,7 +4770,7 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int
}
ret = r_anal_op (core->anal, &op, at + i, buf + i, bsz - i, R_ARCH_OP_MASK_BASIC | R_ARCH_OP_MASK_HINT);
if (ret < 1) {
R_LOG_DEBUG ("aar invalid op %llx %d", at + i, codealign);
R_LOG_DEBUG ("aar invalid op 0x%"PFMT64x" %d", at + i, codealign);
i += minopsz;
if (codealign > 1) {
int d = (at + i) % codealign;
@ -4790,14 +4794,31 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int
}
// find references
if (op.ptr && op.ptr != UT64_MAX && op.ptr != UT32_MAX) {
#if 1
const int type = core_type_by_addr (core, op.ptr);
/// XXX R2_600. we need op.ptrdir . because op.ptr can be op[0] or op[1]
const ut64 perm = (type == R_ANAL_REF_TYPE_STRN)? R_ANAL_OP_DIR_READ: (op.direction &= (~R_ANAL_OP_DIR_REF));
const int reftype = type | r_anal_perm_to_reftype (perm);
#else
const ut64 perm = op.direction &= (~R_ANAL_OP_DIR_REF);
if (found_xref (core, op.addr, op.ptr, R_ANAL_REF_TYPE_DATA | r_anal_perm_to_reftype(perm), pj, rad, cfg_debug, cfg_anal_strings)) {
const int reftype = R_ANAL_REF_TYPE_DATA | r_anal_perm_to_reftype (perm);
#endif
if (found_xref (core, op.addr, op.ptr, reftype, pj, rad, cfg_debug, cfg_anal_strings)) {
count++;
}
} else {
// check for using reg+disp, which shouldnt be valid if op.ptr is set
if (op.addr > 512 && op.disp > 512 && op.disp && op.disp != UT64_MAX) {
if (found_xref (core, op.addr, op.disp, R_ANAL_REF_TYPE_DATA, pj, rad, cfg_debug, cfg_anal_strings)) {
#if 0
// TODO: experiment with this fix
// R2R db/anal/x86_32
const int type = core_type_by_addr (core, op.disp);
const ut64 perm = op.direction &= (~R_ANAL_OP_DIR_REF);
const int reftype = type | r_anal_perm_to_reftype (perm);
#else
const int reftype = R_ANAL_REF_TYPE_DATA;
#endif
if (found_xref (core, op.addr, op.disp, reftype, pj, rad, cfg_debug, cfg_anal_strings)) {
count++;
}
}
@ -6114,7 +6135,20 @@ R_API void r_core_anal_esil(RCore *core, const char *str /* len */, const char *
// arm64
if (cur && arch == R2_ARCH_ARM64) {
if (CHECKREF (ESIL->cur)) {
#if 1
int type = core_type_by_addr (core, ESIL->cur);
if (type == R_ANAL_REF_TYPE_NULL) {
type = R_ANAL_REF_TYPE_DATA;
}
if (type == R_ANAL_REF_TYPE_ICOD) {
type |= R_ANAL_REF_TYPE_EXEC;
} else {
type |= R_ANAL_REF_TYPE_READ;
}
r_anal_xrefs_set (core->anal, cur, ESIL->cur, type);
#else
r_anal_xrefs_set (core->anal, cur, ESIL->cur, R_ANAL_REF_TYPE_STRN | R_ANAL_REF_TYPE_READ);
#endif
}
#if 0
ut64 dst = esilbreak_last_read;

View File

@ -8043,11 +8043,11 @@ R_IPI void cmd_aei(RCore *core) {
}
R_IPI int core_type_by_addr(RCore *core, ut64 addr) {
const RList *list = r_flag_get_list (core->flags, addr);
RListIter *iter;
RFlagItem *item;
bool has_flag = false;
int type = R_ANAL_REF_TYPE_DATA;
const RList *list = r_flag_get_list (core->flags, addr);
r_list_foreach (list, iter, item) {
if (strchr (item->name, '.')) {
has_flag = true;
@ -8064,8 +8064,9 @@ R_IPI int core_type_by_addr(RCore *core, ut64 addr) {
}
}
if (!has_flag) {
// if we return anything but _DATA here, the `aao` and `avr` references stop working
// XXX assume TYPE_CODE Or TYPE_ICOD or mayb NULL if invalid address?
return R_ANAL_REF_TYPE_NULL; // -1 ?
return type; // R_ANAL_REF_TYPE_NULL; // -1 ?
}
return type;
}

View File

@ -33,7 +33,7 @@ typedef enum {
R_ANAL_OP_DIR_READ = 1,
R_ANAL_OP_DIR_WRITE = 2,
R_ANAL_OP_DIR_EXEC = 4,
R_ANAL_OP_DIR_REF = 8,
R_ANAL_OP_DIR_REF = 8, // uhm?
} RAnalOpDirection;
typedef enum {

View File

@ -1103,7 +1103,7 @@ aae
axt str.helloradareworld_n
EOF
EXPECT=<<EOF
main 0xbf9c [STRN:-w-] add r0, pc
main 0xbf9c [STRN:r--] add r0, pc
EOF
RUN

View File

@ -12,7 +12,7 @@ EOF
EXPECT=<<EOF
;-- str..._.._third_party_boringssl_src_ssl_ssl_x509.cc:
;-- s:
; STRN XREF from f @ 0x37194e(w)
; STRN XREF from f @ 0x37194e(r)
0x00080c62 .string "../../third_party/boringssl/src/ssl/ssl_x509.cc" ; len=48
;-- str..._.._third_party_boringssl_src_ssl_ssl_asn1.cc:
0x00080c92 .string "../../third_party/boringssl/src/ssl/ssl_asn1.cc" ; len=48
@ -48,7 +48,7 @@ s 0x00001373
axt
EOF
EXPECT=<<EOF
fcn.00003004 0x337c [STRN:-w-] add x1, x1, str.3082058830820370a00302010202147dc6315182dee2344f870acce7b12d5fea665fa4300d06092a864886f70d01010b05003074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643020170d3233303333313033313632355a180f32303533303333313033313632355a3074310b3009060355040613025553311330110603550408130a43616c69666f726e69613116301406035504071
fcn.00003004 0x337c [STRN:r--] add x1, x1, str.3082058830820370a00302010202147dc6315182dee2344f870acce7b12d5fea665fa4300d06092a864886f70d01010b05003074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643020170d3233303333313033313632355a180f32303533303333313033313632355a3074310b3009060355040613025553311330110603550408130a43616c69666f726e69613116301406035504071
EOF
RUN

View File

@ -1,3 +1,266 @@
NAME=write string ref x64
FILE=bins/mach0/mac-ls
ARGS=-a x86 -b 64
CMDS=<<EOF
aae
aar
ax~STRN?
axt 0x100004b48
EOF
EXPECT=<<EOF
94
(nofunc) 0x10000125a [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x100001293 [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x1000013a9 [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x1000013da [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x100001441 [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x100001461 [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x100001b61 [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x100001baf [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x100001c50 [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x10000281a [STRN:r--] lea rsi, str.Unix2003
(nofunc) 0x10000336b [STRN:r--] lea rsi, str.Unix2003
EOF
RUN
NAME=write string ref arm64
FILE=bins/mach0/mac-ls4
ARGS=-a arm -b 64
CMDS=<<EOF
aae
aar
ax~STRN?
s str.Unix2003
axt
EOF
EXPECT=<<EOF
80
(nofunc) 0x100003af8 [STRN:r--] adr x1, str.Unix2003
EOF
RUN
NAME=write string ref arm64
FILE=bins/mach0/mac-ls4
ARGS=-a arm -b 64
CMDS=<<EOF
aae
s str.Unix2003
axt
EOF
EXPECT=<<EOF
(nofunc) 0x100003af8 [STRN:r--] adr x1, str.Unix2003
EOF
RUN
NAME=write string ref 2
FILE=bins/mach0/ls-sequoia
ARGS=-a arm -b 64
CMDS=<<EOF
aar
aae
ax~STRN
axt 0x100008000
EOF
EXPECT=<<EOF
main+100 0x100003abc > STRN:r-- > 0x100007a16 str.bin_ls
main+108 0x100003ac4 > STRN:r-- > 0x100007a1d str.Unix2003
main+156 0x100003af4 > STRN:r-- > 0x100007a26 str.COLUMNS
main+212 0x100003b2c > STRN:r-- > 0x100007a26 str.COLUMNS
main+328 0x100003ba0 > STRN:r-- > 0x100007a2e str.LS_SAMESORT
main+356 0x100003bbc > STRN:r-- > 0x100007a3a str.CLICOLOR
main+388 0x100003bdc > STRN:r-- > 0x100007a43 str._1ABCD:FGHILOPRSTUWXabcdefghiklmnopqrstuvwxy__
main+1088 0x100003e98 > STRN:r-- > 0x100007b29 str.always
main+1128 0x100003ec0 > STRN:r-- > 0x100007b34 str.force
main+1148 0x100003ed4 > STRN:r-- > 0x100007b3a str.auto
main+1188 0x100003efc > STRN:r-- > 0x100007b43 str.if_tty
main+1208 0x100003f10 > STRN:r-- > 0x100007b4a str.never
main+1248 0x100003f38 > STRN:r-- > 0x100007b53 str.none
main+1316 0x100003f7c > STRN:r-- > 0x100007a3a str.CLICOLOR
main+1744 0x100004128 > STRN:r-- > 0x100007a3a str.CLICOLOR
main+1760 0x100004138 > STRN:r-- > 0x100007b58 str.COLORTERM
main+1796 0x10000415c > STRN:r-- > 0x100007b62 str.CLICOLOR_FORCE
main+1812 0x10000416c > STRN:r-- > 0x100007ab3 str.TERM
main+2136 0x1000042b0 > STRN:r-- > 0x100007aca str.LSCOLORS
main+2856 0x100004580 > STRN:r-- > 0x100007ad3 str.vfs.nspace.prevent_materialization
main+2888 0x1000045a0 > STRN:r-- > 0x100007af6 str.prevent_materialization_sysctl_failed
main+3008 0x100004618 > STRN:r-- > 0x100007b1c str.stdout
main+3028 0x10000462c > STRN:r-- > 0x100007a73 str.unsupported___color_value__s__must_be_always__auto__or_never_
sym.func.100004b44+132 0x100004bc8 > STRN:r-- > 0x100007ba9 str.LS_COLWIDTHS
sym.func.100004b44+1216 0x100005004 > STRN:r-- > 0x100007beb str._s__s
sym.func.100004b44+1848 0x10000527c > STRN:r-- > 0x100007bf6 str._llu
sym.func.100005400+132 0x100005484 > STRN:r-- > 0x100007c15 str.total__qu_n
sym.func.1000054d4+68 0x100005518 > STRN:r-- > 0x100007c20 str._ju
sym.func.100005638+144 0x1000056c8 > STRN:r-- > 0x100007c15 str.total__qu_n
sym.func.100005638+224 0x100005718 > STRN:r-- > 0x100007c20 str._ju
sym.func.100005638+412 0x1000057d4 > STRN:r-- > 0x100007c2d str._s_s__ju
sym.func.100005638+452 0x1000057fc > STRN:r-- > 0x100007c3a str._s_s__ju___s
sym.func.100005638+492 0x100005824 > STRN:r-- > 0x100007c62 str.__s
sym.func.100005638+536 0x100005850 > STRN:r-- > 0x100007e19 str._jx
sym.func.100005638+664 0x1000058d0 > STRN:r-- > 0x100007c4b str._s_s__ju___s____s
sym.func.100005638+816 0x100005968 > STRN:r-- > 0x100007beb str._s__s
sym.func.100005638+912 0x1000059c8 > STRN:r-- > 0x100007e9a str._nls:__s:__s_n
sym.func.100005638+936 0x1000059e0 > STRN:r-- > 0x100007ea7 str.___
sym.func.100005638+1328 0x100005b68 > STRN:r-- > 0x100007d05 str.unknown
sym.func.100005638+1336 0x100005b70 > STRN:r-- > 0x100007d00 str.deny
sym.func.100005638+1352 0x100005b80 > STRN:r-- > 0x100007cfa str.allow
sym.func.100005638+1380 0x100005b9c > STRN:r-- > 0x100007d1b str._inherited
sym.func.100005638+1408 0x100005bb8 > STRN:r-- > 0x100007d0d str.__d:__s_s__s
sym.func.100005638+1512 0x100005c20 > STRN:r-- > 0x100007d26 str._s_s
sym.func.100005638+1620 0x100005c8c > STRN:r-- > 0x100007d26 str._s_s
sym.func.100005638+1712 0x100005ce8 > STRN:r-- > 0x100007d38 str.group
sym.func.100005638+1720 0x100005cf0 > STRN:r-- > 0x100007d33 str.user
sym.func.100005638+1752 0x100005d10 > STRN:r-- > 0x100007d2d str._s:_s
sym.func.100005d64+84 0x100005db8 > STRN:r-- > 0x100007eac str._s
sym.func.100005d64+116 0x100005dd8 > STRN:r-- > 0x100007eb1 str._lld
sym.func.100005e00+156 0x100005e9c > STRN:r-- > 0x100007e20 str._e__b__T__Y
sym.func.100005e00+164 0x100005ea4 > STRN:r-- > 0x100007e2c str._b__e__T__Y
sym.func.100005e00+232 0x100005ee8 > STRN:r-- > 0x100007e38 str._e__b__R
sym.func.100005e00+240 0x100005ef0 > STRN:r-- > 0x100007e41 str._b__e__R
sym.func.100005e00+256 0x100005f00 > STRN:r-- > 0x100007e4a str._e__b___Y
sym.func.100005e00+264 0x100005f08 > STRN:r-- > 0x100007e54 str._b__e___Y
sym.func.100005e00+672 0x1000060a0 > STRN:r-- > 0x100007e61 str._.s_s_s_s
sym.func.1000062d8+116 0x10000634c > STRN:r-- > 0x1000079cc str._________
sym.func.10000644c+496 0x10000663c > STRN:r-- > 0x100007c15 str.total__qu_n
sym.func.100006780+128 0x100006800 > STRN:r-- > 0x100007e7e str.exfxcxdxbxegedabagacadah
sym.func.100006780+284 0x10000689c > STRN:r-- > 0x100007c87 str.LSCOLORS_should_use_characters_a_h_instead_of_0_9__see_the_manual_page_
sym.func.100006780+304 0x1000068b0 > STRN:r-- > 0x100007ccf str.invalid_character__c_in_LSCOLORS_env_var
sym.func.1000069ac+104 0x100006a14 > STRN:r-- > 0x100007e74 str._3_d
sym.func.1000069ac+132 0x100006a30 > STRN:r-- > 0x100007e79 str._4_d
sym.func.100006f18+132 0x100006f9c > STRN:r-- > 0x100007a02 str.___aa_bb_ff_nn_rr_tt_vv
sym.func.100007174+28 0x100007190 > STRN:r-- > 0x100007eb9 str.usage:_ls____ABCFGHILOPRSTUWXabcdefghiklmnopqrstuvwxy1________colorwhen____D_format___file_...__n
sym.func.1000071a0+16 0x1000071b0 > STRN:r-- > 0x100007b71 str.fts_open
sym.func.1000071bc+16 0x1000071cc > STRN:r-- > 0x100007ba0 str.fts_read
sym.func.1000071d8+28 0x1000071f4 > STRN:r-- > 0x100007b7a str._s:_directory_causes_a_cycle
sym.func.100007218+40 0x100007240 > STRN:r-- > 0x100007b97 str._s:__s
sym.func.10000725c+52 0x100007290 > STRN:r-- > 0x100007b97 str._s:__s
sym.func.1000072ac+16 0x1000072bc > STRN:r-- > 0x100007bb9 str.user_from_uid
sym.func.1000072c8+16 0x1000072d8 > STRN:r-- > 0x100007bc7 str.group_from_gid
sym.func.1000072e4+16 0x1000072f4 > STRN:r-- > 0x100007be4 str.malloc
sym.func.100007300+16 0x100007310 > STRN:r-- > 0x100007bd8 str.fflagstostr
sym.func.10000731c+44 0x100007348 > STRN:r-- > 0x100007b97 str._s:__s
sym.func.100007370+16 0x100007380 > STRN:r-- > 0x100007c00 str.printscol
sym.func.100007370+24 0x100007388 > STRN:r-- > 0x100007c0a str.print.c
sym.func.10000739c+16 0x1000073ac > STRN:r-- > 0x100007c6b str.printcol
sym.func.10000739c+24 0x1000073b4 > STRN:r-- > 0x100007c0a str.print.c
sym.func.10000739c+32 0x1000073bc > STRN:r-- > 0x100007c74 str.base___dp__entries
(nofunc) 0x100003be0 [ICOD:--x] adrp x22, reloc.__assert_rtn
(nofunc) 0x100003e10 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100003e84 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x1000040dc [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x1000045e8 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100004b70 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100004bf4 [ICOD:--x] adrp x24, reloc.__assert_rtn
(nofunc) 0x1000053a8 [ICOD:--x] adrp x9, reloc.__assert_rtn
(nofunc) 0x100005660 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x1000059a0 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100005bd0 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100005c3c [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100005d28 [ICOD:--x] adrp x9, reloc.__assert_rtn
(nofunc) 0x100005e28 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x1000060c8 [ICOD:--x] adrp x19, reloc.__assert_rtn
(nofunc) 0x1000060ec [ICOD:--x] adrp x9, reloc.__assert_rtn
(nofunc) 0x100006b60 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100006b88 [ICOD:--x] adrp x22, reloc.__assert_rtn
(nofunc) 0x100006c54 [ICOD:--x] adrp x9, reloc.__assert_rtn
(nofunc) 0x100006cac [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100006cd4 [ICOD:--x] adrp x22, reloc.__assert_rtn
(nofunc) 0x100006db0 [ICOD:--x] adrp x9, reloc.__assert_rtn
(nofunc) 0x100006e00 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100006e38 [ICOD:--x] adrp x23, reloc.__assert_rtn
(nofunc) 0x100006ee4 [ICOD:--x] adrp x9, reloc.__assert_rtn
(nofunc) 0x100006f40 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc) 0x100006f88 [ICOD:--x] adrp x24, reloc.__assert_rtn
(nofunc) 0x100007138 [ICOD:--x] adrp x9, reloc.__assert_rtn
(nofunc) 0x100007180 [ICOD:--x] adrp x8, reloc.__assert_rtn
(nofunc); [01] -r-x section size 1344 named 1.__TEXT.__auth_stubs 0x1000073c8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000073cc [ICOD:r--] add x17, x17, 0
(nofunc) 0x1000073d0 [DATA:r--] ldr x16, [x17]
(nofunc) 0x1000073d8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000073e8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000073f8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007408 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007418 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007428 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007438 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007448 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007458 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007468 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007478 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007488 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007498 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000074a8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000074b8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000074c8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000074d8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000074e8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000074f8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007508 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007518 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007528 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007538 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007548 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007558 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007568 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007578 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007588 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007598 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000075a8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000075b8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000075c8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000075d8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000075e8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000075f8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007608 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007618 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007628 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007638 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007648 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007658 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007668 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007678 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007688 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007698 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000076a8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000076b8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000076c8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000076d8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000076e8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000076f8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007708 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007718 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007728 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007738 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007748 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007758 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007768 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007778 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007788 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007798 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000077a8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000077b8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000077c8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000077d8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000077e8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000077f8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007808 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007818 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007828 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007838 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007848 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007858 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007868 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007878 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007888 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x100007898 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000078a8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000078b8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000078c8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000078d8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000078e8 [ICOD:--x] adrp x17, reloc.__assert_rtn
(nofunc) 0x1000078f8 [ICOD:--x] adrp x17, reloc.__assert_rtn
EOF
RUN
NAME=noreturn errno
FILE=bins/mach0/BatteryLife.arm_64.1
CMDS=<<EOF

View File

@ -134,14 +134,14 @@ EXPECT=<<EOF
0x10000084a -> 0x1000008bc CODE:--x
0x100000db4 -> 0x100001150 DATA:r--
0x100000dc6 -> 0x100000eee CALL:--x
0x100000dcb -> 0x100000f20 DATA:r--
0x100000dcb -> 0x100000f20 STRN:r--
0x100000dd7 -> 0x100000ef4 CALL:--x
0x100000e00 -> 0x100001178 DATA:r--
0x100000e34 -> 0x100001178 DATA:r--
0x100000e00 -> 0x100001178 ICOD:r--
0x100000e34 -> 0x100001178 ICOD:r--
0x100000e58 -> 0x100001170 DATA:r--
0x100000e5f -> 0x100001158 DATA:r--
0x100000e69 -> 0x100000eee CALL:--x
0x100000e6e -> 0x100000f45 DATA:r--
0x100000e6e -> 0x100000f45 STRN:r--
0x100000e7d -> 0x100001160 DATA:r--
0x100000e87 -> 0x100000eee CALL:--x
0x100000e90 -> 0x100001168 DATA:r--
@ -149,7 +149,7 @@ EXPECT=<<EOF
0x100000e9f -> 0x100001170 DATA:r--
0x100000ea6 -> 0x100001158 DATA:r--
0x100000eb0 -> 0x100000eee CALL:--x
0x100000eb5 -> 0x100000f4e DATA:r--
0x100000eb5 -> 0x100000f4e STRN:r--
0x100000ec4 -> 0x100001160 DATA:r--
0x100000ece -> 0x100000eee CALL:--x
0x100000ed7 -> 0x100001168 DATA:r--
@ -160,13 +160,7 @@ EXPECT=<<EOF
0x100000f05 -> 0x100001000 CODE:--x
0x100000f11 -> 0x100000efc CODE:--x
0x100000f1b -> 0x100000efc CODE:--x
0x100000f28 -> 0x100000f4a CODE:--x
0x100000f4c -> 0x100000f4e CODE:--x
0x100000f5e -> 0x100000fa8 CODE:--x
0x100000f67 -> 0x100000fb7 CODE:--x
0x100000f6f -> 0x100000f72 CODE:--x
0x100000f73 -> 0x100000fe9 CODE:--x
0x100000f89 -> 0x100000fbd CODE:--x
0x100000fed -> 0x100000fff CODE:--x
EOF
RUN

View File

@ -1473,7 +1473,7 @@ aar
axt @ str.john
EOF
EXPECT=<<EOF
main 0x804831a [DATA:-w-] mov dword [var_ch], str.john
main 0x804831a [STRN:r--] mov dword [var_ch], str.john
EOF
RUN

View File

@ -1771,7 +1771,7 @@ var int64_t var_14h @ rbp-0x14
EOF
RUN
NAME=afvt
NAME=afvt 2
FILE=bins/mach0/macho
CMDS=<<EOF
s 0x100000b60
@ -2220,8 +2220,10 @@ main 0x40050a [DATA:r--] mov edi, str.Hello_World
EOF
RUN
# for some reason this test fails in the CI, but runs fine in mac/arm
NAME=axt capstone x86: IOLI0
FILE=bins/elf/ioli/crackme0x00
BROKEN=1
CMDS=<<EOF
e asm.arch = x86
e anal.arch = x86
@ -2231,7 +2233,37 @@ aa
axt @ str.Password:
EOF
EXPECT=<<EOF
main 0x804843c [DATA:-w-] mov dword [esp], str.Password:
main 0x804843c [DATA:r--] mov dword [esp], str.Password:
EOF
RUN
NAME=axt capstone x86: IOLI0 aar vs aa
FILE=bins/elf/ioli/crackme0x00
CMDS=<<EOF
e asm.arch = x86
e anal.arch = x86
e scr.color=false
e scr.wheel = false
aar
axt str.Password:
EOF
EXPECT=<<EOF
(nofunc) 0x804843c [STRN:r--] mov dword [esp], str.Password:
EOF
RUN
NAME=axt capstone x86: IOLI0 aaa vs aa
FILE=bins/elf/ioli/crackme0x00
CMDS=<<EOF
e asm.arch = x86
e anal.arch = x86
e scr.color=false
e scr.wheel = false
aaa
axt str.Password:
EOF
EXPECT=<<EOF
main 0x804843c [STRN:r--] mov dword [esp], str.Password:
EOF
RUN
@ -2568,7 +2600,7 @@ pd 1 @0x400610
EOF
EXPECT=<<EOF
;-- __libc_csu_fini:
; DATA XREF from entry0 @ +0xf(r)
; ICOD XREF from entry0 @ +0xf(r)
0x00400730 f3c3 repz ret
; CODE XREF from sym.__do_global_ctors_aux @ +0x2d(x)
0x004007f0 4883eb08 sub rbx, 8
@ -3194,7 +3226,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=af jmp after ret
NAME=af jmp after ret 2
FILE=malloc://512
CMDS=<<EOF
e anal.hasnext=0
@ -3751,7 +3783,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=./noncode
NAME=./noncode 2
FILE=bins/mach0/ls-osx-x86_64
CMDS=<<EOF
e anal.in=io.maps
@ -4075,7 +4107,7 @@ direction: read
family: vec
0x140001358 660f6f05e0.. movdqa xmm0, xmmword [str._n_2.__1__a] ; [0x140021040:16]=-1 ; "\n*,2.)%#1%#)a~\x7f"
;-- str._n_2.__1__a:
; DATA XREF from main @ +0x38(r)
; STRN XREF from main @ +0x38(r)
0x140021040 .string "\n*,2.)%#1%#)a~" ; len=15
EOF
RUN

View File

@ -209,7 +209,7 @@ pd 13 @ main
EOF
EXPECT=<<EOF
;-- main:
; DATA XREF from entry0 @ 0x10c1(r)
; ICOD XREF from entry0 @ 0x10c1(r)
/ 139: int dbg.main (int argc, char **argv, char **envp);
| ; var Mammal *m @ rbp-0x18
| ; var Bird *b @ rbp-0x20
@ -241,7 +241,7 @@ pd 75 @ dbg.main
EOF
EXPECT=<<EOF
;-- rust::main::h523dcf5432fcfd88:
; DATA XREF from main @ 0x5b0d(r)
; ICOD XREF from main @ 0x5b0d(r)
/ 940: int dbg.main (int argc, char **argv);
| ; var int64_t var_8h @ rsp+0x8
| ; var int64_t var_10h @ rsp+0x10
@ -508,7 +508,7 @@ pdf @ dbg.main
EOF
EXPECT=<<EOF
;-- main:
; DATA XREF from entry0 @ 0x2271(r)
; ICOD XREF from entry0 @ 0x2271(r)
/ 101: int dbg.main (int argc, char **argv, char **envp);
| ; arg int argc @ rdi
| ; arg char **argv @ rsi
@ -557,7 +557,7 @@ pdf @ dbg.main
EOF
EXPECT=<<EOF
;-- main:
; DATA XREF from entry0 @ 0x2271(r)
; ICOD XREF from entry0 @ 0x2271(r)
/ 101: int dbg.main (int argc, char **argv, char **envp);
| ; arg int argc @ rdi
| ; arg char **argv @ rsi

View File

@ -1199,8 +1199,8 @@ aaex 12@4
axt 0x2040
EOF
EXPECT=<<EOF
(nofunc) 0x8 [DATA:-w-] add x16, x16, 0x40
(nofunc) 0x8 [DATA:-w-] add x16, x16, 0x40
(nofunc) 0x8 [ICOD:r--] add x16, x16, 0x40
(nofunc) 0x8 [ICOD:r--] add x16, x16, 0x40
EOF
RUN

View File

@ -82,7 +82,7 @@ ax~?
ax~selref
EOF
EXPECT=<<EOF
89
83
section.0.__TEXT.__text+20 0x100000db4 > DATA:r-- > 0x100001150 section.14.__DATA.__objc_selrefs
main+15 0x100000e5f > DATA:r-- > 0x100001158 section.14.__DATA.__objc_selrefs+8
main+45 0x100000e7d > DATA:r-- > 0x100001160 section.14.__DATA.__objc_selrefs+16