Fix aaa issue in NSO bins which use io.cache (#12396)

This commit is contained in:
radare 2018-12-04 12:50:09 +01:00 committed by GitHub
parent 5df3872b9d
commit bbebd7ed86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 12 deletions

View File

@ -7309,20 +7309,21 @@ static int cmd_anal_all(RCore *core, const char *input) {
}
int c = r_config_get_i (core->config, "anal.calls");
if (!r_str_startswith (r_config_get (core->config, "asm.arch"), "x86")) {
r_core_cmd0 (core, "aav");
bool ioCache = r_config_get_i (core->config, "io.pcache");
r_core_cmd0 (core, "aav");
r_config_set_i (core->config, "io.pcache", 1);
oldstr = r_print_rowlog (core->print, "Emulate code to find computed references (aae)");
r_core_cmd0 (core, "aae $SS @ $S");
r_print_rowlog_done (core->print, oldstr);
if (!ioCache) {
r_core_cmd0 (core, "wc-*");
if (!ioCache && !r_config_get_i (core->config, "io.cache")) {
r_core_cmd0 (core, "wc-*"); // this makes NSO fffff
}
r_config_set_i (core->config, "io.pcache", ioCache);
if (r_cons_is_breaked ()) {
goto jacuzzi;
}
}
R_FREE (dh_orig);
r_config_set_i (core->config, "anal.calls", 1);
r_core_cmd0 (core, "s $S");
if (r_cons_is_breaked ()) {

View File

@ -200,7 +200,7 @@ R_API int cmd_write_hexpair(RCore* core, const char* pairs) {
}
r_core_block_read (core);
} else {
eprintf ("Error: invalid hexpair string\n");
eprintf ("Error: Invalid hexpair string\n");
}
free (buf);
return len;
@ -1109,13 +1109,14 @@ static int cmd_write(void *data, const char *input) {
}
break;
case '-': { // "wc-"
if (input[2]=='*') { // "wc-*"
ut64 from = 0LL, to = UT64_MAX;
switch (input[2]) {
case '*': // "wc-*"
r_io_cache_reset (core->io, true);
break;
}
ut64 from, to;
if (input[2]==' ') { // "wc- "
char *p = strchr (input+3, ' ');
case ' ': // "wc- "
{
char *p = strchr (input + 3, ' ');
if (p) {
*p = 0;
from = r_num_math (core->num, input+3);
@ -1128,16 +1129,18 @@ static int cmd_write(void *data, const char *input) {
from = r_num_math (core->num, input+3);
to = from + core->blocksize;
}
} else {
}
break;
default:
eprintf ("Invalidate write cache at 0x%08"PFMT64x"\n", core->offset);
from = core->offset;
to = core->offset + core->blocksize;
}
eprintf("invalidated %d cache(s)\n",
eprintf ("Invalidated %d cache(s)\n",
r_io_cache_invalidate (core->io, from, to));
r_core_block_read (core);
}
break;
}
case 'i': // "wci"
r_io_cache_commit (core->io, 0, UT64_MAX);
r_core_block_read (core);