GRIFFIN: Guarding Control Flows Using Intel Processor Trace

GRIFFIN: Guarding Control Flows Using Intel Processor Trace

GRIFFIN: Guarding Control Flows Using Intel Processor Trace Xinyang Ge Weidong Cui Trent Jaeger Microsoft Research Microsoft Research The Pennsylvania State University [email protected] [email protected] [email protected] Abstract specified control-flow graph (CFG). CFI defenses were iden- Researchers are actively exploring techniques to enforce tified as the foundation of defenses against code-reuse at- control-flow integrity (CFI), which restricts program exe- tacks [40], as such attacks fundamentally aim to exploit com- cution to a predefined set of targets for each indirect con- promised programs by executing adversary-chosen control trol transfer to prevent code-reuse attacks. While hardware- flows. While attacks are still possible even when restricting assisted CFI enforcement may have the potential for ad- program execution to a restrictive CFG [10], CFI can greatly vantages in performance and flexibility over software in- reduce the attack surface available to adversaries. strumentation, current hardware-assisted defenses are either To date, researchers have focused on software-only im- incomplete (i.e., do not enforce all control transfers) or less plementations of CFI. Such approaches can be divided into efficient in comparison. We find that the recent introduction three categories: compile-time instrumentation, static binary of hardware features to log complete control-flow traces, instrumentation, and runtime instrumentation. The main ad- such as Intel Processor Trace (PT), provides an opportunity vantage of compile-time instrumentation [8, 14, 18, 28, 31, to explore how efficient and flexible a hardware-assisted CFI 33, 35, 42, 45, 49] is that it has better performance than other enforcement system may become. While Intel PT was de- approaches. However, it has two main limitations. First, such signed to aid in offline debugging and failure diagnosis, we techniques can only instrument programs supported by that explore its effectiveness for online CFI enforcement over un- compiler. Second, they “fix” the CFI defense for resultant modified binaries by designing a parallelized method for en- software, preventing systems from customizing their CFI de- forcing various types of CFI policies. We have implemented fenses at runtime (e.g., to tighten security or balance perfor- mance). Static binary instrumentation [6, 44, 50, 52] could a prototype called GRIFFIN in the Linux 4.2 kernel that en- ables complete CFI enforcement over a variety of software, instrument programs written in a variety of languages and including the Firefox browser and its jitted code. Our ex- legacy binaries, but as yet cannot enforce as accurate CFGs as compile-time, cannot apply some compile-time optimiza- periments show that GRIFFIN can enforce fine-grained CFI policies with shadow stack as recommended by researchers tions (e.g., safe stack [30]), and also fixes the instrumen- at a performance that is comparable to software-only instru- tation. Runtime instrumentation [17, 39] has the flexibility mentation techniques. In addition, we find that alternative of turning the protection on and off, but the overhead is far logging approaches yield significant performance improve- higher than for fixed instrumentation. ments for trace processing, identifying opportunities for fur- Hardware-assisted CFI enforcement avoids the limita- ther hardware assistance. tions above by using hardware-generated logs to check in- direct control transfers. But current methods either fail to CCS Concepts • Security and privacy ! Operating sys- provide a complete CFI defense or incur unacceptable over- tems security heads when applied completely. For example, researchers Keywords Intel Processor Trace; Control-Flow Integrity have applied the Last Branch Record (LBR) [5, Sec. 17.4] 1. Introduction feature to enforce CFI defenses using its ability to store 8-16 control transfers [11, 36, 43] to improve performance. While Control-Flow Integrity [6] (CFI) is a runtime security de- researchers have shown that LBR traces may be augmented fense that limits a program’s indirect control transfers to a by heuristics [11, 36], others have shown that adversaries can evade these heuristic defenses [9]. To achieve complete en- forcement, researchers have explored using the Branch Trace Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice Store (BTS) [5, Sec. 17.4.5] to record control transfers [47] and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to and the Performance Monitoring Unit (PMU) [5, Chap. 18] lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. to trigger interrupts when the LBR fills [48]. Some have es- ASPLOS ’17 April 08–12, 2017, Xi’an, China c 2017 Copyright held by the owner/author(s). Publication rights licensed to ACM. timated that the BTS incurs a significant performance slow- ISBN 978-1-4503-4465-4/17/04. $15.00 DOI: http://dx.doi.org/10.1145/3037697.3037716 down (20x-40x) [43], and the PMU will trigger interrupts This allows GRIFFIN to enforce restrictive CFI policies rec- after every 16 indirect control transfers. ommended by researchers [6, 10] and to balance security In this paper, we explore the effectiveness of a CFI en- with performance. GRIFFIN marks a significant improve- forcement based on a new, commercially available hardware ment in hardware-assisted CFI enforcement mechanisms by feature called Processor Trace (PT) on Intel CPUs [5, Chap. providing complete and flexible CFI enforcement that per- 36]. Intel PT was designed to aid in debugging and failure forms comparably to software-only instrumentation meth- diagnosis by recording the minimal information necessary ods. When enforcing a fine-grained CFG on forward edges to reconstruct complete control-flow traces. For instance, re- and a shadow stack [6] on backward edges, GRIFFIN in- searchers have previously developed offline techniques that curs an overhead of 11.9% on the SPECint benchmarks and are able to diagnose complex failures using Intel PT [29]. 6.2% on SPECfp benchmarks, as compared to 11.6% and Given Intel PT’s ability to record control flow traces, we in- 6.0% overhead, respectively, for software-only shadow stack vestigate using Intel PT for online enforcement of CFI poli- enforcement alone [16]. Since we utilize memory and idle cies. We design and implement GRIFFIN, an operating sys- core resources to achieve this performance, we evaluate the tem mechanism that leverages the Intel PT feature to en- impact of such resource usage. Our experiments show that force CFI policies over unmodified binaries. When a binary GRIFFIN’s memory usage depends mainly on the program’s is run on GRIFFIN,GRIFFIN restricts the binary’s execution size and processing backlog and its performance degrades by comparing each indirect control transfer in the binary’s gracefully with fewer cores. execution trace captured using Intel PT to a CFI policy for Despite a highly-optimized GRIFFIN implementation that the binary. GRIFFIN may enforce CFI policies produced by achieves performance comparable to software-only instru- executing the binary program (e.g., shadow stack) or lever- mentation techniques, such performance is generally consid- age CFI policies produced elsewhere. In addition, GRIFFIN ered insufficient for widespread adoption. We propose two may change the CFI policies being enforced dynamically to modifications to Intel PT logging that have the potential to manage performance and/or customize enforcement. improve performance and reduce memory usage for CFI en- Our goal is to build a high performance CFI enforcement forcement on forward edges. First, by logging the indirect mechanism that is capable of enforcing a variety of CFI poli- call sites as well as indirect call targets, GRIFFIN can en- cies over unmodified binaries. Implementing online CFI en- force fine-grained CFI policies without performing control- forcement using Intel PT to meet this goal presents several flow reconstruction, resulting in a 90% improvement in trace challenges. Intel PT logs the information necessary to recon- processing on average for SPEC benchmarks. We no longer struct a complete control-flow trace, but leaves the recon- need to log the conditional branches for this approach, re- struction of the trace to post-processing. To enforce some sulting in a 60% reduction in trace size on average (although CFI policies, we need to know the call sites executed at run- some traces may increase in size slightly). However, this first time, but Intel PT does not record call sites, as they can be approach undermines our ability to enforce stateful CFI poli- inferred from other information. Thus, we must disassemble cies because we lack the information to reconstruct control the binary and interpret the logged trace buffers to recover flows to determine states. We propose a second approach that the program’s control-flow trace necessary for CFI enforce- applies selective logging of conditional branches to collect ment. We explore design choices that optimize the efficiency the control-flow information necessary to evaluate stateful of trace processing and CFI enforcement. First, we design a policies. For one stateful CFI policy [43], we find that the data structure for fast lookup of basic block information for trace size for the worst case program increases from 0.9% control-flow reconstruction that works efficiently for current of its original trace size after the first modification to 1.4% programs of all sizes. Second, GRIFFIN leverages idle cores after enabling selective logging. to run disassembly, trace processing, and CFI enforcement In particular, we make the following contributions: in parallel. The GRIFFIN design carefully prevents the need for synchronization delays among these parallel activities.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    14 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us