<div dir="ltr">Hi<div><br></div><div>I try to implement a coarse-grained CFI in LLVM</div><div><br></div><div>(CFI = Contorl Flow Integrity)</div><div><br></div><div>I want to collect all address after call instructions </div><div><br></div><div>address after a call equals to a valid return site in coarse-grained CFI</div><div><br></div><div>I want to add a new section </div><div><br></div><div>and write all the possible return address in the new section</div><div><br></div><div>(and then, add the integrity check)</div><div><br></div><div>I have some quetions:</div><div><br></div><div>(1) </div><div>Which part of LLVM code should I implement my CFI ?</div><div>IR level or SelectionDAG/CodeGen?</div><div><br></div><div>(2)</div><div>LLVM MC can let me add a new section, right?</div><div><br></div><div>(3)</div><div>How can I get the real address of instruction in compile time?</div><div>Or should I modify linker/loader?</div><div><br></div><div>Thank you</div><div><br></div><div>  </div><div>       </div><div><br></div><div><br></div><div>   </div></div>