示例#1
0
//[reg id, reg value, taint]* [REG_INVALID_, 0, 0]
void EmitRegisters(FILE *f, const CONTEXT *ctx, context &delta){
  ADDRINT v, taint;
  int i, sz;
  //XXX: if you change order of these ids, you also need to change numbering
  //in motriage.ml, function: rid2reg
  REG regs[] = {LEVEL_BASE::REG_EAX, LEVEL_BASE::REG_EBX, LEVEL_BASE::REG_ECX,
              LEVEL_BASE::REG_EDX, LEVEL_BASE::REG_ESI, LEVEL_BASE::REG_EDI, LEVEL_BASE::REG_EBP,
              LEVEL_BASE::REG_ESP, LEVEL_BASE::REG_EFLAGS, LEVEL_BASE::REG_EIP};

  context::iterator it;

  sz = sizeof(regs)/sizeof(regs[0]);

  write_u32(f, TAG_REGS);
  write_u32(f, sz);

  for(i=0;i<sz;i++){
    REG r = regs[i];
    v = PIN_GetContextReg(ctx, r);
    write_u32(f, i); //we don't use PIN's ids
    write_u32(f, v);
    it = delta.find(r);
    if(it != delta.end()){
      taint = it->second;
    }
    else{
      taint = 0;
    }
    write_u32(f, taint);
    fprintf(stderr, "%s v=0x%08x, t=0x%08x\n", REG_StringShort(r).c_str(), v, 
        taint);
  }
}
示例#2
0
void TaintTracker::printRegs(context &delta)
{
  cerr << hex << endl << " ----------- Tainted Regs ------------ " << endl;
  for (context::iterator it = delta.begin(), ie = delta.end() ; it != ie ; ++it)
       cerr << REG_StringShort((REG)it->first) << " = " << it->second << endl;
}
示例#3
0
uint32_t TaintTracker::exists(context &ctx, uint32_t elem)
{
  return (ctx.find(elem) != ctx.end());
}