欢迎来到麦多课文档分享! | 帮助中心 海量文档,免费浏览,给你所需,享你所想!
麦多课文档分享
全部分类
  • 标准规范>
  • 教学课件>
  • 考试资料>
  • 办公文档>
  • 学术论文>
  • 行业资料>
  • 易语言源码>
  • ImageVerifierCode 换一换
    首页 麦多课文档分享 > 资源分类 > PPT文档下载
    分享到微信 分享到微博 分享到QQ空间

    Binary Rewriting with Dyninst.ppt

    • 资源ID:378948       资源大小:1.10MB        全文页数:26页
    • 资源格式: PPT        下载积分:2000积分
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    二维码
    微信扫一扫登录
    下载资源需要2000积分(如需开发票,请勿充值!)
    邮箱/手机:
    温馨提示:
    如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如需开发票,请勿充值!如填写123,账号就是123,密码也是123。
    支付方式: 支付宝扫码支付    微信扫码支付   
    验证码:   换一换

    加入VIP,交流精品资源
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    Binary Rewriting with Dyninst.ppt

    1、Binary Rewriting with Dyninst,Madhavi Krishnan and Dan McNulty,Talk Outline,Binary Rewriter Review Implementation Challenges New Features Rewriting Statically Linked Binaries Conclusion,2,Binary Rewriting with Dyninst,Binary Rewriting,3,Binary Rewriting with Dyninst,libc,Dyninst Binary Rewriter,a.ou

    2、t.rewritten,libprofile,Rewrite executablesRewrite librariesAdd new libraries to binaries,a.out,libc.rewritten,Binary Rewriter Capabilities,Instrument once, run many Support more systems (BlueGene, FreeBSD, ) Operate on unmodified binaries No debug information required No linker relocations required

    3、No symbols required Rewritten binary need not be compiled or linked,4,Binary Rewriting with Dyninst,Dynamic instrumentation and binary rewriting use the same abstractions and interfaces,/* Setup */ BPatch_addressSpace *addr_space; if (use_bin_edit)addr_space = BPatch.openFile(“a.out”); elseaddr_spac

    4、e = BPatch.createProcess(“a.out”);/* Instrumentation */ addr_space-loadLibrary(“libInstrumentation.so”); addr_space-getImage()-findFunction(“func”, funcs); addr_space-insertSnippet(callExpr, point);/* Finalize */ if (use_bin_edit) app_bin-writeFile(a.rewritten.out); else app_proc-continueExecution()

    5、; ,Binary Rewriter Example,6,Binary Rewriting with Dyninst,Challenges,Complex Standards Executable and Linkable Format(ELF) System V Standard Linux Standard Base (LSB) Accessing information in the original binary file Redundant information Inconsistent! E.g., Section size stored in headers and dynam

    6、ic section Writing a new binary file Updating sections with new information Not precisely defined by standards! E.g., Adding new symbol to hash section,7,Binary Rewriting with Dyninst,Challenges,Implementation of the standards Libraries and tools OS Assigning meaning to undefined behavior Symbols wi

    7、th no name and no type Stringent requirements by libelf Section alignment Unexpected restrictions by the OS Program header must be on first page Loader assumes relocation sections are adjacent,8,Binary Rewriting with Dyninst,What is New in the Binary Rewriter?,Linux/PowerPC32 portHandling run time e

    8、vents with the binary rewriterSupport for rewriting static binaries,9,Binary Rewriting with Dyninst,Dealing with Position Independent Code (PIC) What is PIC? Why deal with PIC? PowerPC specific challenges Identifying PIC idiom Determining current PC,Linux/PowerPC32 Port,10,Binary Rewriting with Dyni

    9、nst,0x1000,0x2000,0x3000,Code,Data,Shared library,Address space,PC relative references,Initialize and finalize instrumentation,Handling Run Time Events,11,Binary Rewriting with Dyninst,Dyninst Mutator,Mutatee Process,process load ,Events,OneTimeCode Callback,Initialize and finalize instrumentation,H

    10、andling Run Time Events,12,Binary Rewriting with Dyninst,Mutatee Binary,process load,Events,?,Snippet to handle the event,init/fini section,A general framework to handle run time events,Rewriting Static Binaries,13,Binary Rewriting with Dyninst,Dynamic Binary,Static Binary,Headers,Dynamic Linker,Cod

    11、e,Shared Libraries,?,Static Library,Code,Data,Headers,Code,Data,Adding New Libraries to Static Binaries,Link code and data from the new libraries into the binary Can we use use an existing linker? Dyninst must become a linker,14,Binary Rewriting with Dyninst,Static Binary,Headers,Code,Data,Rewriting

    12、 a Static Binary,15,Binary Rewriting with Dyninst,Headers,Code,Data,Lets start with this simple picture of a binary,Rewriting a Static Binary,16,Binary Rewriting with Dyninst,First, load new libraries,Headers,Code,Data,Rewriting a Static Binary,17,Binary Rewriting with Dyninst,Second, generate instr

    13、umentation to reference new libraries,References,Headers,Code,Data,Instrumentation,Rewriting a Static Binary,18,Binary Rewriting with Dyninst,Third, link code and data from the new libraries into the binary,Headers,Code,Data,Instrumentation,libdyninstRT.a Code,libprofile.a Code,libc.a Code,libdynins

    14、tRT.a Data,libprofile.a Data,libc.a Data,References,Rewriting a Static Binary,19,Binary Rewriting with Dyninst,Finally, update the headers,Old Headers,Code,Data,Instrumentation,libdyninstRT.a Code,libprofile.a Code,libc.a Code,libdyninstRT.a Data,libprofile.a Data,libc.a Data,New Headers,Challenges

    15、in Rewriting Static Binaries,Dyninst must become a linker,20,Binary Rewriting with Dyninst,Object File,Object File,Static Library,Linker,Not Finalized,Static Binary,Finalized,relinker,Dyninst Binary Rewriter,New Library,Challenges in Rewriting Static Binaries,Relinking is harder than linking Thread

    16、Local Storage (TLS) Constructor and destructor tables Supporting TLS Need to link together multiple TLS sections TLS sections must be adjacent Move existing TLS section to the end and append new TLS sections Update program header,21,Binary Rewriting with Dyninst,Challenges in Rewriting Static Binari

    17、es,Unexpected interactions within the tool chain,22,Binary Rewriting with Dyninst,gcc,ld,Standard Format,Unpublished conventions,Dyninst Binary Rewriter,New Library,Linked Binary,/* Setup */ BPatch_addressSpace *addr_space; if (use_bin_edit)addr_space = BPatch.openFile(“a.out”); elseaddr_space = BPa

    18、tch.createProcess(“a.out”);/* Instrumentation */ if( addr_space-isStaticExecutable() ) addr_space-loadLibrary(“libprofile.a”);addr_space-loadLibrary(“libc.a”); else addr_space-loadLibrary(“libprofile.so”); /* Finalize */ if (use_bin_edit) app_bin-writeFile(a.rewritten.out); else app_proc-continueExe

    19、cution(); ,Binary Rewriter Example,Binary Rewriter Status,Rewriting dynamic binaries Linux/x86 Linux/x86_64 Linux/PowerPC32 Rewriting static binaries Linux/x86 Linux/x86_64,24,Binary Rewriting with Dyninst,Future Directions,Rewriting dynamically linked binaries PowerPC64 Rewriting statically linked binaries PowerPC Family Ports to new platforms and object formats FreeBSD (ELF) Windows (PE, PDB) AIX (XCOFF) Update debug information (DWARF) in rewritten binaries,25,Binary Rewriting with Dyninst,Demo on Tuesday: Scalasca, TAU, ParaverQuestions?,26,Binary Rewriting with Dyninst,


    注意事项

    本文(Binary Rewriting with Dyninst.ppt)为本站会员(周芸)主动上传,麦多课文档分享仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文档分享(点击联系客服),我们立即给予删除!




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1 

    收起
    展开