Expore brk to libafl
This commit is contained in:
parent
444c415ca2
commit
6065cb8a84
@ -172,13 +172,13 @@ void libafl_gen_read(TCGv addr, MemOp ot)
|
|||||||
libafl_helper_table_add(&libafl_exec_read_hookN_info);
|
libafl_helper_table_add(&libafl_exec_read_hookN_info);
|
||||||
}
|
}
|
||||||
TCGv_i64 tmp0 = tcg_const_i64(libafl_id);
|
TCGv_i64 tmp0 = tcg_const_i64(libafl_id);
|
||||||
TCGTemp *tmp1[3] = { tcgv_i64_temp(tmp0),
|
TCGTemp *tmp1[2] = { tcgv_i64_temp(tmp0),
|
||||||
#if TARGET_LONG_BITS == 32
|
#if TARGET_LONG_BITS == 32
|
||||||
tcgv_i32_temp(addr) };
|
tcgv_i32_temp(addr) };
|
||||||
#else
|
#else
|
||||||
tcgv_i64_temp(addr) };
|
tcgv_i64_temp(addr) };
|
||||||
#endif
|
#endif
|
||||||
tcg_gen_callN(func, NULL, 3, tmp1);
|
tcg_gen_callN(func, NULL, 2, tmp1);
|
||||||
tcg_temp_free_i64(tmp0);
|
tcg_temp_free_i64(tmp0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,13 +260,13 @@ void libafl_gen_write(TCGv addr, MemOp ot)
|
|||||||
libafl_helper_table_add(&libafl_exec_write_hookN_info);
|
libafl_helper_table_add(&libafl_exec_write_hookN_info);
|
||||||
}
|
}
|
||||||
TCGv_i64 tmp0 = tcg_const_i64(libafl_id);
|
TCGv_i64 tmp0 = tcg_const_i64(libafl_id);
|
||||||
TCGTemp *tmp1[3] = { tcgv_i64_temp(tmp0),
|
TCGTemp *tmp1[2] = { tcgv_i64_temp(tmp0),
|
||||||
#if TARGET_LONG_BITS == 32
|
#if TARGET_LONG_BITS == 32
|
||||||
tcgv_i32_temp(addr) };
|
tcgv_i32_temp(addr) };
|
||||||
#else
|
#else
|
||||||
tcgv_i64_temp(addr) };
|
tcgv_i64_temp(addr) };
|
||||||
#endif
|
#endif
|
||||||
tcg_gen_callN(func, NULL, 3, tmp1);
|
tcg_gen_callN(func, NULL, 2, tmp1);
|
||||||
tcg_temp_free_i64(tmp0);
|
tcg_temp_free_i64(tmp0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -762,6 +762,23 @@ void target_set_brk(abi_ulong new_brk)
|
|||||||
brk_page = HOST_PAGE_ALIGN(target_brk);
|
brk_page = HOST_PAGE_ALIGN(target_brk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
|
uint64_t libafl_get_brk(void);
|
||||||
|
uint64_t libafl_set_brk(uint64_t new_brk);
|
||||||
|
|
||||||
|
uint64_t libafl_get_brk(void) {
|
||||||
|
return (uint64_t)target_brk;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t libafl_set_brk(uint64_t new_brk) {
|
||||||
|
uint64_t old_brk = (uint64_t)target_brk;
|
||||||
|
target_brk = (abi_ulong)new_brk;
|
||||||
|
return old_brk;
|
||||||
|
}
|
||||||
|
|
||||||
|
//// --- End LibAFL code ---
|
||||||
|
|
||||||
//#define DEBUGF_BRK(message, args...) do { fprintf(stderr, (message), ## args); } while (0)
|
//#define DEBUGF_BRK(message, args...) do { fprintf(stderr, (message), ## args); } while (0)
|
||||||
#define DEBUGF_BRK(message, args...)
|
#define DEBUGF_BRK(message, args...)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user