Skip to content
  1. Jun 19, 2015
    • Alexander Potapenko's avatar
      [ASan] Initial support for Kernel AddressSanitizer · b9b73ef9
      Alexander Potapenko authored
      This patch adds initial support for the -fsanitize=kernel-address flag to Clang.
      Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported.
      Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux.
      To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used.
      
      llvm-svn: 240131
      b9b73ef9
    • Eric Christopher's avatar
      Fix "the the" in comments. · 572e03a3
      Eric Christopher authored
      llvm-svn: 240112
      572e03a3
  2. Jun 18, 2015
  3. Jun 17, 2015
  4. Jun 16, 2015
  5. Jun 15, 2015
    • Peter Collingbourne's avatar
      Protection against stack-based memory corruption errors using SafeStack · 82437bf7
      Peter Collingbourne authored
      This patch adds the safe stack instrumentation pass to LLVM, which separates
      the program stack into a safe stack, which stores return addresses, register
      spills, and local variables that are statically verified to be accessed
      in a safe way, and the unsafe stack, which stores everything else. Such
      separation makes it much harder for an attacker to corrupt objects on the
      safe stack, including function pointers stored in spilled registers and
      return addresses. You can find more information about the safe stack, as
      well as other parts of or control-flow hijack protection technique in our
      OSDI paper on code-pointer integrity (http://dslab.epfl.ch/pubs/cpi.pdf)
      and our project website (http://levee.epfl.ch).
      
      The overhead of our implementation of the safe stack is very close to zero
      (0.01% on the Phoronix benchmarks). This is lower than the overhead of
      stack cookies, which are supported by LLVM and are commonly used today,
      yet the security guarantees of the safe stack are strictly stronger than
      stack cookies. In some cases, the safe stack improves performance due to
      better cache locality.
      
      Our current implementation of the safe stack is stable and robust, we
      used it to recompile multiple projects on Linux including Chromium, and
      we also recompiled the entire FreeBSD user-space system and more than 100
      packages. We ran unit tests on the FreeBSD system and many of the packages
      and observed no errors caused by the safe stack. The safe stack is also fully
      binary compatible with non-instrumented code and can be applied to parts of
      a program selectively.
      
      This patch is our implementation of the safe stack on top of LLVM. The
      patches make the following changes:
      
      - Add the safestack function attribute, similar to the ssp, sspstrong and
        sspreq attributes.
      
      - Add the SafeStack instrumentation pass that applies the safe stack to all
        functions that have the safestack attribute. This pass moves all unsafe local
        variables to the unsafe stack with a separate stack pointer, whereas all
        safe variables remain on the regular stack that is managed by LLVM as usual.
      
      - Invoke the pass as the last stage before code generation (at the same time
        the existing cookie-based stack protector pass is invoked).
      
      - Add unit tests for the safe stack.
      
      Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
      Lab at EPFL; updates and upstreaming by myself.
      
      Differential Revision: http://reviews.llvm.org/D6094
      
      llvm-svn: 239761
      82437bf7
  6. Jun 13, 2015
    • Benjamin Kramer's avatar
      [Statepoints] Skip a vector copy when uniquing values. · 258ea0db
      Benjamin Kramer authored
      No functionality change intended.
      
      llvm-svn: 239688
      258ea0db
    • Matt Wala's avatar
      Revert 239644. · bfb5368c
      Matt Wala authored
      llvm-svn: 239650
      bfb5368c
    • Matt Wala's avatar
      [Scalarizer] Fix potential for stale data in Scattered across invocations · 1f48192d
      Matt Wala authored
      Summary:
      Scalarizer has two data structures that hold information about changes
      to the function, Gathered and Scattered. These are cleared in finish()
      at the end of runOnFunction() if finish() detects any changes to the
      function. 
      
      However, finish() was checking for changes by only checking if
      Gathered was non-empty. The function visitStore() only modifies
      Scattered without touching Gathered. As a result, Scattered could have
      ended up having stale data if Scalarizer only scalarized store
      instructions. Since the data in Scattered is used during the execution
      of the pass, this introduced dangling pointer errors. 
      
      The fix is to check whether both Scattered and Gathered are empty
      before deciding what to do in finish().
      
      Reviewers: srhines
      
      Reviewed By: srhines
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D10422
      
      llvm-svn: 239644
      1f48192d
  7. Jun 12, 2015
  8. Jun 11, 2015
    • Alexey Samsonov's avatar
      [LoopUnroll] Use IRBuilder to create branch instructions. · ea20199b
      Alexey Samsonov authored
      Use IRBuilder::Create(Cond)?Br instead of constructing instructions
      manually with BranchInst::Create(). It's consistent with other
      uses of IRBuilder in this pass, and has an additional important
      benefit:
      
      Using IRBuilder will ensure that new branch instruction will get
      the same debug location as original terminator instruction it will
      eventually replace.
      
      For now I'm not adding a testcase, as currently original terminator
      instruction also lack debug location due to missing debug location
      propagation in BasicBlock::splitBasicBlock. That is, the testcase
      will accompany the fix for the latter I'm going to mail soon.
      
      llvm-svn: 239550
      ea20199b
    • Matt Arsenault's avatar
      SLSR: Pass address space to isLegalAddressingMode · 91f90e69
      Matt Arsenault authored
      This only updates one of the uses. The other is used in cases
      that may never touch memory, so I'm not sure why this is even
      calling it. Perhaps there should be a new, similar hook for such
      cases or pass -1 for unknown address space.
      
      llvm-svn: 239540
      91f90e69
    • Hao Liu's avatar
      [LoopVectorize] Revert the enabling of interleaved memory access in Loop... · 405f1d16
      Hao Liu authored
      [LoopVectorize] Revert the enabling of interleaved memory access in Loop Vectorizor, which was wrongly committed in r239514.
      
      llvm-svn: 239515
      405f1d16
    • Hao Liu's avatar
      [AArch64] Match interleaved memory accesses into ldN/stN instructions. · 4566d18e
      Hao Liu authored
      Add a pass AArch64InterleavedAccess to identify and match interleaved memory accesses. This pass transforms an interleaved load/store into ldN/stN intrinsic. As Loop Vectorizor disables optimization on interleaved accesses by default, this optimization is also disabled by default. To enable it by "-aarch64-interleaved-access-opt=true"
      
      E.g. Transform an interleaved load (Factor = 2):
             %wide.vec = load <8 x i32>, <8 x i32>* %ptr
             %v0 = shuffle %wide.vec, undef, <0, 2, 4, 6>  ; Extract even elements
             %v1 = shuffle %wide.vec, undef, <1, 3, 5, 7>  ; Extract odd elements
           Into:
             %ld2 = { <4 x i32>, <4 x i32> } call aarch64.neon.ld2(%ptr)
             %v0 = extractelement { <4 x i32>, <4 x i32> } %ld2, i32 0
             %v1 = extractelement { <4 x i32>, <4 x i32> } %ld2, i32 1
      
      E.g. Transform an interleaved store (Factor = 2):
             %i.vec = shuffle %v0, %v1, <0, 4, 1, 5, 2, 6, 3, 7>  ; Interleaved vec
             store <8 x i32> %i.vec, <8 x i32>* %ptr
           Into:
             %v0 = shuffle %i.vec, undef, <0, 1, 2, 3>
             %v1 = shuffle %i.vec, undef, <4, 5, 6, 7>
             call void aarch64.neon.st2(%v0, %v1, %ptr)
      
      llvm-svn: 239514
      4566d18e
  9. Jun 10, 2015
    • Peter Collingbourne's avatar
      ArgumentPromotion: Drop sret attribute on functions that are only called directly. · 115fe376
      Peter Collingbourne authored
      If the first argument to a function is a 'this' argument and the second
      has the sret attribute, the ArgumentPromotion pass may promote the 'this'
      argument to more than one argument, violating the IR constraint that 'sret'
      may only be applied to the first or second argument.
      
      Although this IR constraint is arguably unnecessary, it highlighted the fact
      that ArgPromotion does not need to preserve this attribute. Dropping the
      attribute reduces register pressure in the backend by avoiding the register
      copy required by sret. Because sret implies noalias, we also replace the
      former with the latter.
      
      Differential Revision: http://reviews.llvm.org/D10353
      
      llvm-svn: 239488
      115fe376
    • Teresa Johnson's avatar
      Add new EliminateAvailableExternally module pass, which is performed in · 232fa9af
      Teresa Johnson authored
      O2 compiles just before GlobalDCE, unless we are preparing for LTO.
      
      This pass eliminates available externally globals (turning them into
      declarations), regardless of whether they are dead/unreferenced, since
      we are guaranteed to have a copy available elsewhere at link time.
      This enables additional opportunities for GlobalDCE.
      
      If we are preparing for LTO (e.g. a -flto -c compile), the pass is not
      included as we want to preserve available externally functions for possible
      link time inlining. The FE indicates whether we are doing an -flto compile
      via the new PrepareForLTO flag on the PassManagerBuilder.
      
      llvm-svn: 239480
      232fa9af
    • Alexey Samsonov's avatar
      [GVN] Set proper debug locations for some instructions created by GVN. · 89645dfa
      Alexey Samsonov authored
      Determining proper debug locations for instructions created in
      PHITransAddr is tricky. We use a simple approach here and simply copy
      debug locations from instructions computing load address to
      "corresponding" instructions re-creating the address computation
      in predecessor basic blocks.
      
      This may not always be correct, given all the rearrangement and
      simplification going on, and debug locations may jump around a lot,
      as the basic blocks we copy locations between may be very far from
      each other.
      
      Still, this would work good in most simple cases (e.g. when chain
      of address computing instruction is short, or our mapping turns out
      to be 1-to-1), and we desire to have *some* reasonable debug locations
      associated with newly inserted instructions.
      
      See http://reviews.llvm.org/D10351 review thread for more details.
      
      Test Plan: regression test suite
      
      Reviewers: spatel, dblaikie
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D10351
      
      llvm-svn: 239479
      89645dfa
    • Alexey Samsonov's avatar
      [BasicBlockUtils] Set debug locations for instructions created in SplitBlockPredecessors. · b7f02d37
      Alexey Samsonov authored
      Test Plan: regression test suite
      
      Reviewers: eugenis, dblaikie
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D10343
      
      llvm-svn: 239438
      b7f02d37
  10. Jun 09, 2015
Loading