Skip to content

Commit

Permalink
Deprecate anal.jmp.eob /refs #13482 ##anal
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Oct 23, 2019
1 parent a3a0a13 commit 3ecc70e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 56 deletions.
54 changes: 7 additions & 47 deletions libr/anal/fcn.c
Expand Up @@ -23,8 +23,6 @@ extern bool try_get_delta_jmptbl_info(RAnal *anal, RAnalFunction *fcn, ut64 jmp_
#define MAX_FLG_NAME_SIZE 64

#define FIX_JMP_FWD 0
#define JMP_IS_EOB 1
#define JMP_IS_EOB_RANGE 64

// 64KB max size
// 256KB max function size
Expand Down Expand Up @@ -1113,14 +1111,10 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut64 len, int
gotoBeach (R_ANAL_RET_END);
}
{
bool must_eob = anal->opt.eobjmp;
if (!must_eob) {
RIOMap *map = anal->iob.map_get (anal->iob.io, addr);
if (map) {
must_eob = (op.jump < map->itv.addr || op.jump >= map->itv.addr + map->itv.size);
} else {
must_eob = true;
}
bool must_eob = true;
RIOMap *map = anal->iob.map_get (anal->iob.io, addr);
if (map) {
must_eob = (op.jump < map->itv.addr || op.jump >= map->itv.addr + map->itv.size);
}
if (must_eob) {
FITFCNSZ ();
Expand Down Expand Up @@ -1196,48 +1190,14 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut64 len, int
r_anal_fcn_bb (anal, fcn, op.jump, depth);
ret = r_anal_fcn_bb (anal, fcn, op.fail, depth);
} else {
// This code seems to break #1519
if (anal->opt.eobjmp) {
#if JMP_IS_EOB
ret = r_anal_fcn_bb (anal, fcn, op.jump, depth);
ret = r_anal_fcn_bb (anal, fcn, op.fail, depth);
if (op.jump < fcn->addr) {
if (!overlapped) {
bb->jump = op.jump;
bb->fail = UT64_MAX;
}
FITFCNSZ ();
r_anal_fcn_bb (anal, fcn, op.jump, depth);
ret = r_anal_fcn_bb (anal, fcn, op.fail, depth);
gotoBeach (R_ANAL_RET_END);
#else
// hardcoded jmp size // must be checked at the end wtf?
// always fitfcnsz and retend
if (op.jump > fcn->addr + JMP_IS_EOB_RANGE) {
ret = r_anal_fcn_bb (anal, fcn, op.fail, depth);
/* jump inside the same function */
gotoBeach (R_ANAL_RET_END);
} else if (op.jump < fcn->addr - JMP_IS_EOB_RANGE) {
ret = r_anal_fcn_bb (anal, fcn, op.fail, depth);
/* jump inside the same function */
gotoBeach (R_ANAL_RET_END);
} else {
if (op.jump < addr - JMP_IS_EOB_RANGE) {
gotoBeach (R_ANAL_RET_END);
}
if (op.jump > addr + JMP_IS_EOB_RANGE) {
gotoBeach (R_ANAL_RET_END);
}
}
#endif
}
ret = r_anal_fcn_bb (anal, fcn, op.jump, depth);
ret = r_anal_fcn_bb (anal, fcn, op.fail, depth);
if (!anal->opt.eobjmp) {
if (op.jump < fcn->addr) {
if (!overlapped) {
bb->jump = op.jump;
bb->fail = UT64_MAX;
}
gotoBeach (R_ANAL_RET_END);
}
}
}

Expand Down
8 changes: 0 additions & 8 deletions libr/core/cconfig.c
Expand Up @@ -212,13 +212,6 @@ static bool cb_analarmthumb(void *user, void *data) {
return true;
}

static bool cb_analeobjmp(void *user, void *data) {
RCore *core = (RCore*) user;
RConfigNode *node = (RConfigNode*) data;
core->anal->opt.eobjmp = node->i_value;
return true;
}

static bool cb_analdepth(void *user, void *data) {
RCore *core = (RCore*) user;
RConfigNode *node = (RConfigNode*) data;
Expand Down Expand Up @@ -2844,7 +2837,6 @@ R_API int r_core_config_init(RCore *core) {
SETI ("anal.timeout", 0, "Stop analyzing after a couple of seconds");

SETCB ("anal.armthumb", "false", &cb_analarmthumb, "aae computes arm/thumb changes (lot of false positives ahead)");
SETCB ("anal.jmp.eob", "false", &cb_analeobjmp, "jmp is end of block mode (option)");
SETCB ("anal.jmp.after", "true", &cb_analafterjmp, "Continue analysis after jmp/ujmp");
SETCB ("anal.endsize", "true", &cb_anal_endsize, "Adjust function size at the end of the analysis (known to be buggy)");
SETCB ("anal.delay", "true", &cb_anal_delay, "Enable delay slot analysis if supported by the architecgture");
Expand Down
1 change: 0 additions & 1 deletion libr/include/r_anal.h
Expand Up @@ -621,7 +621,6 @@ typedef struct r_anal_options_t {
bool norevisit;
int afterjmp; // continue analysis after jmp eax or forward jmp // option
int recont; // continue on recurse analysis mode
int eobjmp; // option
int noncode;
int nopskip; // skip nops at the beginning of functions
int hpskip; // skip `mov reg,reg` and `lea reg,[reg]`
Expand Down

0 comments on commit 3ecc70e

Please sign in to comment.